/*
 * public-dashboard.css
 * Public-facing EMIS statistics page — all styles scoped to .pub-* prefix.
 * Brand colours are overridden per-country via CSS custom properties injected
 * by the view's <style> block (same pattern as login-page.css).
 */

/* ═══════════════════════════════════════════════════════════════════════
   FONT DECLARATIONS  (Fraunces + Outfit, local WOFF2)
═══════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/fraunces-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/fraunces-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ═══════════════════════════════════════════════════════════════════════
   DESIGN TOKENS  (overrideable per-country in the view <style> block)
═══════════════════════════════════════════════════════════════════════ */

:root {
    --pub-primary:       #0b2e4f;
    --pub-primary-2:     #103e69;
    --pub-ocean:         #1565a0;
    --pub-ocean-light:   #2b86c5;
    --pub-teal:          #0e8f8f;
    --pub-sky:           #e8f1f8;
    --pub-sky-2:         #f4f8fb;
    --pub-ink:           #16242f;
    --pub-slate:         #5a6b78;
    --pub-line:          #dce6ee;
    --pub-white:         #fff;
    --pub-good:          #1e8e5a;
    --pub-warn:          #c47a12;
    --pub-amber:         #e3b341;
    --pub-shadow:        0 1px 2px rgba(11,46,79,.06), 0 8px 24px rgba(11,46,79,.08);
    --pub-shadow-hover:  0 4px 16px rgba(11,46,79,.14), 0 16px 40px rgba(11,46,79,.12);
    --pub-radius:        14px;
    --pub-radius-sm:     10px;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESET / BASE
═══════════════════════════════════════════════════════════════════════ */

.pub-root *, .pub-root *::before, .pub-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pub-root {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color: var(--pub-ink);
    background: var(--pub-sky-2);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════
   TOP NAVIGATION BAR
═══════════════════════════════════════════════════════════════════════ */

.pub-topbar {
    background: var(--pub-white);
    border-bottom: 1px solid var(--pub-line);
    position: sticky;
    top: 0;
    z-index: 100;
}

.pub-topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
}

.pub-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.pub-emblem {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(11,46,79,.18);
}

.pub-emblem img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.pub-wordmark {
    line-height: 1.2;
}

.pub-wordmark b {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--pub-primary);
    display: block;
}

.pub-wordmark span {
    font-size: 11.5px;
    color: var(--pub-slate);
    letter-spacing: .02em;
}

.pub-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    font-weight: 500;
}

.pub-nav a {
    text-decoration: none;
    color: var(--pub-slate);
    transition: color .15s;
}

.pub-nav a:hover {
    color: var(--pub-primary);
}

.pub-nav a.pub-nav-cta {
    background: var(--pub-primary);
    color: var(--pub-white);
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 600;
    transition: background .15s, transform .15s, box-shadow .15s;
    white-space: nowrap;
}

.pub-nav a.pub-nav-cta:hover {
    background: var(--pub-ocean);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(21,101,160,.28);
}

/* ═══════════════════════════════════════════════════════════════════════
   HERO SECTION
═══════════════════════════════════════════════════════════════════════ */

.pub-hero {
    background:
        radial-gradient(120% 100% at 90% 0%, rgba(43,134,197,.20), transparent 55%),
        radial-gradient(90% 90% at 0% 100%, rgba(14,143,143,.16), transparent 55%),
        linear-gradient(180deg, var(--pub-white), var(--pub-sky-2));
    border-bottom: 1px solid var(--pub-line);
}

.pub-hero-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 52px 28px 40px;
}

.pub-eyebrow {
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--pub-ocean);
    font-weight: 600;
}

.pub-hero-title {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 40px;
    line-height: 1.08;
    letter-spacing: -.01em;
    margin-top: 12px;
    max-width: 20ch;
    color: var(--pub-primary);
}

.pub-hero-lead {
    color: var(--pub-slate);
    font-size: 15.5px;
    margin-top: 14px;
    max-width: 62ch;
    line-height: 1.65;
}

.pub-data-pill {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pub-primary);
    background: var(--pub-white);
    border: 1px solid var(--pub-line);
    border-radius: 999px;
    padding: 8px 16px;
    box-shadow: var(--pub-shadow);
}

.pub-data-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pub-good);
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════════════
   MAIN CONTENT WRAPPER
═══════════════════════════════════════════════════════════════════════ */

.pub-content {
    max-width: 1240px;
    margin: 0 auto;
    padding: 36px 28px 64px;
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION HEADERS
═══════════════════════════════════════════════════════════════════════ */

.pub-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 18px;
}

.pub-section-header h2 {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--pub-primary);
}

.pub-section-header span {
    font-size: 12.5px;
    color: var(--pub-slate);
}

.pub-section-header--explore {
    margin-top: 40px;
}

/* ═══════════════════════════════════════════════════════════════════════
   KPI TILES
═══════════════════════════════════════════════════════════════════════ */

.pub-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.pub-kpi {
    background: var(--pub-white);
    border: 1px solid var(--pub-line);
    border-radius: var(--pub-radius);
    padding: 22px 20px;
    box-shadow: var(--pub-shadow);
    position: relative;
    overflow: hidden;
}

.pub-kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.pub-kpi--a::before { background: var(--pub-ocean); }
.pub-kpi--b::before { background: var(--pub-teal); }
.pub-kpi--c::before { background: var(--pub-amber); }
.pub-kpi--d::before { background: var(--pub-good); }

.pub-kpi-label {
    font-size: 13px;
    color: var(--pub-slate);
    font-weight: 500;
}

.pub-kpi-num {
    font-family: 'Fraunces', serif;
    font-size: 36px;
    font-weight: 600;
    margin-top: 6px;
    letter-spacing: -.01em;
    color: var(--pub-primary);
    line-height: 1;
}

.pub-kpi-sub {
    font-size: 12.5px;
    color: var(--pub-slate);
    margin-top: 8px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════
   TWO-COLUMN GRID (chart + breakdown)
═══════════════════════════════════════════════════════════════════════ */

.pub-two-col {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 22px;
    margin-top: 32px;
    align-items: start;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════ */

.pub-card {
    background: var(--pub-white);
    border: 1px solid var(--pub-line);
    border-radius: var(--pub-radius);
    box-shadow: var(--pub-shadow);
}

.pub-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pub-line);
}

.pub-card-head h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--pub-primary);
}

.pub-card-head a {
    font-size: 12.5px;
    color: var(--pub-ocean);
    font-weight: 600;
    text-decoration: none;
}

.pub-card-head a:hover {
    text-decoration: underline;
}

.pub-card-body {
    padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════
   BAR CHART  (pure CSS, no JS)
═══════════════════════════════════════════════════════════════════════ */

.pub-chart {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    height: 200px;
    padding-top: 10px;
}

.pub-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.pub-bars {
    display: flex;
    gap: 5px;
    align-items: flex-end;
    height: 100%;
    justify-content: center;
}

.pub-bar {
    width: 16px;
    border-radius: 5px 5px 0 0;
}

.pub-bar--male {
    background: linear-gradient(180deg, var(--pub-ocean-light), var(--pub-ocean));
}

.pub-bar--female {
    background: linear-gradient(180deg, #3fb6b6, var(--pub-teal));
}

.pub-bar-label {
    font-size: 12px;
    color: var(--pub-slate);
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.pub-legend {
    display: flex;
    gap: 18px;
    font-size: 12.5px;
    color: var(--pub-slate);
    margin-top: 16px;
    flex-wrap: wrap;
}

.pub-legend-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: -1px;
}

.pub-legend-dot--male   { background: var(--pub-ocean); }
.pub-legend-dot--female { background: var(--pub-teal); }

/* ═══════════════════════════════════════════════════════════════════════
   LEVEL BREAKDOWN  (progress bars)
═══════════════════════════════════════════════════════════════════════ */

.pub-levels {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pub-level-row b {
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: var(--pub-ink);
}

.pub-level-row b span {
    color: var(--pub-slate);
    font-weight: 500;
}

.pub-track {
    height: 9px;
    border-radius: 999px;
    background: var(--pub-sky);
    overflow: hidden;
}

.pub-track-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.pub-level-note {
    font-size: 12px;
    color: var(--pub-slate);
    margin-top: 18px;
    line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════════
   DOWNLOAD / EXPLORE TILES
═══════════════════════════════════════════════════════════════════════ */

.pub-dl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* 2-tile variant: balances the row when only 2 tiles are active */
.pub-dl-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.pub-dl-tile {
    background: var(--pub-white);
    border: 1px solid var(--pub-line);
    border-radius: var(--pub-radius);
    padding: 22px 20px;
    box-shadow: var(--pub-shadow);
    text-decoration: none;
    color: var(--pub-ink);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .18s, box-shadow .18s, border-color .18s;
    position: relative;
    overflow: hidden;
}

.pub-dl-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.pub-dl-tile--a::before { background: var(--pub-ocean); }
.pub-dl-tile--b::before { background: var(--pub-teal); }
.pub-dl-tile--c::before { background: var(--pub-amber); }
.pub-dl-tile--d::before { background: var(--pub-good); }

.pub-dl-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--pub-shadow-hover);
    border-color: var(--pub-ocean);
    text-decoration: none;
    color: var(--pub-ink);
}

.pub-dl-tile-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 4px;
}

.pub-dl-tile-label {
    font-size: 12px;
    color: var(--pub-slate);
    font-weight: 500;
}

.pub-dl-tile-title {
    font-family: 'Fraunces', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--pub-primary);
    line-height: 1.15;
}

.pub-dl-tile-sub {
    font-size: 12.5px;
    color: var(--pub-slate);
    line-height: 1.5;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════════════ */

.pub-foot {
    background: var(--pub-primary);
    color: #bcd2e6;
    margin-top: 16px;
}

.pub-foot-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 28px;
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    align-items: center;
}

.pub-foot-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pub-foot-emblem {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    opacity: .88;
}

.pub-foot-emblem img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pub-foot-org b {
    color: #fff;
    display: block;
    font-size: 14.5px;
    font-weight: 600;
}

.pub-foot-note {
    font-size: 12.5px;
    line-height: 1.6;
    max-width: 50ch;
    margin-top: 4px;
}

.pub-foot-powered {
    margin-left: auto;
    font-size: 12px;
    color: #9fbdd6;
    text-align: right;
    line-height: 1.6;
}

.pub-foot-powered b {
    color: #fff;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 1080px) {
    .pub-kpi-grid,
    .pub-dl-grid { grid-template-columns: 1fr 1fr; }
    .pub-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
    .pub-nav a:not(.pub-nav-cta) { display: none; }
    .pub-hero-title { font-size: 32px; }
}

@media (max-width: 560px) {
    .pub-kpi-grid,
    .pub-dl-grid { grid-template-columns: 1fr; }
    .pub-topbar-inner,
    .pub-hero-inner,
    .pub-note-wrap,
    .pub-content { padding-left: 16px; padding-right: 16px; }
    .pub-hero-title { font-size: 28px; }
    .pub-foot-inner { flex-direction: column; align-items: flex-start; }
    .pub-foot-powered { margin-left: 0; text-align: left; }
}

/* ═══════════════════════════════════════════════════════════════════════
   SCHOOL MAP  (/schools)
═══════════════════════════════════════════════════════════════════════ */

.pub-map-wrap {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 24px 48px;
}

.pub-map-heading { margin-bottom: 12px; }

.pub-map-heading h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pub-primary);
    margin: 0 0 4px;
}

.pub-map-heading p {
    margin: 0;
    color: #5a6272;
    font-size: 0.9rem;
}

#school-map {
    height: 650px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid #dde3ed;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.leaflet-popup-content { margin: 12px 14px; line-height: 1.5; }

.leaflet-popup-tip {
    background: #ffffff;
    border-radius: 3px;
}

.school-popup-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--pub-primary);
    margin-bottom: 4px;
}

.school-popup-detail {
    font-size: 0.82rem;
    color: #444;
    margin: 2px 0;
}

.school-popup-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--pub-primary);
    font-weight: 600;
    text-decoration: none;
}

.school-popup-link:hover { text-decoration: underline; }

/* Marker icon */
.school-marker-fa {
    background: none;
    border: none;
    width: auto !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════
   SCHOOL PROFILE  (/schools/{id})
═══════════════════════════════════════════════════════════════════════ */

.pub-profile-wrap {
    max-width: 820px;
    margin: 36px auto 60px;
    padding: 0 24px;
}

.pub-profile-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.87rem;
    color: var(--pub-primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
}

.pub-profile-back:hover { text-decoration: underline; }

.pub-profile-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #dde3ed;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    overflow: hidden;
}

.pub-profile-header {
    background: var(--pub-primary);
    color: #fff;
    padding: 24px 28px;
}

.pub-profile-header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.pub-profile-header .pub-profile-code {
    font-size: 0.85rem;
    opacity: 0.75;
}

.pub-profile-body { padding: 28px; }

.pub-profile-section { margin-bottom: 28px; }

.pub-profile-section:last-child { margin-bottom: 0; }

.pub-profile-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--pub-amber);
    margin-bottom: 14px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f2f5;
}

.pub-profile-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.pub-profile-row:last-child { margin-bottom: 0; }

.pub-profile-label {
    min-width: 170px;
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
}

.pub-profile-value {
    color: #111827;
    word-break: break-word;
}

.pub-profile-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pub-badge-yes  { background: #d1fae5; color: #065f46; }
.pub-badge-no   { background: #fee2e2; color: #991b1b; }

.pub-link       { color: var(--pub-primary); text-decoration: none; }
.pub-link:hover { text-decoration: underline; }

@media (max-width: 560px) {
    .pub-profile-row { flex-direction: column; gap: 2px; }
    .pub-profile-label { min-width: unset; }
    #school-map { height: 420px; }
}
