/* extra.css - panel/UI styles (FULL UNIFIED FILE v3) */

body { padding-top: 0 !important; }
main { height: 100vh !important; margin-top: 0 !important; padding-top: 0 !important; }

/* ---------- icons ---------- */
.lucide{width:24px;height:24px;stroke-width:2;vertical-align:middle;flex:none;display:inline-block}
.sec{display:flex;align-items:center;gap:.4rem}
.sec .lucide{width:15px;height:15px}
.bar .lucide{width:15px;height:15px}
.qRow label .lucide{width:15px;height:15px}
.bRow .lucide{width:15px;height:15px}
.bRow .bLabel{flex:1}
.chip .lucide{width:14px;height:14px}
.btn .lucide{width:14px;height:14px}
.wtag .lucide{width:12px;height:12px}
.srcLink .lucide{width:15px;height:15px}
.clbl .lucide,.nblbl .lucide{width:13px;height:13px}
.ovrRow .lucide{width:14px;height:14px}
.ovrClr .lucide{width:12px;height:12px}
.pinX .lucide{width:13px;height:13px}
.bNote .lucide{width:12px;height:12px}
.liTitle .lucide{width:15px;height:15px}
.liRow .lucide{width:15px;height:15px}
.liToggle .lucide{width:14px;height:14px}

/* ---------- Header (centered glass pill + country ring) ---------- */
header {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  width: fit-content;
  max-width: 90vw;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #111;
  --cc1: #009246;
  --cc2: #ffcd00;
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(255,255,255,0.4),rgba(255,255,255,0.4)) padding-box,
    linear-gradient(90deg,var(--cc1),var(--cc2)) border-box;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
header:has(.cc[data-cc="th"].active){--cc1:#A51931;--cc2:#2D2A4A;}
header:has(.cc[data-cc="kh"].active){--cc1:#032EA1;--cc2:#E00025;}
header:has(.cc[data-cc="mx"].active){--cc1:#006847;--cc2:#CE1126;}
[data-theme="dark"] header {
  color: #f3f4f6;
  background:
    linear-gradient(rgba(30,30,30,0.4),rgba(30,30,30,0.4)) padding-box,
    linear-gradient(90deg,var(--cc1),var(--cc2)) border-box;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
header .header-brand { display: flex; align-items: baseline; gap: 0.5rem; white-space: nowrap; }
header .header-brand h1 { margin: 0; font-size: 0.95rem; font-weight: 700; color: inherit; }
header .header-sub { display: none; }
header .header-actions { display: flex; gap: 0.4rem; align-items: center; }
header .hbtns { display: flex; gap: 0.3rem; }
header .cc {
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
  border-radius: 0.4rem;
  background: transparent;
  color: inherit;
  border: 1px solid transparent;
  transition: transform 0.25s ease;
}
header .cc.active { background: var(--accent); color: #fff; border-color: var(--accent); }
header .btn { padding: 0.35rem; min-width: auto; background: transparent; color: inherit; transition: transform 0.25s ease; }
header button svg, header .lucide { color: inherit !important; stroke: currentColor !important; }
header button:active { transform: rotate(-12deg) scale(0.85); }
header button:not(.cc):not(#bHelp):not(#bTheme){display:none !important}

/* ---------- Legend card (bottom right) ---------- */
.legend-card {
  position: absolute;
  bottom: 20px;
  right: 12px;
  z-index: 1000;
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  transition: all 0.3s ease;
  max-width: 180px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.legend-card.collapsed { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; max-width: none; cursor: pointer; }
.legend-card.collapsed .legendContent { display: none; }
.legend-card.collapsed .legendCollapse { width: 100%; height: 100%; border: none; background: none; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.legendCollapse { background: none; border: none; color: var(--mut); cursor: pointer; position: absolute; top: 6px; right: 6px; padding: 2px; z-index: 10; }
.legendCollapse:hover { color: var(--accent); }
.legendCollapse .lucide { width: 14px; height: 14px; }
.idxInfo { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--mut); background: none; color: var(--mut); font-size: .65rem; font-style: italic; cursor: pointer; position: absolute; bottom: 6px; right: 6px; z-index: 10; }
.legendTitle { display: block; font-size: 1rem; margin-bottom: .1rem; padding-right: 20px; }
.idxTip { font-size: .6rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: .4rem; padding: .3rem .4rem; margin: .25rem 0; line-height: 1.35; }
#legend .row { display: flex; align-items: center; gap: .4rem; }
#legend .row .lucide { width: 12px; height: 12px; flex: none; }

/* ---------- Explorer button ---------- */
#sideToggle { position: fixed; top: 110px; right: 10px; left: auto; bottom: auto; z-index: 900; display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1rem; border: none; border-radius: 999px; background: linear-gradient(135deg,#14b8a6,#0d9488); color: #fff; font-weight: 700; font-size: .8rem; box-shadow: 0 8px 20px -4px rgba(20,184,166,.55); cursor: pointer; }
#sideToggle .lucide { width: 14px; height: 14px; }

/* ---------- map chrome ---------- */
.mapFooter { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); z-index: 800; font-size: .6rem; color: var(--mut); background: color-mix(in srgb,var(--card) 80%,transparent); padding: 2px 8px; border-radius: 4px; pointer-events: none; }
.mapFooter a { color: var(--accent); text-decoration: none; pointer-events: auto; }
.resetViewBtn { width: 30px; height: 30px; border: 1px solid var(--chipb); background: var(--card); color: var(--ink); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.resetViewBtn:hover { background: var(--hov); }
.mk.mk-big { width: 18px !important; height: 18px !important; border-radius: 50% !important; transform: none !important; }

/* ---------- score bars ---------- */
#detailBody .bar { display: grid; grid-template-columns: 1.2rem 7.3rem 1fr 2rem 4rem; gap: .3rem; align-items: center; font-size: .72rem; padding: .15rem 0; }
#detailBody .bar span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#detailBody .bar .segs { display: flex; gap: 2px; }
#detailBody .bar .seg { height: 6px; flex: 1; background: var(--chipb); border-radius: 2px; }
#detailBody .bar b { font-size: .72rem; text-align: right; }

/* ---------- category info + tap tooltip ---------- */
.catInfo { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--mut); background: none; color: var(--mut); font-size: .58rem; font-style: italic; cursor: pointer; margin-left: .3rem; vertical-align: middle; }
#catTip { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: 86vw; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: .5rem; padding: .5rem .7rem; font-size: .7rem; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 2000; display: none; }

/* ---------- query / search ---------- */
.searchWrap { position: relative; display: block; width: 100%; }
#qText { width: 100%; padding-right: 30px; box-sizing: border-box; }
.qX { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; color: var(--mut); padding: 2px; line-height: 0; }
.qX .lucide { width: 14px; height: 14px; }

/* ---------- transport ---------- */
.intl { font-size: .55rem; font-weight: 700; background: #e0e7ff; color: #3730a3; border-radius: .3rem; padding: .05rem .3rem; vertical-align: middle; }

/* ---------- similar rows ---------- */
.simRow { display: flex; gap: .4rem; align-items: center; padding: .3rem; font-size: .75rem; cursor: pointer; }
.simRow:hover { background: var(--hov); }
.simHint { font-size: .6rem; color: var(--mut); font-weight: 400; margin-left: .3rem; }

/* ---------- climate ---------- */
.wrow.months { margin-bottom: 1px; }
.wmonth { flex: 1; text-align: center; font-size: .5rem; color: var(--mut); font-weight: 700; }
.wmonth.win { color: var(--accent); }
.wrow { display: flex; gap: 2px; margin: .2rem 0; }
.wcell { flex: 1; text-align: center; font-size: .55rem; padding: .15rem 0; border-radius: .2rem; color: #0b1220; font-weight: 700; }
.wrow.rain { height: 26px; align-items: flex-end; }
.wbar { flex: 1; background: #60a5fa; border-radius: .15rem .15rem 0 0; min-height: 2px; }
.wal { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.wtag { font-size: .6rem; padding: .15rem .4rem; border-radius: .4rem; font-weight: 700; display: inline-flex; align-items: center; gap: .25rem; }
.wtag.cold { background: #dbeafe; color: #1e3a8a; }
.wtag.wet { background: #e0f2fe; color: #075985; }
.wtag.hum { background: #ede9fe; color: #5b21b6; }
.wtag.ok { background: #dcfce7; color: #166534; }

/* ---------- pins ---------- */
.pinRow { display: flex; gap: .4rem; align-items: center; padding: .35rem; border-radius: .5rem; }
.pinRow:hover { background: var(--hov); }
.pinInfo { flex: 1; cursor: pointer; }
.pinNote { width: 100%; font-size: .65rem; padding: .15rem .3rem; margin-top: .15rem; border-radius: .3rem; border: 1px solid var(--chipb); background: var(--chip); color: var(--ink); }
.pinX { background: none; border: none; color: var(--mut); cursor: pointer; }
.pinBtn { margin-left: auto; }
.locateBtn { margin-left: .3rem; }

/* ---------- budget ---------- */
.bCard { border: 1px solid var(--line); border-radius: .5rem; padding: .6rem; margin: .4rem 0; }
.bRow { display: flex; gap: .4rem; align-items: center; font-size: .72rem; padding: .15rem 0; }
.bTotal { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .4rem; font-size: .8rem; font-weight: 800; }
.bNote { font-size: .66rem; color: var(--mut); margin-top: .35rem; font-style: italic; display: flex; align-items: center; gap: .3rem; }

/* ---------- badges / tags ---------- */
.flagb { display: inline-block; font-size: .6rem; font-weight: 800; border: 1px solid var(--chipb); border-radius: .3rem; padding: .05rem .3rem; color: var(--mut); letter-spacing: .5px; vertical-align: middle; }
.band { font-size: .62rem; font-weight: 700; padding: .05rem .35rem; border-radius: .3rem; }
.band.cheap { background: #dcfce7; color: #166534; }
.band.mid { background: #dbeafe; color: #1e40af; }
.band.top { background: #f3e8ff; color: #6b21a8; }
.band.nocap { background: #e5e7eb; color: #374151; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 800; flex: none; }
.rank.dim { background: transparent; color: var(--mut); }
.tag { font-size: .5rem; padding: .05rem .25rem; border-radius: .3rem; font-weight: 700; text-transform: uppercase; text-align: center; }
.tag.personal { background: #f0abfc; color: #4a044e; }
.tag.estimated { background: #fde68a; color: #78350f; }
.tag.proxy { background: #fed7aa; color: #7c2d12; }
.tag.measured { background: #bbf7d0; color: #14532d; }
.tag.computed { background: #bfdbfe; color: #1e3a8a; }
.tag.qualitative { background: #e5e7eb; color: #374151; }

/* ---------- overrides ---------- */
.ovrRow { display: flex; align-items: center; gap: .4rem; margin: .2rem 0; font-size: .7rem; }
.ovrRow span { flex: 1; display: flex; align-items: center; gap: .3rem; }
.ovr { width: 3.4rem; padding: .15rem .3rem; font-size: .7rem; border-radius: .3rem; border: 1px solid var(--chipb); background: var(--chip); color: var(--ink); }
.ovrClr { background: none; border: none; color: var(--mut); cursor: pointer; font-size: .7rem; }

/* ---------- side panel ---------- */
.sidePanelHead { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .3rem 0 .6rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem; position: sticky; top: 0; background: var(--card); z-index: 30; }
.sidePanelHead .sphTitle { font-weight: 800; font-size: .95rem; display: flex; align-items: center; gap: .4rem; }
.sphBtns { display: flex; align-items: center; gap: .25rem; }
.sphBtns .btn { padding: .3rem .5rem; font-size: .8rem; min-width: 2rem; }
@media (min-width:769px) { #sideClose { display: none } }
.simHelp { font-size: .66rem; color: var(--mut); line-height: 1.4; margin: .2rem 0 .4rem; }
.chipL { display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .5rem; color: var(--mut); }
.chipL .chip { padding: .35rem; }
.sideFooter { text-align: center; font-size: .65rem; color: var(--mut); padding: .8rem 0 .4rem; border-top: 1px solid var(--line); margin-top: .8rem; }
.sideFooter a { color: var(--accent); text-decoration: none; }

/* ---------- local info ---------- */
.liCard { border: 1px solid var(--line); border-radius: .5rem; padding: .5rem .6rem; margin: .4rem 0; font-size: .78rem; }
.liHead { display: flex; align-items: center; gap: .4rem; }
.liTitle { display: flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .8rem; }
.liRow { display: flex; align-items: center; gap: .4rem; padding: .2rem 0; }
.liRow>span:nth-child(3) { flex: 1; }
.liVal { font-weight: 700; margin-left: auto; }
.liVal.muted { color: var(--mut); font-style: italic; font-weight: 400; }
.liToggle { background: none; border: none; color: var(--mut); cursor: pointer; padding: 0; display: flex; align-items: center; flex: none; }

/* ---------- responsive ---------- */
@media (max-width:768px) {
 #bSideD,#bSideU { display: none }
 #legend { font-size: .7rem; padding: .5rem; }
 .legendTitle { font-size: .85rem; }
 .legendMobileHide { display: none; }
 #side { position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: none; padding: 1rem calc(.8rem + env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) .8rem; transform: translateX(105%); z-index: 1200; overflow-y: auto; }
 body.side-open #side { transform: translateX(0); }
 header { top: 12px; padding: 0.35rem 0.8rem; gap: 0.5rem; max-width: 92vw; }
 header .header-brand h1 { font-size: 0.85rem; }
 .legend-card { bottom: 15px; right: 8px; }
 /* layers control drops below the pill, Explorer below layers */
 .leaflet-top.leaflet-right { top: 118px !important; }
 #sideToggle { top: 176px; right: 8px; }
}
@media (max-width:640px) {
 #legend { font-size: .6rem; padding: .4rem .5rem; max-width: 52vw; }
 #legend .row { padding: .05rem 0; }
 #legend .sw { width: 9px; height: 9px; }
 .legendTitle { font-size: .72rem; }
 .budgetBig b { font-size: 1.1rem; }
 .budgetBig span { font-size: .6rem; }
 
 /* stack the map corner vertically: layers button, Explorer below it */
.leaflet-top.leaflet-right{display:flex !important;flex-direction:column !important;align-items:flex-end !important}

/* slim, elegant, spread pill on phones */
@media (max-width:768px){
 header{top:10px !important;padding:.3rem .9rem !important;width:94vw;max-width:94vw !important;justify-content:space-between;gap:.4rem;flex-wrap:nowrap;border-width:1.5px}
 header .header-brand h1{font-size:.8rem !important}
 header .header-brand h1 small{display:none}
 header .cc{font-size:.8rem;padding:.15rem .4rem}
 header .btn{padding:.25rem}
}

@media (max-width:768px){
 .leaflet-top.leaflet-left{top:70px !important}
}
}