/* Timeline specific styles */
.timeline-container {
    position: relative;
    max-width: 90vw;
    margin: 0 auto;
    padding: 2rem 0;
}

.timeline-container::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
}

.timeline-year {
    text-align: center;
    margin: 3rem 0 2rem;
    position: relative;
}

.timeline-year h2 {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 2rem;
    border-radius: 2rem;
    position: relative;
    z-index: 1;
}

.timeline-event {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-event::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    right: -10px;
    background-color: white;
    border: 4px solid var(--accent-color);
    top: 20px;
    border-radius: 50%;
    z-index: 1;
}

.left {
    left: 0;
    padding-left: 0;
}

.right {
    left: 50%;
    padding-right: 0;
}

.left::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    right: 30px;
    border: medium solid #ffffff00;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent var(--primary-color);
}

.right::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    left: 30px;
    border: medium solid #ffffff00;
    border-width: 10px 10px 10px 0;
    border-color: transparent var(--primary-color) transparent transparent;
}

.right::after {
    left: -10px;
}

.timeline-content {
    padding: 20px 30px;
    background-color: white;
    position: relative;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

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

.timeline-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Override page-content max-width for timeline */
.page-content:has(.timeline-wrapper) {
    max-width: 100%;
    padding: 0 2rem 3rem;
}

/* Desktop - wider cards */
@media screen and (min-width: 1025px) {
    .timeline-event {
        padding: 10px 20px;
    }
}

/* Tablet - medium width cards */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .timeline-event {
        padding: 10px 25px;
    }
}

/* Responsive timeline - mobile */
@media screen and (max-width: 768px) {
    .timeline-container::after {
        left: 31px;
    }
    
    .timeline-event {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }
    
    .timeline-event::before {
        left: 60px;
        border: medium solid white;
        border-width: 10px 10px 10px 0;
        border-color: transparent white transparent transparent;
    }
    
    .left::after, .right::after {
        left: 21px;
    }
    
    .right {
        left: 0%;
    }

    .left, .right {
        padding-left: 70px;
        padding-right: 25px;
    }
    
    .timeline-year h2 {
        font-size: 1.5rem;
        padding: 0.5rem 1.5rem;
    }
}

/* Loading and error states */
.timeline-loading,
.timeline-error {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.timeline-error {
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 8px;
    padding: 1rem;
}

/* Category badges */
.timeline-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    margin-bottom: 0.8rem;
}

.timeline-category-badge span:first-child {
    font-size: 1rem;
}

/* Description */
.timeline-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0.5rem 0;
}

/* Medias section */
.timeline-medias {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.timeline-medias > div {
    width: 100%;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.media-item:hover:not(:disabled) {
    background-color: #e8e8e8;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.media-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.media-icon {
    font-size: 1.2rem;
}

.media-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Links section */
.timeline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.timeline-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.timeline-link-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Wrapper for better spacing */
.timeline-wrapper {
    min-height: 400px;
}

/* Gallery styles */
.timeline-gallery {
    margin-top: 1rem;
}

.gallery-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.gallery-grid-single {
    grid-template-columns: 1fr;
    max-width: 400px;
}

.gallery-grid-double {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    pointer-events: none;
}

.gallery-overlay span {
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

.gallery-item:hover .gallery-overlay span {
    opacity: 1;
}

/* Image modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.image-modal-close:hover {
    color: #ccc;
}

/* Navigation arrows */
.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 2.5rem;
    width: 50px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    z-index: 10000;
    user-select: none;
}

.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

/* Image counter */
.image-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    user-select: none;
}

/* Video styles */
.timeline-video {
    width: 100%;
    flex: 1 1 100%;
}

.video-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

@media screen and (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-modal-close {
        right: 20px;
        font-size: 30px;
    }

    .image-modal-nav {
        font-size: 1.8rem;
        width: 40px;
        height: 60px;
    }

    .image-modal-prev {
        left: 10px;
    }

    .image-modal-next {
        right: 10px;
    }
}