/* stats.css — Mugshot Metrics custom styles */

/* ─── Header ──────────────────────────────────────────────────────────────── */

.stats-header {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3) 0%, rgba(26, 26, 46, 0.9) 100%);
    border: 2px solid var(--accent-color);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    text-align: center;
}

.stats-header h1 {
    font-weight: 900;
    font-size: 2.5rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.stats-header .subtitle {
    color: #ccc;
    font-size: 1rem;
}

.stats-header .last-updated {
    color: #888;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* ─── Editorial Intro ─────────────────────────────────────────────────────── */

.editorial-intro {
    background: rgba(26, 26, 46, 0.5);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 10px 10px 0;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.editorial-intro p {
    color: #bbb;
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
}

.editorial-intro strong {
    color: var(--accent-color);
}

/* ─── Table of Contents ───────────────────────────────────────────────────── */

.toc-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 30px;
    padding: 10px 12px;
    background: rgba(26, 26, 46, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 56px;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    color: #999;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.toc-link i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.toc-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.toc-link.active {
    color: #fff;
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(220, 53, 69, 0.5);
}

.toc-link.active i {
    color: var(--accent-color);
    opacity: 1;
}

/* ─── Section Dividers ────────────────────────────────────────────────────── */

section {
    scroll-margin-top: 130px;
}

.section-divider {
    margin-bottom: 24px;
    padding: 20px 24px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.08) 0%, rgba(138, 43, 226, 0.08) 100%);
    border-left: 4px solid var(--primary-color);
}

.section-heading {
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    margin: 0 0 6px;
}

.section-heading i {
    color: var(--accent-color);
    margin-right: 10px;
    font-size: 1.3rem;
}

.section-desc {
    color: #999;
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
}

/* ─── Forecast Card ───────────────────────────────────────────────────────── */

.forecast-card {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.12) 0%, rgba(138, 43, 226, 0.12) 50%, rgba(26, 26, 46, 0.9) 100%);
    border: 2px solid rgba(220, 53, 69, 0.4);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.forecast-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(220, 53, 69, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.forecast-inner {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 20px;
}

.forecast-left {
    flex: 0 0 auto;
    text-align: center;
    min-width: 160px;
}

.forecast-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-color);
    margin-bottom: 2px;
}

.forecast-date {
    font-size: 0.82rem;
    color: #bbb;
    font-weight: 600;
    margin-bottom: 6px;
}

.forecast-number {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 30px rgba(220, 53, 69, 0.4);
}

.forecast-sublabel {
    font-size: 0.82rem;
    color: #999;
    margin-top: 4px;
}

.forecast-right {
    flex: 1;
    min-width: 0;
}

.forecast-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.forecast-factor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #ccc;
}

.forecast-factor i {
    color: var(--accent-color);
    font-size: 0.7rem;
}

.forecast-factor .factor-value {
    font-weight: 700;
    color: #fff;
}

.forecast-methodology {
    font-size: 0.72rem;
    color: #777;
    line-height: 1.4;
}

/* Forecast bar */
.forecast-bar-wrap {
    position: relative;
}

.forecast-bar-track {
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    position: relative;
    overflow: visible;
}

.forecast-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    width: 100%;
    opacity: 0.6;
}

.forecast-bar-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background: #fff;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
    z-index: 2;
    animation: forecast-pulse 2s ease-in-out infinite;
}

@keyframes forecast-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.8), 0 0 40px rgba(220, 53, 69, 0.3);
        transform: translate(-50%, -50%) scale(1.25);
    }
}

.forecast-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.68rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .forecast-inner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .forecast-left {
        min-width: unset;
    }

    .forecast-number {
        font-size: 3rem;
    }

    .forecast-factors {
        justify-content: center;
    }

    .forecast-card {
        padding: 20px;
    }
}

/* ─── Hero Counter Cards ─────────────────────────────────────────────────── */

.hero-card {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2) 0%, rgba(26, 26, 46, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(220, 53, 69, 0.3);
}

.hero-card .big-number {
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.hero-card .label {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

.hero-card canvas.sparkline {
    width: 100% !important;
    height: 40px !important;
    margin-top: 10px;
}

/* ─── Section Titles (inside chart containers) ────────────────────────────── */

.section-title {
    color: var(--accent-color);
    font-weight: 800;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 193, 7, 0.2);
}

.section-title i {
    margin-right: 8px;
}

/* ─── Chart Containers ────────────────────────────────────────────────────── */

.chart-container {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.chart-container canvas {
    max-height: 300px;
}

/* ─── Arrest Heatmap ──────────────────────────────────────────────────────── */

.heatmap-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.heatmap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    min-width: 600px;
}

.heatmap-table th {
    color: #aaa;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    padding: 4px 2px;
}

.heatmap-table td.heatmap-cell {
    border-radius: 4px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    cursor: default;
    transition: transform 0.2s;
    position: relative;
    padding: 6px 2px;
}

.heatmap-table td.heatmap-cell:hover {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.heatmap-table td.day-label,
.heatmap-table th:first-child {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 700;
    padding-right: 6px;
    text-align: right;
    white-space: nowrap;
}

/* ─── Fun-Fact Cards ──────────────────────────────────────────────────────── */

.fun-fact-card {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(26, 26, 46, 0.8) 100%);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    padding: 30px 25px;
    text-align: center;
    margin-bottom: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fun-fact-card .emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.fun-fact-card .stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-color);
}

.fun-fact-card .stat-label {
    color: #ccc;
    font-size: 0.9rem;
    margin-top: 5px;
}

.fun-fact-card .stat-detail {
    color: #888;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* ─── Name Badges ─────────────────────────────────────────────────────────── */

.name-badge {
    display: inline-block;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 20px;
    padding: 6px 14px;
    margin: 4px;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.name-badge:hover {
    transform: scale(1.05);
}

.name-badge .count {
    color: var(--accent-color);
    margin-left: 4px;
    font-size: 0.75rem;
}

/* ─── Profile Cards ───────────────────────────────────────────────────────── */

.profile-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(40, 40, 70, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.profile-card:hover {
    transform: translateY(-3px);
}

.profile-card .profile-icon {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.profile-card .profile-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.profile-card .profile-stat {
    margin-bottom: 8px;
}

.profile-card .profile-stat .val {
    font-weight: 800;
    color: #fff;
    font-size: 1.1rem;
}

.profile-card .profile-stat .lbl {
    color: #aaa;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.profile-card .top-charges-list {
    text-align: left;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-card .top-charges-list li {
    color: #ccc;
    font-size: 0.8rem;
    padding: 2px 0;
}

/* ─── Repeat Offender Tiers ──────────────────────────────────────────────── */

.repeat-tier {
    margin-bottom: 10px;
}

.repeat-tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.repeat-tier-label {
    color: #ccc;
    font-size: 0.85rem;
    font-weight: 600;
}

.repeat-tier-count {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.repeat-tier-pct {
    color: var(--accent-color);
    font-size: 0.78rem;
}

.repeat-tier-bar-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.repeat-tier-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545, #8a2be2);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ─── Bond Table ─────────────────────────────────────────────────────────── */

.bond-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.bond-table thead th {
    color: var(--accent-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.bond-table tbody td {
    color: #ddd;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bond-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.bond-table thead th:not(:first-child),
.bond-table tbody td:not(:first-child) {
    text-align: right;
}

/* ─── Holiday Effect Bars ────────────────────────────────────────────────── */

.holiday-row {
    display: grid;
    grid-template-columns: 180px 1fr 80px 130px;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.holiday-row:last-child {
    border-bottom: none;
}

.holiday-name {
    color: #ddd;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
}

.holiday-bar-area {
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    overflow: hidden;
}

.holiday-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.holiday-pct {
    font-size: 0.85rem;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.holiday-pct.up {
    color: #dc3545;
}

.holiday-pct.down {
    color: #2ecc71;
}

.holiday-detail {
    color: #888;
    font-size: 0.75rem;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .holiday-row {
        grid-template-columns: 1fr 1fr;
        gap: 4px 8px;
    }

    .holiday-bar-area {
        display: none;
    }

    .holiday-name {
        font-size: 0.82rem;
    }
}

/* ─── Loading / Error States ──────────────────────────────────────────────── */

#stats-loading {
    text-align: center;
    padding: 80px 20px;
}

#stats-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

#stats-error {
    display: none;
}

#stats-content {
    display: none;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 991px) {
    .toc-nav {
        gap: 4px;
        padding: 8px 10px;
    }

    .toc-link {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .toc-link span {
        display: none;
    }

    .toc-link i {
        font-size: 1rem;
        opacity: 1;
    }

    .section-heading {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .stats-header h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }

    .hero-card .big-number {
        font-size: 2rem;
    }

    .heatmap-table td.heatmap-cell {
        font-size: 0;
        padding: 8px 0;
    }

    .profile-card {
        margin-bottom: 15px;
    }

    .editorial-intro {
        padding: 16px 18px;
    }

    .editorial-intro p {
        font-size: 0.88rem;
    }

    .section-divider {
        padding: 16px 18px 12px;
    }
}

@media (max-width: 576px) {
    .stats-header {
        padding: 20px 15px;
    }

    .stats-header h1 {
        font-size: 1.5rem;
    }

    .hero-card {
        padding: 15px;
        margin-bottom: 10px;
    }

    .hero-card .big-number {
        font-size: 1.8rem;
    }

    .toc-nav {
        top: 50px;
        justify-content: center;
    }

    .toc-link {
        padding: 6px 8px;
    }
}
