/* ════════════════════════════════════════════════
   MapBiomas Network Map — mbmap.css v2.2
   ════════════════════════════════════════════════ */

.mbmap-section {
    font-family: inherit;
    font-size: 14px;
    position: relative;
}

/* ── Topbar ─────────────────────────────────────── */
.mbmap-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background: transparent;
}

.mbmap-legend-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    color: #555;
    font-size: 0.82rem;
}

.mbmap-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.mbmap-hint {
    font-style: italic;
    color: #4CAF7B;
    margin-left: 6px;
}

/* ── Dropdown Países ────────────────────────────── */
.mbmap-dropdown { position: relative; }

.mbmap-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #D0D8E4;
    border-radius: 20px;
    background: #fff;
    font-size: 0.82rem;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
}

.mbmap-dropdown-btn:hover { background: #F5F7FA; }

.mbmap-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1100;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
}

.mbmap-dropdown-menu li button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 0.82rem;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.mbmap-dropdown-menu li button:hover { background: #F0F4F8; }
.mbmap-dropdown-menu li button img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ── Wrapper e mapa ─────────────────────────────── */
.mbmap-wrapper {
    position: relative;
    overflow-x: hidden;
}

#mbmap-map {
    width: 100%;
    height: 560px;
    background: #EEF2F7;
    transition: height 0.3s ease;
}

.leaflet-container {
    background: radial-gradient(ellipse at center, #F8FAFB 0%, #E8EEF5 100%) !important;
    font-family: inherit;
}

/* Gradiente sutil nas bordas do mapa (profundidade) */
.mbmap-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(220, 228, 238, 0.45) 100%);
    pointer-events: none;
    z-index: 400;
}

.leaflet-control-attribution { font-size: 10px; opacity: 0.6; }

/* ── Painel lateral ─────────────────────────────── */
.mbmap-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 320px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.14);
    z-index: 500;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #D0D8E4 transparent;
    transform: translateX(calc(100% + 32px));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.mbmap-panel::-webkit-scrollbar {
    width: 4px;
}
.mbmap-panel::-webkit-scrollbar-track {
    background: transparent;
}
.mbmap-panel::-webkit-scrollbar-thumb {
    background: #D0D8E4;
    border-radius: 4px;
}

.mbmap-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.mbmap-panel-inner {
    padding: 24px;
    position: relative;
}

.mbmap-panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #F0F4F8;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.15s;
}

.mbmap-panel-close:hover { background: #E0E8F0; }

/* ── Cabeçalho do painel ────────────────────────── */
.mbmap-panel-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-right: 36px;
}

/* Bandeira circular */
.mbmap-panel-flag-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

.mbmap-panel-flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mbmap-panel-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1A2E22;
    margin: 0;
    line-height: 1.2;
}

.mbmap-panel-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 11px;
    border-radius: 999px;
    color: #fff;
    white-space: nowrap;
}

.mbmap-badge-active       { background: #4CAF7B; }
.mbmap-badge-implementing { background: #F4874B; }

/* ── Corpo do painel ────────────────────────────── */
.mbmap-panel-desc {
    font-size: 0.875rem;
    color: #4A5568;
    line-height: 1.65;
    margin: 0 0 18px;
}

.mbmap-panel-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #9AA5B4;
    margin: 0 0 10px;
}

/* ── Chips de iniciativas ───────────────────────── */
.mbmap-init-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.mbmap-init-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1;
    /* color, background e border-color definidos inline no JS */
}

.mbmap-init-icon {
    font-size: 0.9em;
    line-height: 1;
}

/* ── Instituições ───────────────────────────────── */
.mbmap-institutions-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    margin-bottom: 20px;
}

.mbmap-institution-item {
    font-size: 0.82rem;
    color: #4A5568;
    padding: 2px 0;
}

.mbmap-institution-item:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 11px;
    background: #CBD5E0;
    margin: 0 10px;
    vertical-align: middle;
}

/* ── Botões ─────────────────────────────────────── */
.mbmap-panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.mbmap-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.mbmap-btn:hover { opacity: 0.82; }

.mbmap-btn-primary {
    background: #4CAF7B;
    color: #fff !important;
}

.mbmap-btn-secondary {
    background: #fff;
    color: #1A2E22 !important;
    border: 1px solid #D0D8E4;
}

/* ── Responsivo — Mobile ────────────────────────── */
@media (max-width: 767px) {
    #mbmap-map {
        height: 560px;
    }

    .mbmap-wrapper {
        display: block;
    }

    .mbmap-topbar {
        padding: 10px 14px;
        gap: 6px;
    }

    .mbmap-hint {
        display: none;
    }

    .mbmap-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 160px;
        max-width: calc(100vw - 24px);
        max-height: 220px;
    }

    /* Card sobrepõe o mapa pela direita, deixando ~32% do mapa visível */
    .mbmap-panel {
        position: absolute;
        top: 12px;
        right: 12px;
        bottom: auto;
        left: auto;
        width: 68%;
        height: auto;
        max-height: calc(100% - 24px);
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
        transform: translateX(calc(100% + 16px));
        transition: transform 0.3s ease;
        pointer-events: none;
    }

    .mbmap-panel.is-open {
        transform: translateX(0);
        pointer-events: auto;
    }

    .mbmap-panel-inner {
        padding: 14px 14px 20px;
        background: transparent;
        box-shadow: none;
    }

    .mbmap-panel-inner::before {
        display: none;
    }

    .mbmap-panel-name {
        font-size: 1rem;
    }

    .mbmap-panel-desc {
        font-size: 0.8rem;
    }

    .mbmap-panel-actions {
        flex-direction: column;
    }
}

/* ── Remove outline de foco nos países ─────────── */
.leaflet-interactive:focus {
    outline: none;
}

/* ── Tooltip Leaflet ────────────────────────────── */
.leaflet-tooltip.mbmap-tooltip {
    background: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    padding: 6px 11px;
    font-size: 0.8rem;
    color: #1A2E22;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    pointer-events: none;
}

.leaflet-tooltip.mbmap-tooltip::before { display: none; }

.leaflet-tooltip.mbmap-tooltip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
