﻿/* ==============================
   PÁGINA NOTA PAÍS
   ============================== */

body.np-body .rb-main {
    background: transparent;
    max-width: 100%;
    margin: 0;
    padding: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* ── PAGE WRAPPER ── */
.np-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 24px 28px 32px;
    gap: 16px;
}

/* ── INTRO ── */
.np-intro {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.np-intro-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.np-intro h2 {
    font-family: 'Sora', 'Roboto', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #101d4f;
    margin: 0;
    letter-spacing: -.02em;
}

.np-intro-lead {
    font-size: 0.875rem;
    color: #334488;
    line-height: 1.68;
    margin: 0;
}

/* Brasil section — grid card */
.np-intro-br-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: rgba(38,69,132,.04);
    border: 1px solid rgba(38,69,132,.12);
    border-radius: 12px;
    padding: 18px 20px;
}

.np-intro-br-text {
    flex: 1;
    min-width: 0;
}

.np-intro h3 {
    font-family: 'Sora', 'Roboto', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #264584;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 0 0 8px;
}

.np-intro-br-text p {
    font-size: 0.8125rem;
    color: #1a3070;
    line-height: 1.65;
    margin: 0 0 6px;
}

/* Steps 1 → 2 → 3 */
.np-intro-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(38,69,132,.12);
}

.np-intro-step {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: 0.8125rem;
    color: #1a3070;
    line-height: 1.55;
}

.np-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #264584;
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-size: 0.625rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    top: 1px;
}

/* Badge Nível 3 */
.np-intro-br-badge {
    flex-shrink: 0;
}

.np-nivel-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #264584;
    color: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: center;
    min-width: 82px;
    box-shadow: 0 6px 20px rgba(38,69,132,.25);
}

.np-nivel-num {
    font-family: 'Sora', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

.np-nivel-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    opacity: 0.85;
    line-height: 1.3;
}

.np-nivel-year {
    font-size: 0.6rem;
    opacity: 0.60;
    margin-top: 3px;
}

/* Destaque callout */
.np-intro-destaque {
    background: rgba(38,69,132,.08);
    border-left: 3px solid #264584;
    border-radius: 0 6px 6px 0;
    padding: 9px 13px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #101d4f;
    line-height: 1.6;
    margin: 0;
}

/* Closing paragraph */
.np-intro-closing {
    font-size: 0.8125rem;
    color: #334488;
    line-height: 1.65;
    margin: 0;
}

/* ── MAIN CARD (sidebar + map) ── */
.np-card {
    display: flex;
    flex: 1;
    min-height: 540px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 28px rgba(16,29,79,.12);
    overflow: hidden;
}

/* ── SIDEBAR ── */
.np-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e8f0f4;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(38,69,132,.2) transparent;
}

.np-sidebar::-webkit-scrollbar { width: 4px; }
.np-sidebar::-webkit-scrollbar-thumb {
    background: rgba(38,69,132,.2);
    border-radius: 4px;
}

.np-sidebar-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid #eef2f6;
}

.np-sidebar-title {
    font-family: 'Sora', 'Roboto', sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── FILTERS ── */
.np-filters {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.np-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.np-filter-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #334488;
    letter-spacing: .02em;
}

.np-filter-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.np-select-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

.np-select-wrap::after {
    content: "▾";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #264584;
    font-size: 0.625rem;
    pointer-events: none;
}

.np-select-wrap select {
    width: 100%;
    height: 44px;
    padding: 0 24px 0 9px;
    background: #f5f8fa;
    border: 1px solid #ccdde5;
    border-radius: 5px;
    color: #1a3070;
    font-size: 0.75rem;
    font-family: inherit;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.np-select-wrap select:focus-visible {
    outline: 2px solid #264584;
    outline-offset: 2px;
    border-color: #264584;
    background: #fff;
}

.np-search-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: var(--color-primary-dark);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.np-search-btn:hover { background: #0d3a8a; }

/* ── ACTIONS ── */
.np-actions {
    padding: 12px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #eef2f6;
    margin-top: auto;
}

.np-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition-fast), opacity var(--transition-fast);
    width: 100%;
    border: none;
}

.np-btn-primary {
    background: var(--color-primary-dark);
    color: #fff;
}

.np-btn-primary:hover { background: #0d3a8a; }

.np-btn-secondary {
    background: #e4ecf0;
    color: #101d4f;
}

.np-btn-secondary:hover { background: #d6e4ea; }

/* ── MAP CONTAINER ── */
.np-map-container {
    flex: 1;
    position: relative;
    min-width: 0;
    background: #bdd8e8;
}

#np-map {
    position: absolute;
    inset: 0;
    background: #bdd8e8;
}

/* ── KPI STRIP ── */
.np-kpi-strip {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(16,29,79,.10);
    padding: 18px 32px;
    gap: 0;
}

.np-kpi {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
}

.np-kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid #264584;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #264584;
    flex-shrink: 0;
}

.np-kpi-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.np-kpi-value {
    font-family: 'Sora', 'Roboto', sans-serif;
    font-size: 1.625rem;
    font-weight: 700;
    color: #101d4f;
    line-height: 1;
}

.np-kpi-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: #5577aa;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.np-kpi-sep {
    width: 1px;
    height: 50px;
    background: #e4ecf0;
    flex-shrink: 0;
}

/* ── FAB de filtros (visível apenas no mobile) ── */
.np-filter-fab {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #101d4f;
    border: none;
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 18px rgba(0,0,0,.32);
    transition: transform var(--transition-base), background var(--transition-base);
}
.np-filter-fab:hover  { background: #0a2d7a; transform: scale(1.08); }
.np-filter-fab:active { transform: scale(0.93); }

/* ── Botão fechar sidebar (visível apenas no mobile) ── */
.np-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #334488;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 5px;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}
.np-sidebar-close:hover { color: #101d4f; background: #eef2f6; }

/* ── Backdrop do painel mobile ── */
.np-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2099;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s;
}
.np-sidebar-backdrop.np-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── FOCUS ON MAP PATHS — usa stroke visível em vez de outline padrão ── */
#np-map path.leaflet-interactive:focus-visible,
#np-map .leaflet-interactive:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* ── LEAFLET OVERRIDES ── */
.np-map-container .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.20) !important;
    border-radius: 6px !important;
    overflow: hidden;
}

.np-map-container .leaflet-control-zoom a {
    background: rgba(16,29,79,.92) !important;
    color: #fff !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,.15) !important;
    transition: background var(--transition-fast) !important;
}

.np-map-container .leaflet-control-zoom-out {
    border-bottom: none !important;
}

.np-map-container .leaflet-control-zoom a:hover {
    background: rgba(16,29,79,1) !important;
}

.np-map-container .leaflet-control-attribution {
    font-size: 0.5625rem;
    background: rgba(255,255,255,.55);
    padding: 1px 5px;
    border-radius: 3px 0 0 0;
}

/* ── HOVER TOOLTIP ── */
.leaflet-tooltip.np-tooltip {
    background: rgba(16,29,79,.92) !important;
    border: 1px solid rgba(255,255,255,.15) !important;
    border-radius: 7px !important;
    color: #fff !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.75rem !important;
    padding: 7px 12px !important;
    box-shadow: 0 4px 18px rgba(0,0,0,.30) !important;
    white-space: nowrap;
    pointer-events: none;
}

.leaflet-tooltip.np-tooltip-brazil {
    background: rgba(255,204,60,.95) !important;
    border: 1px solid rgba(200,160,30,.5) !important;
    color: var(--color-primary-dark) !important;
}

.leaflet-tooltip.np-tooltip::before,
.leaflet-tooltip.np-tooltip-brazil::before { display: none !important; }

/* ── COUNTRY NAME LABELS ── */
.leaflet-tooltip.np-country-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.4375rem !important;
    font-weight: 700 !important;
    color: rgba(16,29,79,.90) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    padding: 0 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    text-shadow: 0 0 4px rgba(255,255,255,.95), 0 0 4px rgba(255,255,255,.95), 0 0 2px rgba(255,255,255,1) !important;
}

.leaflet-tooltip.np-country-label::before { display: none !important; }

.leaflet-tooltip.np-country-label.np-country-label--minor {
    font-size: 0.4375rem !important;
    font-weight: 600 !important;
    color: rgba(16,29,79,.80) !important;
}

/* ── OCEAN LABELS ── */
.leaflet-tooltip.np-ocean-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.6875rem !important;
    font-weight: 400 !important;
    color: rgba(44,100,160,.55) !important;
    letter-spacing: 0.10em !important;
    padding: 0 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    font-style: italic;
}

.leaflet-tooltip.np-ocean-label::before { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .np-kpi { padding: 0 12px; gap: 10px; }
    .np-kpi-value { font-size: 1.375rem; }
}

@media (max-width: 900px) {
    /* Intro some: mapa ocupa a tela inteira (Google Maps / IFEM pattern) */
    .np-intro { display: none; }
    .np-page { padding: 0; gap: 0; }
    .np-card { flex-direction: column; min-height: unset; overflow: visible; border-radius: 0; box-shadow: none;
        height: calc(100vh - 68px);
        height: calc(100svh - 68px);
        flex-shrink: 0;
    }

    /* Sidebar → bottom sheet fixo fora do fluxo */
    .np-sidebar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        width: 100%;
        max-height: 78vh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        border-right: none;
        border-bottom: none;
        z-index: 2100;
        transform: translateY(calc(100% + 4px));
        transition: transform .32s cubic-bezier(.32,0,.68,0);
        box-shadow: 0 -8px 40px rgba(0,0,0,.22);
        -webkit-overflow-scrolling: touch;
    }
    .np-sidebar::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: #cddde5;
        border-radius: 2px;
        margin: 10px auto 0;
    }
    .np-sidebar.np-open {
        transform: translateY(0);
        transition-timing-function: cubic-bezier(.22,1,.36,1);
    }

    .np-sidebar-backdrop { display: block; }
    .np-sidebar-close    { display: flex; }
    .np-filter-fab       { display: flex; }

    /* Cabeçalho da sidebar: título + botão fechar */
    .np-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
        border-bottom: 1px solid #eef2f6;
        padding: 14px 18px 12px;
    }

    /* Mapa preenche o np-card que já tem height calculado */
    .np-map-container {
        position: relative;
        height: 100%;
        flex-shrink: 0;
    }
    #np-map { position: absolute; inset: 0; width: 100%; height: 100%; }

    /* FAB sobre o mapa (dentro de np-map-container) */
    .np-filter-fab { position: absolute; bottom: 20px; left: 20px; }

    /* KPI strip — grid 2×2 de cartões */
    .np-kpi-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px;
        background: #e8f1f5;
        border-radius: 14px;
        box-shadow: 0 2px 12px rgba(16,29,79,.09);
    }
    .np-kpi {
        flex: unset;
        background: #fff;
        border-radius: 10px;
        padding: 12px 12px;
        gap: 10px;
        border: 1px solid #ddeaf0;
        box-shadow: 0 1px 4px rgba(16,29,79,.06);
        align-items: flex-start;
    }
    .np-kpi-icon {
        width: 36px;
        height: 36px;
        border-width: 1.5px;
        flex-shrink: 0;
    }
    .np-kpi-icon svg { width: 17px; height: 17px; }
    .np-kpi-value { font-size: 1.375rem; }
    .np-kpi-label { white-space: normal; font-size: 0.6875rem; line-height: 1.3; }
    .np-kpi-sep { display: none; }
}

@media (max-width: 480px) {
    .np-intro { display: none; }
    .np-page  { padding: 0; gap: 8px; }
    .np-map-container {
        height: calc(100vh - 76px);
        height: calc(100svh - 76px); /* svh: viewport height com chrome do browser visível */
        border-radius: 0;
    }
    /* FAB com margem extra do fundo para não ser cortado */
    .np-filter-fab { bottom: 24px; }
    /* Mantém 2×2 no mobile pequeno, só ajusta tamanhos */
    .np-kpi { padding: 10px 10px; gap: 8px; }
    .np-kpi-icon { width: 32px; height: 32px; }
    .np-kpi-icon svg { width: 15px; height: 15px; }
    .np-kpi-value { font-size: 1.25rem; }
    .np-kpi-label { font-size: 0.625rem; }
}
