/* ============================================================
   CrimeRadar — Data pages CSS
   (neighbourhood, force, monthly)
   ============================================================ */

/* ── Data hero ────────────────────────────────────────────── */
.cr-data-hero {
    background: linear-gradient(135deg, #0a0e1a 0%, #0f1829 60%, #0a1a2e 100%);
}

.cr-data-hero-inner {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 40px;
    align-items: center;
    padding-top: 8px;
}

.cr-data-hero-inner-single {
    grid-template-columns: 1fr;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

.cr-data-hero-inner h1 {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    margin: 8px 0 12px;
    line-height: 1.2;
}

.cr-data-hero-sub {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.cr-data-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 4px;
}

.cr-data-hero-meta span {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

.cr-force-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0,148,221,0.18);
    border: 1px solid rgba(0,148,221,0.35);
    color: #0094DD;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Safety score ring ─────────────────────────────────────── */
.cr-score-ring-wrap {
    text-align: center;
}

.cr-score-ring {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.cr-score-ring svg {
    width: 100%;
    height: 100%;
}

.cr-score-ring-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.cr-score-num {
    font-size: 2.6rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.cr-score-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

.cr-score-band {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.cr-score-caption {
    color: rgba(255,255,255,0.45);
    font-size: 0.78rem;
    margin-top: 8px;
    text-align: center;
}

/* ── Stats bar ─────────────────────────────────────────────── */
.cr-stats-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
}

.cr-stats-bar-grid {
    display: flex;
    flex-wrap: wrap;
}

.cr-stat-card {
    flex: 1;
    min-width: 140px;
    padding: 20px 24px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cr-stat-card:last-child { border-right: none; }

.cr-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark, #0a0e1a);
    line-height: 1;
}

.cr-stat-num small {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
}

.cr-stat-lbl {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.trend-up   { color: #dc2626 !important; }
.trend-down { color: #16a34a !important; }

/* ── Data cards ────────────────────────────────────────────── */
.cr-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 0;
}

.cr-data-grid-2 {
    margin-top: 24px;
}

.cr-data-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px;
}

.cr-data-card-wide {
    grid-column: 1 / -1;
}

.cr-data-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark, #0a0e1a);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cr-data-card-title i { color: var(--blue, #0094DD); }

.cr-data-card-sub {
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 20px;
}

/* ── Crime categories ──────────────────────────────────────── */
.cr-cat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cr-cat-row {
    display: grid;
    grid-template-columns: 200px 1fr 80px 50px;
    align-items: center;
    gap: 10px;
}

.cr-cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1f2937;
}

.cr-cat-label i { width: 16px; text-align: center; }

.cr-cat-bar-wrap {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.cr-cat-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.cr-cat-count {
    text-align: right;
    font-size: 0.85rem;
    color: #1f2937;
    font-weight: 600;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.cr-cat-share {
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

.cr-cat-trend {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: right;
}

/* ── Monthly trend chart ───────────────────────────────────── */
.cr-trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding: 8px 0 0;
}

.cr-trend-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.cr-trend-count {
    font-size: 0.62rem;
    color: #9ca3af;
    font-weight: 600;
    text-align: center;
    min-height: 14px;
}

.cr-trend-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.cr-trend-bar {
    width: 100%;
    background: var(--blue, #0094DD);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.cr-trend-bar:hover { opacity: 1; }

.cr-trend-mon {
    font-size: 0.6rem;
    color: #9ca3af;
    text-align: center;
    white-space: nowrap;
}

/* ── Hotspots ──────────────────────────────────────────────── */
.cr-hotspot-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cr-hotspot-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.85rem;
}

.cr-hotspot-rank {
    width: 22px;
    height: 22px;
    background: var(--blue, #0094DD);
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cr-hotspot-loc {
    flex: 1;
    color: #374151;
    font-weight: 500;
}

.cr-hotspot-count {
    color: #6b7280;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* ── Outcomes ──────────────────────────────────────────────── */
.cr-outcomes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cr-outcome-row {
    display: grid;
    grid-template-columns: 20px 1fr 36px;
    align-items: center;
    gap: 10px;
    position: relative;
    padding: 6px 0;
}

.cr-outcome-label {
    font-size: 0.83rem;
    color: #374151;
    font-weight: 500;
}

.cr-outcome-count {
    font-size: 0.83rem;
    font-weight: 700;
    color: #111827;
    text-align: right;
}

.cr-outcome-bar {
    position: absolute;
    bottom: 0;
    left: 30px;
    height: 2px;
    border-radius: 2px;
    max-width: calc(100% - 66px);
}

/* ── Month grid ────────────────────────────────────────────── */
.cr-month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.cr-month-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    gap: 4px;
}

.cr-month-card:hover {
    background: var(--blue, #0094DD);
    border-color: var(--blue, #0094DD);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,148,221,0.25);
}

.cr-month-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.cr-month-card:hover .cr-month-label,
.cr-month-card:hover .cr-month-count { color: #fff; }

.cr-month-count {
    font-size: 0.72rem;
    color: #6b7280;
}

/* ── Neighbour / force links grid ─────────────────────────── */
.cr-neighbour-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cr-neighbour-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s;
}

.cr-neighbour-link:hover {
    background: var(--blue, #0094DD);
    border-color: var(--blue, #0094DD);
    color: #fff;
}

.cr-neighbour-link-all {
    background: var(--dark, #0a0e1a);
    border-color: var(--dark, #0a0e1a);
    color: #fff;
}

.cr-neighbour-link-all:hover {
    background: #1e293b;
    border-color: #1e293b;
}

/* ── Force: neighbourhood browse grid ─────────────────────── */
.cr-nb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.cr-nb-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.cr-nb-card:hover {
    background: var(--blue, #0094DD);
    border-color: var(--blue, #0094DD);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,148,221,0.2);
}

.cr-nb-card i:first-child { color: var(--blue, #0094DD); flex-shrink: 0; }
.cr-nb-card:hover i { color: rgba(255,255,255,0.8); }

.cr-nb-card-name { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cr-nb-card-meta { font-size: 0.72rem; color: #9ca3af; font-weight: 400; }
.cr-nb-card:hover .cr-nb-card-meta { color: rgba(255,255,255,0.6); }

/* Legacy: simple span children */
.cr-nb-card > span:not(.cr-nb-card-name):not(.cr-nb-score-pill) { flex: 1; }

.cr-nb-score-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.cr-nb-card:hover .cr-nb-score-pill { opacity: 0.85; }

.cr-nb-arrow { font-size: 0.7rem; color: #9ca3af; }

/* ── Monthly page navigation ───────────────────────────────── */
.cr-month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

.cr-month-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--dark, #0a0e1a);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.cr-month-nav-btn:hover { background: #1e293b; color: #fff; }

.cr-month-nav-overview {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: rgba(0,148,221,0.1);
    color: var(--blue, #0094DD);
    border: 1px solid rgba(0,148,221,0.3);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.cr-month-nav-overview:hover {
    background: var(--blue, #0094DD);
    color: #fff;
    border-color: var(--blue, #0094DD);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .cr-data-grid { grid-template-columns: 1fr; }
    .cr-data-card-wide { grid-column: 1; }
    .cr-data-hero-inner { grid-template-columns: 1fr; }
    .cr-score-ring-wrap { order: -1; }
    .cr-score-ring { width: 140px; height: 140px; }
    .cr-score-num { font-size: 2rem; }
}

@media (max-width: 768px) {
    .cr-cat-row {
        grid-template-columns: 1fr 80px;
        grid-template-rows: auto auto;
    }
    .cr-cat-bar-wrap { grid-column: 1 / -1; }
    .cr-cat-trend { display: none; }

    .cr-stats-bar-grid { flex-direction: column; }
    .cr-stat-card { border-right: none; border-bottom: 1px solid #e5e7eb; }
    .cr-stat-card:last-child { border-bottom: none; }

    .cr-trend-chart { height: 100px; }
    .cr-trend-count { display: none; }

    .cr-month-nav { flex-direction: column; align-items: stretch; }
    .cr-month-nav-btn, .cr-month-nav-overview { text-align: center; justify-content: center; }

    .cr-data-card { padding: 20px 16px; }
    .cr-nb-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .cr-nb-grid { grid-template-columns: 1fr; }
    .cr-month-grid { grid-template-columns: 1fr 1fr; }
}
