/* Medical Timeline Styles */

.medical-timeline {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem 0;
}

/* Vertical line */
.medical-timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, 
        var(--md-primary-fg-color),
        var(--md-accent-fg-color)
    );
    opacity: 0.3;
}

/* Timeline item */
.timeline-item {
    position: relative;
    padding-left: 80px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

/* Spacing classes for scaled dates */
.timeline-spacing-small {
    margin-top: 1rem;
}

.timeline-spacing-medium {
    margin-top: 2rem;
}

.timeline-spacing-large {
    margin-top: 3.5rem;
}

/* Marker dot */
.timeline-marker {
    position: absolute;
    left: 18px;
    top: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--md-default-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.1);
}

.timeline-icon {
    font-size: 0.85rem;
}

/* Content card */
.timeline-content {
    position: relative;
    background: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-content {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateX(4px);
}

/* Category flag in top-right corner */
.timeline-category-flag {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0 8px 0 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 1;
}

.category-icon {
    font-size: 0.9rem;
}

.category-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header with date + title combined */
.timeline-header {
    margin-bottom: 0.5rem;
    padding-right: 130px; /* Space for category flag */
}

.timeline-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0 0 !important;
    color: var(--md-default-fg-color);
    line-height: 1.4;
}

.timeline-description {
    font-size: 0.9rem;
    color: var(--md-default-fg-color--light);
    margin: 0;
    line-height: 1.5;
}

/* Footer container for notes and documents */
.timeline-footer {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--md-default-fg-color--lightest);
    align-items: flex-start;
}

.timeline-notes {
    flex: 0 0 50%;
    width: 50%;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background: var(--md-code-bg-color);
    border-left: 3px solid var(--md-accent-fg-color);
    border-radius: 4px;
    font-family: var(--md-code-font-family);
}

/* Documents section */
.timeline-documents {
    flex: 0 0 50%;
    width: 50%;
    min-width: 0;
}

.documents-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.documents-list li {
    margin: 0;
}

.timeline-doc-link {
    display: inline-block;
    color: var(--md-primary-fg-color);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.15rem 0;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.timeline-doc-link:hover {
    color: var(--md-accent-fg-color);
    border-bottom-color: var(--md-accent-fg-color);
    padding-left: 0.3rem;
}

.timeline-doc-link::before {
    content: '📄';
    margin-right: 0.4rem;
    opacity: 0.7;
}

/* Filters */
.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.timeline-filter {
    padding: 0.5rem 1rem;
    border: 2px solid var(--md-default-fg-color--lightest);
    background: var(--md-default-bg-color);
    color: var(--md-default-fg-color);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-filter:hover {
    border-color: var(--md-primary-fg-color);
    background: var(--md-code-bg-color);
}

.timeline-filter.active {
    background: var(--md-primary-fg-color);
    color: white;
    border-color: var(--md-primary-fg-color);
}

/* Loading/Error states */
.timeline-loading,
.timeline-error,
.timeline-empty {
    text-align: center;
    padding: 3rem;
    color: var(--md-default-fg-color--light);
    font-size: 1.1rem;
}

.timeline-error {
    color: var(--md-typeset-a-color);
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .timeline-content {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-md-color-scheme="slate"] .timeline-item:hover .timeline-content {
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

[data-md-color-scheme="slate"] .timeline-marker {
    border-color: var(--md-default-bg-color);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.1);
}

/* Responsive design */
@media (max-width: 768px) {
    .medical-timeline {
        padding: 1rem 0;
    }
    
    .timeline-item {
        padding-left: 60px;
        margin-bottom: 0.75rem;
    }
    
    .timeline-marker {
        left: 12px;
        width: 22px;
        height: 22px;
    }
    
    .timeline-icon {
        font-size: 0.75rem;
    }
    
    .medical-timeline::before {
        left: 23px;
        width: 2px;
    }
    
    .timeline-content {
        padding: 0.85rem 1rem;
    }
    
    .timeline-header {
        padding-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .timeline-category-flag {
        position: static;
        display: inline-flex;
        margin-bottom: 0.5rem;
        border-radius: 12px;
    }
    
    .timeline-title {
        font-size: 0.95rem;
    }
    
    .timeline-description {
        font-size: 0.85rem;
    }
    
    .timeline-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .timeline-notes {
        max-width: 100%;
    }
    
    .timeline-spacing-small {
        margin-top: 0.75rem;
    }
    
    .timeline-spacing-medium {
        margin-top: 1.5rem;
    }
    
    .timeline-spacing-large {
        margin-top: 2.5rem;
    }
}
/* Responsive */
@media screen and (max-width: 768px) {
    .medical-timeline {
        padding: 1rem 0;
    }
    
    .medical-timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 60px;
    }
    
    .timeline-marker {
        left: 8px;
        width: 24px;
        height: 24px;
    }
    
    .timeline-icon {
        font-size: 0.75rem;
    }
    
    .timeline-spacing-small {
        margin-top: 1.5rem;
    }
    
    .timeline-spacing-medium {
        margin-top: 3rem;
    }
    
    .timeline-spacing-large {
        margin-top: 4.5rem;
    }
}
