/* ===== SVG drill-down picker (Atreia → faction → location) ===== */
.map-select-page {
    padding: 24px 16px 32px 16px;
    color: #e6f0ff;
    text-align: center;
}
.map-select-title {
    margin: 0 0 4px 0;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.map-select-hint {
    color: rgba(230, 240, 255, 0.7);
    margin: 0 0 18px 0;
}
.map-breadcrumbs {
    color: rgba(230, 240, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.map-breadcrumbs a {
    color: #7bb7ff;
    text-decoration: none;
}
.map-breadcrumbs a:hover { color: #fff; text-decoration: underline; }
.map-breadcrumb-sep {
    margin: 0 6px;
    color: rgba(230, 240, 255, 0.4);
}
.map-select-stage {
    display: block;
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
}
.map-select-svg {
    display: block;
    width: 100%;
    height: auto;
}

.map-select-overlay {
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    pointer-events: none;
}
.map-select-overlay.is-active { opacity: 1; }

.map-select-decor {
    opacity: 0.25;
    transition: opacity 0.15s ease-in-out;
    pointer-events: none;
}
.map-select-decor.is-active { opacity: 1; }

.map-select-link { cursor: pointer; }
.map-select-link--disabled { cursor: not-allowed; }

.map-select-hit {
    fill: transparent;
    stroke: transparent;
}

.map-select-label {
    fill: #f4f7ad;
    font-size: 20px;
    font-weight: 700;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.85);
    stroke-width: 4px;
    stroke-linejoin: round;
}
.map-select-label--disabled {
    fill: rgba(244, 247, 173, 0.45);
}

/* ===== World picker ===== */
.map-index { padding: 24px; max-width: 1200px; margin: 0 auto; color: #e6f0ff; }
.map-index h1 { margin: 0 0 8px 0; color: #fff; font-weight: 600; letter-spacing: 0.5px; }
.map-pick-hint { color: rgba(230, 240, 255, 0.7); margin: 0 0 24px 0; }
.faction-heading {
    margin: 28px 0 12px 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.map-world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.map-world-card {
    display: block;
    background: rgba(13, 38, 70, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    color: #e6f0ff;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    backdrop-filter: blur(6px);
}
.map-world-card:hover {
    border-color: rgba(120, 180, 255, 0.55);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.map-world-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #0a1f35;
}
.map-world-name {
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ===== Map page layout ===== */
.map-page {
    display: flex;
    height: calc(100vh - 180px);
    min-height: 600px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    background: #0a1f35;
}

/* ===== Sidebar ===== */
.map-sidebar {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 18px 16px;
    background: linear-gradient(180deg, rgba(13, 38, 70, 0.98) 0%, rgba(8, 26, 48, 0.98) 100%);
    color: #e6f0ff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.map-sidebar::-webkit-scrollbar { width: 8px; }
.map-sidebar::-webkit-scrollbar-track { background: transparent; }
.map-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.map-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

.map-sidebar-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.map-back-link {
    display: inline-block;
    color: rgba(180, 210, 255, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 6px;
    transition: color 0.15s ease;
}
.map-back-link:hover { color: #fff; }
.map-world-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}
.map-sidebar-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: rgba(230, 240, 255, 0.55);
    letter-spacing: 0.3px;
}

/* ===== Filter sections ===== */
.map-filter-section { margin-bottom: 16px; }
.map-filter-standalone {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.map-filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px 10px 4px;
}
.map-filter-header h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(230, 240, 255, 0.65);
    flex: 1;
}
.map-filter-total {
    font-size: 0.78rem;
    color: rgba(230, 240, 255, 0.5);
    font-variant-numeric: tabular-nums;
}
.map-toggle-all {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(230, 240, 255, 0.7);
    font-size: 0.7rem;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 999px;
    letter-spacing: 0.3px;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.map-toggle-all:hover {
    color: #fff;
    border-color: rgba(180, 210, 255, 0.6);
    background: rgba(180, 210, 255, 0.08);
}

.map-filter-list { list-style: none; padding: 0; margin: 0; }
.map-filter-list li { margin: 0; }

.map-filter-list label,
.map-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.12s ease;
}
.map-filter-list label:hover,
.map-filter-row:hover { background: rgba(255, 255, 255, 0.05); }

.map-filter input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.map-filter input[type="checkbox"]:hover { border-color: rgba(180, 210, 255, 0.7); }
.map-filter input[type="checkbox"]:checked {
    background: #4a9eff;
    border-color: #4a9eff;
}
.map-filter input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.map-filter-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}
.map-filter-label {
    flex: 1;
    color: #e6f0ff;
    line-height: 1.3;
}
.map-filter-count {
    color: rgba(230, 240, 255, 0.5);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

/* ===== Leaflet canvas ===== */
.map-canvas { flex: 1; background: #0a1f35 !important; }
.map-canvas .leaflet-container,
.leaflet-container { background: #0a1f35 !important; }
.leaflet-tile-pane { background: #0a1f35; }

/* Leaflet's top/bottom control containers default to z-index 1000 — same as
   the nav dropdown — so in DOM order Leaflet wins and the +/- buttons cover
   the menus. Push them below the nav (which sits at 1000/10001 across its
   `.dropdown` and `.submenu` levels). */
.leaflet-top, .leaflet-bottom { z-index: 500 !important; }

.leaflet-control-zoom a {
    background-color: rgba(13, 38, 70, 0.9) !important;
    color: #e6f0ff !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
.leaflet-control-zoom a:hover {
    background-color: rgba(30, 60, 100, 0.95) !important;
    color: #fff !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(13, 38, 70, 0.98);
    color: #e6f0ff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(180, 210, 255, 0.2);
}
.leaflet-popup-content { margin: 10px 14px; font-size: 0.9rem; line-height: 1.4; }
.leaflet-popup-content b { color: #fff; }
.leaflet-popup-content a {
    color: #7bb7ff;
    text-decoration: none;
}
.leaflet-popup-content a:hover { color: #fff; text-decoration: underline; }
.leaflet-popup-tip { background: rgba(13, 38, 70, 0.98); }
.leaflet-popup-close-button { color: rgba(230, 240, 255, 0.6) !important; }
.leaflet-popup-close-button:hover { color: #fff !important; }

/* ===== NPC detail card (compact layout with badges + stats grid) ===== */
.npc-card { color: #e6f0ff; }
.npc-header { padding: 18px 20px 14px 20px; }
.npc-name {
    margin: 0;
    line-height: 1.15;
    word-break: break-word;
}
.npc-subtitle {
    margin-top: 2px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: rgba(230, 240, 255, 0.7);
    font-style: italic;
}

.npc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.npc-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #d8e6ff;
}
.npc-badge--race[data-key="elyos"]    { background: rgba(255, 200, 60, 0.18); border-color: rgba(255, 200, 60, 0.5);  color: #ffe18a; }
.npc-badge--race[data-key="asmodian"] { background: rgba(220, 80, 100, 0.22); border-color: rgba(220, 80, 100, 0.55); color: #ffb1c0; }
.npc-badge--race[data-key="balaur"]   { background: rgba(160, 80, 220, 0.2);  border-color: rgba(180, 110, 240, 0.5); color: #d4b4ff; }
.npc-badge--race[data-key="undead"]   { background: rgba(120, 200, 140, 0.18); border-color: rgba(120, 200, 140, 0.45); color: #b8e8c4; }
.npc-badge--race[data-key="construct"]{ background: rgba(150, 170, 190, 0.18); border-color: rgba(180, 200, 220, 0.4); color: #cfd8e6; }
.npc-badge--race[data-key="beast"]    { background: rgba(180, 130, 80, 0.2);  border-color: rgba(200, 150, 100, 0.5); color: #f0c79a; }
.npc-badge--race[data-key="elemental"]{ background: rgba(80, 200, 220, 0.18); border-color: rgba(110, 220, 240, 0.45); color: #aae8f0; }
.npc-badge--rank[data-key="elite"]     { background: rgba(80, 180, 255, 0.18); border-color: rgba(120, 200, 255, 0.5);  color: #b8defe; }
.npc-badge--rank[data-key="heroic"]    { background: rgba(255, 130, 80, 0.22); border-color: rgba(255, 160, 100, 0.55); color: #ffc8a8; }
.npc-badge--rank[data-key="legendary"] { background: rgba(255, 90, 200, 0.22); border-color: rgba(255, 130, 220, 0.55); color: #ffc0e8; }

.npc-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.npc-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    background: rgba(8, 26, 48, 0.55);
}
.npc-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(230, 240, 255, 0.55);
}
.npc-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.npc-stat-suffix {
    font-size: 0.8rem;
    font-weight: 400;
    color: rgba(230, 240, 255, 0.55);
    margin-left: 4px;
}

/* Combined compact drop list (replaces the old two-section items + common
   drops view). Long lists hide everything past the threshold until the user
   clicks the toggle. */
.npc-drops { padding: 4px 0 12px 0; }
.footer-count {
    margin-left: 6px;
    font-size: 0.85rem;
    color: rgba(230, 240, 255, 0.55);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.npc-drop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 16px;
    color: #e6f0ff;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.25;
    transition: background 0.12s ease;
    min-height: 32px;
}
.npc-drop-row:hover { background: rgba(74, 158, 255, 0.1); }
/* Match the main item-list crop behavior: icons are 64x64 JPGs whose DDS→JPG
   conversion only filled the top-left ~40x40 with real artwork; the rest is
   black/grey fill. The main `.item-icon` wrapper handles this by showing the
   img at native 64px inside a 40px overflow:hidden box (top-left visible).
   We mirror the same 40-of-64 crop ratio at a smaller 28px row icon by
   scaling the inner img to 44.8px (so 28/44.8 = 40/64 = 62.5%) and clipping. */
.npc-drop-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    background: #000;
}
.npc-drop-icon img {
    width: 44.8px;
    height: 44.8px;
    display: block;
}
.npc-drop-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.npc-drop-qty {
    flex: 0 0 auto;
    color: rgba(230, 240, 255, 0.7);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}
/* Quality colors carried over from the existing item palette via the row
   class — fall back to default text otherwise. */
.npc-drop-row.quest    .npc-drop-name { color: #ffd152; }
.npc-drop-row.unique   .npc-drop-name { color: #d4b4ff; }
.npc-drop-row.legend   .npc-drop-name { color: #ffae00; }
.npc-drop-row.heroic   .npc-drop-name { color: #b8defe; }
.npc-drop-row.rare     .npc-drop-name { color: #b8e8c4; }

.npc-drops--truncated .npc-drop-row:nth-of-type(n+31) { display: none; }
.npc-drops--expanded .npc-drop-row { display: flex !important; }
.npc-drops-toggle {
    display: block;
    width: calc(100% - 32px);
    margin: 8px 16px 4px 16px;
    padding: 7px 10px;
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(120, 180, 255, 0.3);
    border-radius: 6px;
    color: #cfe2ff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.npc-drops-toggle:hover {
    background: rgba(74, 158, 255, 0.22);
    color: #fff;
    border-color: rgba(180, 210, 255, 0.55);
}

/* ===== NPC detail page: per-world spawn maps ===== */
.npc-locations-section {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    color: #e6f0ff;
}
.npc-locations-heading {
    margin: 0 0 14px 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(230, 240, 255, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 8px;
}
.npc-locations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
}
.npc-location-card {
    background: rgba(13, 38, 70, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.npc-location-card:hover {
    border-color: rgba(120, 180, 255, 0.4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.npc-location-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    color: #cfe2ff;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
}
.npc-location-title:hover {
    color: #fff;
    background: rgba(74, 158, 255, 0.12);
}
.npc-location-open {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(180, 210, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.npc-location-title:hover .npc-location-open { color: #fff; }
.npc-location-map {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: #0a1f35;
}
.npc-location-map .leaflet-container { background: #0a1f35; }

/* Subzone polygon labels — Leaflet tooltips anchored at polygon centroid.
   Override the default white pill so labels sit cleanly over tile colors. */
.leaflet-tooltip.map-subzone-label,
.map-subzone-label {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 1px 4px;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.85),
         1px -1px 0 rgba(0, 0, 0, 0.85),
        -1px  1px 0 rgba(0, 0, 0, 0.85),
         1px  1px 0 rgba(0, 0, 0, 0.85);
}
.map-subzone-label::before { display: none !important; }

.leaflet-tooltip.map-subzone-label-major,
.map-subzone-label-major {
    color: #ffd152;
}
