/* ── OmniLocate — Premium Dark Dashboard ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:          #f5efff;
  --surface:     #efe4ff;
  --surface-2:   #e4d3ff;
  --border:      rgba(123, 97, 255, 0.12);
  --border-hover:rgba(123, 97, 255, 0.22);
  --ink:         #2f1f4a;
  --muted:       #7d6a9e;
  --accent:      #b57cff;
  --accent-2:    #c79bff;
  --accent-glow: rgba(181,124,255,0.22);
  --danger:      #ef4444;
  --danger-dark: #b91c1c;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --topbar-h:    58px;
  --sidebar-w:   200px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 99px; }

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(245,239,255,0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.topbar__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 400px 1fr;
  height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 8px;
  gap: 4px;
}

.sidebar__tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── TABS ────────────────────────────────────────────────────── */
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  position: relative;
}

.tab:hover { background: var(--surface-2); color: var(--ink); }

.tab--active {
  background: var(--accent-glow);
  color: var(--accent-2);
  font-weight: 600;
}

.tab__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.dot--idle { background: var(--muted); }
.dot--running { background: var(--accent-2); animation: pulse 1.4s ease infinite; }
.dot--done { background: var(--success); }
.dot--fail { background: var(--danger); }
.dot--cancel { background: var(--warning); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.tab__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tab__remove {
  opacity: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.tab:hover .tab__remove { opacity: 1; }
.tab__remove:hover { background: rgba(239,68,68,0.18); color: var(--danger); }

/* ── CONFIG PANEL ────────────────────────────────────────────── */
.config-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cp-header {}
.cp-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rename-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 4px;
}

h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 2px 0 6px;
}

.subtle, .muted { color: var(--muted); font-size: 0.85rem; }

/* ── FIELD GROUPS ────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-label--with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.field-group input[type="text"],
.field-group input[type="number"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group input::placeholder { color: var(--muted); }
.field-group input:disabled { opacity: 0.45; cursor: not-allowed; }

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-2);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 99px;
}

.field-actions {
  display: flex;
  gap: 6px;
}

.field-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.field-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.field-option:hover { border-color: var(--border-hover); color: var(--ink); }
.field-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: auto;
  border: none;
  padding: 0;
  background: none;
}

.field-note { font-size: 0.78rem; color: var(--muted); }

/* ── POINTS CARD ─────────────────────────────────────────────── */
.points-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.points-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.points-card__head .field-label { flex: 1; }

.points-list {
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── ACTIONS BAR ─────────────────────────────────────────────── */
.actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}
.btn--primary:hover { box-shadow: 0 6px 22px rgba(99,102,241,0.5); }

.btn--ghost {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn--ghost:hover { border-color: var(--border-hover); }

.btn--danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: #fff;
}

.btn--download {
  margin-top: 10px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5,150,105,0.3);
}

.btn--sm { padding: 8px 14px; font-size: 0.8rem; }

.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.mini-btn:hover { color: var(--ink); border-color: var(--border-hover); }
.mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.mini-btn--danger { color: var(--danger); border-color: rgba(239,68,68,0.25); }
.mini-btn--danger:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); }

.hidden { display: none !important; }

/* ── STATUS CARD ─────────────────────────────────────────────── */
.status-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: capitalize;
}
.status-badge--idle { background: rgba(122,132,153,0.18); color: var(--muted); }
.status-badge--running {
  background: var(--accent-glow);
  color: var(--accent-2);
  animation: pulse 1.4s ease infinite;
}
.status-badge--done { background: rgba(34,197,94,0.15); color: var(--success); }
.status-badge--fail { background: rgba(239,68,68,0.15); color: var(--danger); }
.status-badge--cancel { background: rgba(245,158,11,0.15); color: var(--warning); }

/* ── PROGRESS BAR ────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* ── METRICS ─────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.metric span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.metric strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

/* ── MAP ─────────────────────────────────────────────────────── */
.map-shell {
  background: var(--bg);
  padding: 14px;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 20px 60px rgba(142, 94, 94, 0.5);
}

/* Leaflet dark override */
.leaflet-container {  background: #eadbff; }
.leaflet-tile { filter: grayscale(30%) brightness(0.85) contrast(1.1); }
.leaflet-popup-content-wrapper {
  background: var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.leaflet-popup-tip { background: var(--surface-2); }

/* ── MAP LABELS ──────────────────────────────────────────────── */
.map-label {
   background: rgba(239,228,255,0.95);
  color: var(--accent);
  border: 1px solid var(--accent-2);
  border-radius: 99px;
  padding: 5px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  white-space: nowrap;
}

.point-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99,102,241,0.5);
  cursor: grab;
}

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
   background: rgba(80, 48, 120, 0.25);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 32px 80px rgba(202, 115, 115, 0.6), 0 0 0 1px var(--border);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}

.modal--sm { max-width: 400px; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal__header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal__close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.modal__close:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.modal__body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal__subtitle { color: var(--muted); font-size: 0.85rem; }

.confirm-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.confirm-row:last-child { border-bottom: none; }

.confirm-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.confirm-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.confirm-points-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cp-point-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.cp-point-num {
  width: 20px;
  height: 20px;
  border-radius: 99px;
  background: var(--accent-glow);
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 56px; }
  .tab__label, .tab__remove { display: none; }
  .tab__dot { margin: 0 auto; }
  .tab { justify-content: center; padding: 12px; }
}

@media (max-width: 800px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
    overflow: auto;
  }
  .sidebar {
    flex-direction: row;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar__tabs { flex-direction: row; }
  .tab__label { display: block !important; }
  .map-shell { height: 55vh; }
  html, body { overflow: auto; }
  
}
