/* ============================================
   Economic Impact - Dedicated Styles
   Accent: #1b5e20 (green), #c62828 (red loss)
   ============================================ */

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #1b5e20, #ffd54f);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* History Header */
.history-header {
    background: linear-gradient(135deg, #0d3b0d 0%, #1b5e20 50%, #2e7d32 100%);
    color: white;
    padding: 3rem 0 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.history-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.history-header .container {
    position: relative;
    z-index: 1;
}

.history-header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.history-header h1 i {
    color: #ffd54f;
    margin-right: 0.5rem;
}

.history-header .subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    margin-bottom: 1rem;
}

.history-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.history-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.history-meta i {
    color: #ffd54f;
}

/* Layout: Sidebar + Content */
.history-layout {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

/* Table of Contents - Sidebar */
.toc-nav {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
}

.toc-nav h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.25rem;
}

.toc-list a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: #555;
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.toc-list a:hover {
    background: #f8f9fa;
    color: #1a1a2e;
}

.toc-list a.active {
    background: rgba(27, 94, 32, 0.08);
    color: #1b5e20;
    border-left-color: #1b5e20;
    font-weight: 600;
}

/* Mobile TOC Toggle */
.toc-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1b5e20;
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
}

/* Main Content Area */
.history-content {
    flex: 1;
    min-width: 0;
}

/* Era Sections */
.era-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.era-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    border-left: 5px solid #1b5e20;
}

.era-header:hover {
    background: #fafafa;
}

.era-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: #1b5e20;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.era-header h2 {
    flex: 1;
    font-size: 1.15rem;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}

.era-header .era-dates {
    font-size: 0.8rem;
    color: #999;
    white-space: nowrap;
}

.era-toggle {
    font-size: 1rem;
    color: #999;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.era-section.open .era-toggle {
    transform: rotate(180deg);
}

.era-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.era-section.open .era-content {
    max-height: none;
}

.era-body {
    padding: 0 1.5rem 1.5rem;
    line-height: 1.8;
    color: #444;
    text-align: justify;
}

.era-body p {
    margin-bottom: 1rem;
}

.era-body h3 {
    font-size: 1.05rem;
    color: #1a1a2e;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #f0f0f0;
}

/* Callout boxes */
.callout {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.92rem;
    line-height: 1.6;
}

.callout.info {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    color: #1565c0;
}

.callout.warning {
    background: #fff3e0;
    border-left: 4px solid #f57c00;
    color: #e65100;
}

.callout.key-fact {
    background: #f3e5f5;
    border-left: 4px solid #7b1fa2;
    color: #4a148c;
}

/* History Footer */
.history-footer {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.history-footer p {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.history-footer a {
    color: #2e7d32;
    text-decoration: none;
}

.history-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   PAGE-SPECIFIC: Economic Components
   ============================================ */

/* Stat Cards (big number) */
.stat-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 1.25rem;
    text-align: center;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-card .big-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.stat-card .big-number.positive { color: #2e7d32; }
.stat-card .big-number.negative { color: #c62828; }
.stat-card .big-number.neutral { color: #1565c0; }

.stat-card .stat-label {
    font-size: 0.82rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.stat-change.up { background: #e8f5e9; color: #2e7d32; }
.stat-change.down { background: #fce4ec; color: #c62828; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

/* Price Timeline (CSS-only) */
.price-timeline {
    position: relative;
    padding: 1rem 0;
    margin: 1.5rem 0;
}

.price-timeline::before {
    content: '';
    position: absolute;
    left: 100px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #1b5e20;
}

.price-event {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.price-event::before {
    content: '';
    position: absolute;
    left: 93px;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1b5e20;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #1b5e20;
    z-index: 1;
}

.price-date {
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1b5e20;
    padding-top: 0.3rem;
}

.price-content {
    flex: 1;
    margin-left: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #1b5e20;
}

.price-content h4 {
    font-size: 0.92rem;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.price-content p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.price-content .price-value { font-weight: 700; font-size: 0.95rem; }
.price-content .price-value.high { color: #c62828; }
.price-content .price-value.low { color: #2e7d32; }

/* Sanction Row */
.sanction-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 0.75rem;
    border-left: 4px solid #f57c00;
    transition: box-shadow 0.2s ease;
}

.sanction-row:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.sanction-year {
    font-size: 0.85rem;
    font-weight: 800;
    color: #f57c00;
    white-space: nowrap;
    min-width: 55px;
    padding-top: 0.1rem;
}

.sanction-content { flex: 1; }

.sanction-content h4 {
    font-size: 0.95rem;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.sanction-content p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.sanction-effect {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.3rem;
}

.sanction-effect.negative { background: #fce4ec; color: #c62828; }
.sanction-effect.positive { background: #e8f5e9; color: #2e7d32; }

/* Comparison Panels (side by side) */
.comparison-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.compare-panel {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 1.25rem;
    text-align: center;
}

.compare-panel.israel { border-top: 4px solid #0d47a1; }
.compare-panel.iran { border-top: 4px solid #1b5e20; }

.compare-panel h4 {
    font-size: 1rem;
    color: #1a1a2e;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.compare-panel .compare-stat { margin-bottom: 0.75rem; }
.compare-panel .compare-number { font-size: 1.5rem; font-weight: 800; display: block; }
.compare-panel.israel .compare-number { color: #0d47a1; }
.compare-panel.iran .compare-number { color: #1b5e20; }
.compare-panel .compare-label { font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }

/* Route Card */
.route-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid #1565c0;
    transition: box-shadow 0.2s ease;
}

.route-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.route-card h4 {
    font-size: 1rem;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.route-card h4 i { color: #1565c0; }

.route-card p {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.route-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.route-stat {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #e3f2fd;
    color: #0d47a1;
}

.route-stat.danger { background: #fce4ec; color: #c62828; }

/* Ripple Grid */
.ripple-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.ripple-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.ripple-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.ripple-card h4 {
    font-size: 0.95rem;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ripple-card h4 i { color: #1b5e20; }

.ripple-card p {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.88rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.comparison-table thead {
    background: #1b5e20;
    color: white;
}

.comparison-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.comparison-table tbody tr:hover {
    background: #fafafa;
}

.comparison-table tbody tr:last-child td {
    border-bottom: none;
}

/* Stats Banner */
.stats-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}

.stat-item .stat-number { font-size: 1.5rem; font-weight: 800; color: #1b5e20; display: block; }
.stat-item .stat-label { font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }

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

@media (max-width: 1200px) {
    .toc-nav { width: 220px; }
}

@media (max-width: 768px) {
    .history-header h1 { font-size: 1.6rem; }
    .history-header .subtitle { font-size: 0.95rem; }

    .history-layout { flex-direction: column; }

    .toc-nav {
        display: none;
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 260px;
        max-height: 60vh;
        z-index: 499;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    }

    .toc-nav.mobile-open { display: block; }
    .toc-mobile-toggle { display: flex; }

    .era-header { padding: 1rem; }
    .era-body { padding: 0 1rem 1rem; }

    .stat-grid { grid-template-columns: 1fr 1fr; }
    .comparison-panels { grid-template-columns: 1fr; }
    .ripple-grid { grid-template-columns: 1fr; }

    .price-timeline::before { left: 20px; }
    .price-event::before { left: 13px; }
    .price-date { display: none; }
    .price-content { margin-left: 30px; }

    .sanction-row { flex-direction: column; gap: 0.3rem; }

    .comparison-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .stats-banner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .history-header h1 { font-size: 1.3rem; }
    .history-meta { flex-direction: column; gap: 0.5rem; }
    .era-header h2 { font-size: 1rem; }
    .era-header .era-dates { display: none; }

    .stat-grid { grid-template-columns: 1fr; }
    .stats-banner { grid-template-columns: 1fr; }
}
