/* CSS Custom Properties for better maintainability */
:root {
    --primary-color: #e91e63;
    --secondary-color: #c2185b;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --bg-white: #ffffff;
    --bg-light: #f0f0f0;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 30px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --border-radius: 10px;
    --border-radius-lg: 15px;
    --border-radius-xl: 20px;
}

/* Reset and Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #ffeef3 0%, #fce4ec 50%, #f8bbd0 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 15px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.back-btn:active {
    transform: scale(0.95);
}

.header h1 {
    font-size: clamp(20px, 4vw, 28px);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--bg-white);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    will-change: transform, box-shadow;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.add-btn:active {
    transform: translateY(0);
}

/* Filter Bar */
.filter-bar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.filter-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
}

.filter-btn.active,
.filter-btn:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--bg-white);
    border-color: transparent;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.search-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Main Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
}

.timeline-event {
    position: relative;
    margin-bottom: 50px;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-event.left {
    padding-right: calc(50% + 40px);
    text-align: right;
}

.timeline-event.right {
    padding-left: calc(50% + 40px);
    text-align: left;
}

.timeline-dot {
    position: absolute;
    top: 20px;
    width: 20px;
    height: 20px;
    background: var(--bg-white);
    border: 4px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.15);
    z-index: 1;
}

.timeline-event.left .timeline-dot {
    right: calc(50% - 10px);
}

.timeline-event.right .timeline-dot {
    left: calc(50% - 10px);
}

.timeline-content {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    will-change: transform, box-shadow;
}

.timeline-content:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-xl);
}

.timeline-content::after {
    content: '';
    position: absolute;
    top: 20px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

.timeline-event.left .timeline-content::after {
    right: -20px;
    border-left-color: white;
}

.timeline-event.right .timeline-content::after {
    left: -20px;
    border-right-color: var(--bg-white);
}

.event-date {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.event-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    flex: 1;
}

.event-description {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-location {
    font-size: 13px;
    color: var(--text-lighter);
    display: flex;
    align-items: center;
    gap: 5px;
}

.event-location::before {
    content: '📍';
}

.event-image {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 15px;
}

.no-events {
    text-align: center;
    padding: 60px 20px;
    color: #c2185b;
    font-size: 18px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.detail-content {
    max-width: 700px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-lighter);
    transition: var(--transition);
}

.close:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-lighter);
}

/* No Events State */
.no-events {
    text-align: center;
    padding: 60px 20px;
    color: #c2185b;
    font-size: 18px;
}

.no-events-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.quick-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.quick-add-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Filter Buttons */
.filter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
    border-color: var(--primary-color);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--bg-white);
    border-color: transparent;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.filter-btn.active::before {
    opacity: 1;
}

/* Image Preview */
.image-preview {
    margin-top: 10px;
    max-height: 200px;
    overflow: hidden;
    border-radius: var(--border-radius);
    display: none;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-cancel {
    background: var(--bg-light);
    color: var(--text-color);
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--bg-white);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Detail Modal Styles */
.detail-header {
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.detail-date {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.detail-event h2 {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 10px;
}

.detail-location {
    color: var(--text-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-location::before {
    content: '📍';
}

.detail-description {
    font-size: 16px;
    line-height: 1.8;
    color: #444;
    margin-bottom: 20px;
}

.detail-image {
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.detail-actions button {
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-edit {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

.detail-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(233, 30, 99, 0.1);
    border-radius: var(--border-radius);
    color: #c2185b;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

.delete-btn {
    background: #ff4444;
    color: var(--bg-white);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.delete-btn:hover {
    background: #cc0000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-bar {
        padding: 10px 20px;
        justify-content: center;
    }
    
    .timeline::before {
        left: 30px;
    }
    
    .timeline-event.left,
    .timeline-event.right {
        padding-left: 70px;
        padding-right: 20px;
        text-align: left;
    }
    
    .timeline-event.left .timeline-dot,
    .timeline-event.right .timeline-dot {
        left: 20px;
        right: auto;
    }
    
    .timeline-content::after {
        display: none;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .form-buttons {
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
    }
    
    .timeline-content {
        padding: 20px;
    }
}

/* Performance optimizations */
.timeline-event {
    contain: layout style paint;
}

.modal-content {
    contain: layout style;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
