/* ============================================
   TIMELINE FEATURE STYLES
   ============================================ */

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    margin: 0 0 8px 0;
    color: var(--text-primary, #1f2937);
    font-size: 32px;
}

.subtitle {
    color: var(--text-secondary, #6b7280);
    font-size: 16px;
    margin: 8px 0 16px 0;
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
}

.breadcrumb a {
    color: var(--primary-color, #3b82f6);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Form Section */
.timeline-form-section {
    max-width: 800px;
    margin: 40px auto;
}

.form-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary, #1f2937);
}

.form-card textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-card textarea:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
}

.time-range-controls {
    margin: 24px 0;
}

.date-selectors {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.date-input {
    flex: 1;
}

.date-input label {
    font-size: 14px;
    margin-bottom: 4px;
}

.date-picker {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s;
}

.date-picker:hover {
    border-color: #d1d5db;
}

.date-picker:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
}

.date-separator {
    font-size: 24px;
    color: var(--text-secondary, #6b7280);
    margin-top: 24px;
}

.info-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.info-box p {
    margin: 8px 0;
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading State */
.loading-container {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color, #3b82f6);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin-bottom: 16px;
}

.progress-details {
    text-align: left;
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
    max-height: 300px;
    overflow-y: auto;
}

.progress-line {
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
}

/* ============================================
   ENHANCED TIMELINE RESULTS
   ============================================ */

.timeline-results {
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.timeline-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #f3f4f6;
}

.timeline-header h2 {
    margin: 0 0 12px 0;
    color: var(--text-primary, #1f2937);
    font-size: 28px;
    font-weight: 700;
}

.timeline-range {
    color: var(--text-secondary, #6b7280);
    font-size: 16px;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    margin: 16px 0;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.evolving_fact {
    background: #dbeafe;
    color: #1e40af;
}

.category-badge.debunking_journey {
    background: #fee2e2;
    color: #991b1b;
}

.category-badge.stable_truth {
    background: #d1fae5;
    color: #065f46;
}

.category-badge.stable_falsehood {
    background: #fef3c7;
    color: #92400e;
}

.category-badge.narrative_mutation {
    background: #e9d5ff;
    color: #6b21a8;
}

/* Summary Section */
.narrative-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin: 24px 0;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.narrative-summary h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.narrative-summary p {
    margin: 0;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 15px;
}

.key-insight {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.key-insight strong {
    color: var(--text-primary);
    font-weight: 600;
}

.key-insight p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.current-status {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    border-left: 4px solid var(--secondary-color);
    box-shadow: var(--shadow-sm);
}

.current-status strong {
    color: var(--text-primary);
    font-weight: 600;
}

.current-status p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.timeline-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.summary-stat {
    background: #f3f4f6;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.no-transitions {
    text-align: center;
    padding: 40px;
    background: #f0fdf4;
    border-radius: 8px;
    color: #166534;
}

.no-transitions p {
    margin: 12px 0;
}

/* ============================================
   ENHANCED EVENT TIMELINE
   ============================================ */

.timeline-container {
    position: relative;
    padding-left: 70px;
    margin-top: 48px;
}

.timeline-line {
    position: absolute;
    left: 32px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    background: linear-gradient(to bottom, #e5e7eb 0%, #3b82f6 50%, #e5e7eb 100%);
    border-radius: 2px;
}

/* Event Card */
.timeline-event {
    position: relative;
    margin-bottom: 48px;
    animation: fadeInUp 0.4s ease-out;
}

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

.event-marker {
    position: absolute;
    left: -52px;
    top: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 4px solid;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.event-marker:hover {
    transform: scale(1.15);
}

.event-marker.consistent {
    border-color: #10b981;
    background: #d1fae5;
}

.event-marker.inconsistent {
    border-color: #ef4444;
    background: #fee2e2;
}

.event-marker.unverified {
    border-color: #f59e0b;
    background: #fef3c7;
}

/* Event Type Icon */
.event-type-badge {
    position: absolute;
    left: -48px;
    top: 42px;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.event-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.event-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: #d1d5db;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
    gap: 16px;
}

.event-date {
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.event-verdict-badge {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.event-verdict-badge.consistent {
    background: #d1fae5;
    color: #065f46;
}

.event-verdict-badge.inconsistent {
    background: #fee2e2;
    color: #991b1b;
}

.event-verdict-badge.unverified {
    background: #fef3c7;
    color: #92400e;
}

.event-description {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    line-height: 1.5;
}

.event-explanation {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.event-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.meta-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.meta-value {
    font-weight: 600;
    color: #374151;
}

/* Event Sources */
.event-sources {
    margin-top: 16px;
}

.event-sources summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
    padding: 8px 0;
    user-select: none;
}

.event-sources summary:hover {
    text-decoration: underline;
}

.source-list {
    margin-top: 12px;
    padding-left: 0;
    list-style: none;
}

.source-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #e5e7eb;
    font-size: 13px;
}

.source-item.reliable {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.source-item.mixed {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.source-item.unreliable {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.source-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.source-url {
    color: #3b82f6;
    text-decoration: none;
    font-size: 12px;
    word-break: break-all;
}

.source-url:hover {
    text-decoration: underline;
}

.timeline-period {
    position: relative;
    margin-bottom: 40px;
}

.timeline-dot {
    position: absolute;
    left: -44px;
    top: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid;
    background: white;
    z-index: 10;
}

.timeline-dot.unknown {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.timeline-dot.consistent {
    border-color: #10b981;
    background: #d1fae5;
}

.timeline-dot.inconsistent {
    border-color: #ef4444;
    background: #fee2e2;
}

.period-content {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #e5e7eb;
}

.period-content .period-date {
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 4px;
}

.period-verdict {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.period-verdict.unknown { color: #6b7280; }
.period-verdict.consistent { color: #059669; }
.period-verdict.inconsistent { color: #dc2626; }

.period-sources {
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
    margin-top: 8px;
}

.period-duration {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 8px;
    font-style: italic;
}

/* Transition Markers */
.transition-marker {
    margin: 30px 0;
    padding: 20px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    position: relative;
}

.transition-header {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.transition-dates {
    font-size: 13px;
    color: #78350f;
    margin-bottom: 12px;
}

.transition-arrow {
    font-size: 20px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.verdict-from, .verdict-to {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.verdict-from {
    background: #e5e7eb;
    color: #374151;
}

.verdict-to {
    background: #fbbf24;
    color: #78350f;
}

.transition-explanation {
    margin: 12px 0;
    padding: 12px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

.transition-stats {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    font-size: 13px;
    color: #78350f;
}

.transition-stats div {
    background: rgba(255, 255, 255, 0.6);
    padding: 6px 12px;
    border-radius: 4px;
}

/* Error Messages */
.error-message {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background: #fee2e2;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    color: #991b1b;
}

.error-message strong {
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .timeline-summary {
        flex-direction: column;
        align-items: center;
    }

    .date-selectors {
        flex-direction: column;
    }

    .date-separator {
        margin: 0;
        transform: rotate(90deg);
    }

    .timeline-results {
        padding: 20px;
    }

    .timeline-container {
        padding-left: 40px;
    }

    .timeline-dot {
        left: -34px;
    }

    .transition-stats {
        flex-direction: column;
        gap: 8px;
    }
}
