/**
 * Public Timeline Styles
 * Interactive timeline visualization for Trump-Epstein events
 */

/* ============================================================================
   Layout
   ============================================================================ */

.timeline-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.timeline-loading,
.timeline-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    color: var(--text-muted, #9ca3af);
}

.timeline-error h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary, #f9fafb);
}

.timeline-error .btn {
    margin-top: 1rem;
}

/* ============================================================================
   Deadline Banner
   ============================================================================ */

.deadline-banner {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15) 0%, rgba(185, 28, 28, 0.1) 100%);
    border: 1px solid rgba(220, 38, 38, 0.4);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.deadline-banner__content {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.deadline-banner__count {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ef4444;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.deadline-banner__label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #f9fafb);
}

.deadline-banner__text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted, #9ca3af);
    line-height: 1.5;
}

/* ============================================================================
   Header
   ============================================================================ */

.timeline-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #374151);
}

.timeline-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary, #f9fafb);
}

.timeline-subtitle {
    color: var(--text-muted, #9ca3af);
    margin: 0;
    font-size: 1rem;
}

/* ============================================================================
   Filters
   ============================================================================ */

.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-secondary, #1f2937);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background: var(--bg-primary, #111827);
    border: 1px solid var(--border-color, #374151);
    border-radius: 6px;
    color: var(--text-primary, #f9fafb);
    font-size: 0.875rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    min-width: 140px;
}

/* Fixed widths to prevent layout shift when options change */
#timeline-era-filter {
    width: 220px;
}

#timeline-category-filter {
    width: 180px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-color, #60a5fa);
}

.filter-group--checkbox {
    justify-content: flex-end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary, #d1d5db);
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--accent-color, #60a5fa);
}

/* ============================================================================
   Timeline Container
   ============================================================================ */

.timeline-container {
    position: relative;
}

.timeline-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted, #9ca3af);
}

/* ============================================================================
   Era Sections
   ============================================================================ */

.timeline-era {
    margin-bottom: 3rem;
}

.era-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(90deg, var(--era-color, #60a5fa)10, transparent);
    border-left: 4px solid var(--era-color, #60a5fa);
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.era-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #f9fafb);
}

.era-range {
    font-size: 0.875rem;
    color: var(--text-muted, #9ca3af);
}

.era-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    background: var(--bg-secondary, #1f2937);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* ============================================================================
   Events
   ============================================================================ */

.era-events {
    position: relative;
    padding-left: 2rem;
}

/* Timeline line */
.era-events::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color, #374151);
}

.timeline-event {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-event:last-child {
    margin-bottom: 0;
}

/* Event marker */
.event-marker {
    position: absolute;
    left: -1.5rem;
    top: 0.75rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #111827);
    z-index: 1;
}

.timeline-event--highlight .event-marker {
    width: 16px;
    height: 16px;
    left: calc(-1.5rem - 2px);
    top: calc(0.75rem - 2px);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3);
}

/* Event content */
.event-content {
    background: var(--bg-secondary, #1f2937);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.timeline-event--highlight .event-content {
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.timeline-event--expanded .event-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Event header (clickable) */
.event-header {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.event-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.event-date {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
    min-width: 80px;
}

.event-title {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary, #f9fafb);
    line-height: 1.4;
}

.highlight-star {
    color: #fbbf24;
    font-weight: 700;
    margin-right: 0.25rem;
}

.event-category {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.event-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted, #9ca3af);
    transition: color 0.15s ease;
}

.event-toggle:hover {
    color: var(--text-primary, #f9fafb);
}

.event-toggle svg {
    transition: transform 0.2s ease;
}

/* Event body */
.event-body {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border-color, #374151);
}

.event-description {
    margin: 1rem 0;
    color: var(--text-secondary, #d1d5db);
    line-height: 1.6;
}

.event-image {
    margin: 1rem 0;
}

.event-image img {
    max-width: 100%;
    border-radius: 6px;
}

.event-image figcaption {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    margin-top: 0.5rem;
    text-align: center;
}

.event-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 1rem;
}

.event-details-btn {
    width: 100%;
}

/* ============================================================================
   Legend
   ============================================================================ */

.timeline-legend {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #374151);
}

.timeline-legend h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #9ca3af);
    margin: 0 0 1rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color, #374151);
    border-radius: 9999px;
    color: var(--text-secondary, #d1d5db);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.legend-item:hover {
    border-color: var(--cat-color);
    background: rgba(255, 255, 255, 0.03);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ============================================================================
   Modal
   ============================================================================ */

.timeline-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.timeline-modal {
    background: var(--bg-primary, #111827);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #374151);
}

.modal-header__info {
    flex: 1;
}

.modal-date {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.25rem 0 0;
    color: var(--text-primary, #f9fafb);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--text-primary, #f9fafb);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-description {
    color: var(--text-secondary, #d1d5db);
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #f9fafb);
    margin: 0 0 0.75rem;
}

/* Sources in modal */
.sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-secondary, #1f2937);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.source-type {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.source-type--primary {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.source-type--secondary {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.source-type--archive {
    background: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
}

.source-item a {
    color: var(--text-primary, #f9fafb);
    text-decoration: none;
}

.source-item a:hover {
    text-decoration: underline;
}

.archive-link {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af) !important;
}

/* Files grid in modal */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.file-card {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: var(--bg-secondary, #1f2937);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.file-card:hover {
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

.file-bates {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--accent-color, #60a5fa);
}

.file-name {
    font-size: 0.875rem;
    color: var(--text-primary, #f9fafb);
    margin: 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
}

.file-notes {
    font-size: 0.75rem;
    color: var(--text-secondary, #d1d5db);
    font-style: italic;
    margin-top: 0.25rem;
}

/* Modal navigation */
.modal-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #374151);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary, #1f2937);
    border: 1px solid var(--border-color, #374151);
    border-radius: 6px;
    color: var(--text-secondary, #d1d5db);
    cursor: pointer;
    max-width: 45%;
    transition: all 0.15s ease;
}

.nav-btn:hover {
    border-color: var(--accent-color, #60a5fa);
    color: var(--text-primary, #f9fafb);
}

.nav-btn--next {
    text-align: right;
}

.nav-arrow {
    font-size: 1rem;
}

.nav-label {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 640px) {
    .timeline-page {
        padding: 1rem;
    }

    .deadline-banner {
        padding: 1rem;
    }

    .deadline-banner__content {
        flex-direction: column;
        gap: 0.25rem;
    }

    .deadline-banner__count {
        font-size: 2rem;
    }

    .deadline-banner__label {
        font-size: 1rem;
    }

    .timeline-title {
        font-size: 1.5rem;
    }

    .timeline-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select,
    #timeline-era-filter,
    #timeline-category-filter {
        width: 100%;
    }

    .event-header {
        grid-template-columns: 1fr auto;
        gap: 0.5rem;
    }

    .event-date {
        grid-column: 1 / -1;
    }

    .event-category {
        display: none;
    }

    .era-header {
        flex-wrap: wrap;
    }

    .era-count {
        margin-left: 0;
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }

    .modal-nav {
        flex-direction: column;
    }

    .nav-btn {
        max-width: 100%;
    }
}
