/* RSSI Map Visualizer — Warm Paper (Notion Minimal) */
:root {
  --bg-obsidian: #FAF9F6;
  --bg-sidebar: #FAF9F6;
  --bg-card: #FFFFFF;
  --bg-elevated: #F3F1EC;
  --border-hairline: rgba(28, 25, 23, 0.10);
  --border-gold: rgba(15, 118, 110, 0.30);

  --text-main: #1C1917;
  --text-secondary: #57534E;
  --text-muted: #78716C;

  --gold: #0F766E;
  --gold-light: #0F766E;
  --gold-hover: #115E59;
  --gold-soft: rgba(15, 118, 110, 0.09);

  --sig-excellent: #059669;
  --sig-good: #0284C7;
  --sig-fair: #D97706;
  --sig-poor: #E11D48;

  --font-sans: 'Plus Jakarta Sans', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-obsidian);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.text-gold { color: var(--gold); }
.text-good { color: #059669; }
.text-weak { color: #E11D48; }

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Warm Paper Sidebar */
.sidebar {
  width: 400px;
  min-width: 350px;
  max-width: 430px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.35rem 1.25rem;
  gap: 1.05rem;
  z-index: 1000;
  box-shadow: 4px 0 24px rgba(28, 25, 23, 0.06);
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(28, 25, 23, 0.14); border-radius: 99px; }

.sidebar-header {
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border-hairline);
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.brand-kicker {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.brand-title {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: var(--gold);
  color: #FFFFFF;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.22);
}

.brand-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.38rem;
  line-height: 1.45;
}

/* Cards */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.04);
}

.card-featured {
  border-color: var(--border-gold);
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.07);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.card-section h3 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

.pill-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid var(--border-gold);
  color: var(--gold);
}

/* Dropzone */
.file-dropzone {
  border: 1.5px dashed rgba(15, 118, 110, 0.35);
  border-radius: 12px;
  padding: 1.1rem 0.9rem;
  text-align: center;
  cursor: pointer;
  background: #FAF9F6;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.file-dropzone:hover, .file-dropzone.dragover {
  border-color: var(--gold);
  background: rgba(15, 118, 110, 0.05);
  transform: translateY(-1px);
}

.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 0.45rem;
}

.drop-content p {
  font-size: 0.8rem;
  color: var(--text-main);
}

.drop-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.22rem;
}

/* Per-File Toggle Manager */
.file-manager {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.file-manager-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 235px;
  overflow-y: auto;
  padding-right: 2px;
}

.file-list::-webkit-scrollbar { width: 4px; }
.file-list::-webkit-scrollbar-thumb { background: rgba(15, 118, 110, 0.22); border-radius: 99px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.52rem 0.62rem;
  border-radius: 10px;
  background: #FAF9F6;
  border: 1px solid var(--border-hairline);
  transition: border-color 0.15s, opacity 0.15s;
}

.file-item:hover {
  border-color: var(--border-gold);
}

.file-item.is-hidden {
  opacity: 0.46;
}

.file-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.file-item-btns {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon-xs {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon-xs:hover {
  border-color: var(--border-gold);
  color: var(--gold);
  background: var(--gold-soft);
}

.btn-icon-xs.del:hover {
  border-color: rgba(225, 29, 72, 0.4);
  color: #E11D48;
  background: rgba(225, 29, 72, 0.08);
}

/* Inputs & Selects */
.filter-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.url-input-group label, .form-group label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.input-inline {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.input-inline input, .select-clean {
  width: 100%;
  background: #FAF9F6;
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  padding: 0.48rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-main);
  outline: none;
  font-family: var(--font-sans);
  transition: border-color 0.15s, background 0.15s;
}

.input-inline input:focus, .select-clean:focus {
  border-color: var(--gold);
  background: #FFFFFF;
}

.btn-gold {
  background: var(--gold);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 0.48rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-gold:hover {
  background: var(--gold-hover);
}

.btn-lux-mini {
  padding: 0.4rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: #FAF9F6;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.btn-lux-mini:hover {
  border-color: var(--border-gold);
  color: var(--text-main);
  background: #FFFFFF;
}

.btn-lux-gold {
  background: var(--gold-soft);
  border-color: var(--border-gold);
  color: var(--gold);
}

.btn-lux-gold:hover {
  background: var(--gold);
  color: #FFFFFF;
}

.btn-lux-danger:hover {
  border-color: rgba(225, 29, 72, 0.45);
  color: #E11D48;
  background: rgba(225, 29, 72, 0.08);
}

/* Mini Accordion & Section Accordion */
.mini-accordion {
  border-top: 1px solid var(--border-hairline);
  padding-top: 0.55rem;
}

.mini-accordion summary {
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.accordion-card { padding: 0; overflow: hidden; }
.accordion-head {
  list-style: none;
  padding: 0.9rem 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.accordion-head::-webkit-details-marker { display: none; }
.accordion-head .caret { font-size: 1.1rem; transition: transform 0.2s; color: var(--text-muted); }
.accordion-card[open] .accordion-head .caret { transform: rotate(90deg); }
.accordion-body {
  padding: 0 1.05rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Range Slider */
.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.slider-clean {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Switches */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
  width: 34px;
  height: 18px;
  background: #D6D3CD;
  border-radius: 99px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #FFFFFF;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.18);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--gold);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(16px);
  background: #FFFFFF;
}

.toggle-switch.sm .toggle-slider { width: 30px; height: 16px; }
.toggle-switch.sm .toggle-slider::after { width: 12px; height: 12px; }
.toggle-switch.sm input:checked + .toggle-slider::after { transform: translateX(14px); }

.toggle-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  user-select: none;
}

/* Summary KPIs */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.stat-box {
  background: #FAF9F6;
  padding: 0.62rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
}

.stat-lbl { font-size: 0.68rem; color: var(--text-muted); }
.stat-num { font-size: 1.08rem; font-weight: 700; margin-top: 0.15rem; color: var(--text-main); }

.legend-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
}

.legend-tag {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 0.24rem 0.45rem;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
}

.tag-excellent { background: rgba(5, 150, 105, 0.10); color: #047857; border: 1px solid rgba(5, 150, 105, 0.28); }
.tag-good { background: rgba(2, 132, 199, 0.10); color: #0369A1; border: 1px solid rgba(2, 132, 199, 0.28); }
.tag-fair { background: rgba(217, 119, 6, 0.10); color: #B45309; border: 1px solid rgba(217, 119, 6, 0.28); }
.tag-poor { background: rgba(225, 29, 72, 0.10); color: #BE123C; border: 1px solid rgba(225, 29, 72, 0.28); }

/* AP & Planner */
.ap-meta-line {
  font-size: 0.72rem;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 0.48rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-gold);
}

.planner-box {
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.planner-stats {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: #FAF9F6;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
}

.planner-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

/* Map Viewport & Floating Controls */
.map-viewport { flex: 1; position: relative; height: 100vh; }
#map { width: 100%; height: 100%; background: #EFECE6; }

.map-overlay-tools {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  gap: 0.5rem;
}

.btn-overlay {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 0.52rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(28, 25, 23, 0.10);
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.btn-overlay:hover { border-color: var(--border-gold); color: var(--gold); background: #FFFFFF; }
.btn-overlay.btn-danger:hover { border-color: rgba(225, 29, 72, 0.45); color: #BE123C; background: #FFF1F2; }

/* Point Inspector */
.point-inspector {
  position: absolute;
  bottom: 1.4rem;
  right: 1.4rem;
  width: 330px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.14);
  z-index: 1000;
  overflow: hidden;
}

.inspector-header {
  padding: 0.75rem 1rem;
  background: var(--gold-soft);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inspector-title { font-size: 0.8rem; font-weight: 700; color: var(--gold); }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; }
.btn-close:hover { color: var(--text-main); }

.inspector-body {
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.inspect-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dashed rgba(28, 25, 23, 0.08);
  padding-bottom: 0.28rem;
}

.inspect-lbl { color: var(--text-muted); }
.inspect-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-main); text-align: right; word-break: break-all; }
