/* ============================================
   Weapons & Defense Systems - Dedicated Styles
   Accent: #37474f (blue-grey), #ef5350 (red)
   ============================================ */

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

/* History Header */
.history-header {
    background: linear-gradient(135deg, #263238 0%, #37474f 50%, #455a64 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: #ef5350;
    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: #ef5350;
}

/* 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(55, 71, 79, 0.08);
    color: #37474f;
    border-left-color: #37474f;
    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: #37474f;
    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 #37474f;
}

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

.era-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: #37474f;
    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: #ef5350;
    text-decoration: none;
}

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

/* ============================================
   PAGE-SPECIFIC: Weapon Cards & Components
   ============================================ */

/* Weapon Cards */
.weapon-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.weapon-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.weapon-card-header i {
    font-size: 1.5rem;
    color: #37474f;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eceff1;
    border-radius: 8px;
    flex-shrink: 0;
}

.weapon-card-header h4 {
    font-size: 1rem;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}

.weapon-card-header .weapon-origin {
    font-size: 0.75rem;
    color: #999;
    font-weight: 400;
    display: block;
}

.weapon-card-desc {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* Spec Grid */
.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.spec-row {
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #37474f;
}

.spec-row .spec-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    font-weight: 600;
}

.spec-row .spec-value {
    font-size: 0.88rem;
    color: #1a1a2e;
    font-weight: 600;
}

/* Combat Badge */
.combat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.combat-badge.proven {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.combat-badge.untested {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.combat-badge.classified {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Weapon Category Header */
.weapon-category {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eceff1;
}

.weapon-category i {
    color: #37474f;
    font-size: 1.1rem;
}

.weapon-category h3 {
    font-size: 1.05rem;
    color: #1a1a2e;
    margin: 0;
    border: none;
    padding: 0;
}

/* Weapon Grid */
.weapon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

/* 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: #37474f;
    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;
}

/* Result badges */
.result-success { color: #2e7d32; font-weight: 600; }
.result-partial { color: #f57c00; font-weight: 600; }
.result-failure { color: #c62828; font-weight: 600; }

/* Israeli / Iranian accent */
.weapon-card.israeli .weapon-card-header i { color: #1565c0; background: #e3f2fd; }
.weapon-card.israeli .spec-row { border-left-color: #1565c0; }
.weapon-card.iranian .weapon-card-header i { color: #2e7d32; background: #e8f5e9; }
.weapon-card.iranian .spec-row { border-left-color: #2e7d32; }

/* 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: #37474f;
    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; }

    .weapon-grid { grid-template-columns: 1fr; }
    .spec-grid { grid-template-columns: 1fr 1fr; }

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

    .combat-badge { position: static; margin-bottom: 0.5rem; }
    .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; }

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