@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* Color */
  --color-primary: #0F766E;
  --color-secondary: #14B8A6;
  --color-accent: #0369A1;
  --color-bg: #0F172A;
  --color-surface: #192134;
  --color-surface-2: #1E2A3F;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-text: #FFFFFF;
  --color-text-muted: #94A3B8;
  --color-destructive: #DC2626;
  --glass-surface: rgba(25, 33, 52, 0.85);
  --glass-surface-light: rgba(30, 42, 63, 0.72);
  --glass-blur: blur(12px) saturate(140%);

  /* Spacing */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;  --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.375rem;
  --leading: 1.5;
  --weight-light: 300; --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-3: 0 8px 24px rgba(0,0,0,0.40);
  --shadow-4: 0 16px 48px rgba(0,0,0,0.50);
  --glow-primary: 0 0 0 1px rgba(20,184,166,0.4), 0 0 16px rgba(20,184,166,0.25);

  /* Radii */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms; --dur-base: 200ms; --dur-slow: 300ms;

  /* Z-index */
  --z-canvas: 0; --z-pins: 10; --z-controls: 20; --z-header: 30;
  --z-panel: 40; --z-scrim: 50; --z-sheet: 60; --z-dropdown: 70; --z-toast: 80;

  /* Safe areas */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  /* Legacy aliases — maps old variable names to new tokens */
  --primary: var(--color-primary);
  --primary-light: #0d4f4a;
  --secondary: var(--color-secondary);
  --accent: var(--color-secondary);
  --accent-light: rgba(20,184,166,0.15);
  --amber: #92400e;
  --amber-light: rgba(245,158,11,0.15);
  --red: var(--color-destructive);
  --surface: var(--color-surface);
  --surface-secondary: var(--color-surface-2);
  --border: var(--color-border);
  --text: var(--color-text);
  --text-secondary: var(--color-text-muted);
  --text-tertiary: #64748B;
  --font: var(--font-sans);
  --mono: 'DM Mono', ui-monospace, monospace;
  --radius: var(--radius-md);
  --panel-width: 340px;
  --bg: var(--color-bg);
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* ── Buttons ──────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}
.btn-primary:hover  { background: #0f4a87; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.danger { background: var(--red); }
.btn-primary.danger:hover { background: #b91c1c; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.12s;
  width: 100%;
}
.btn-secondary:hover { background: var(--surface-secondary); }

/* ── Type chips ──────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
}
.chip-dropoff    { background: var(--primary-light); color: var(--primary); }
.chip-collection { background: var(--accent-light);  color: var(--accent); }
.chip-both       { background: var(--amber-light);   color: var(--amber); }

/* ── Form elements ───────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus        { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-tertiary); }
textarea.form-input      { resize: vertical; min-height: 68px; }

/* ── Toast ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ── Map container ───────────────────────── */
.map-container { width: 100%; height: 100%; }

/* ── Mobile + Tablet (≤1024px): full-screen canvas, fixed bottom-sheet panel ── */
/* Shared by viewer3d.html and admin3d.html — page-specific theme overrides in each HTML */
@media (max-width: 1024px) {
  #app { display: block !important; position: relative !important; }
  #canvas-wrap { position: absolute !important; inset: 0 !important; flex: none !important; }

  #side-panel {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important; top: auto !important;
    width: 100% !important; height: 16vh !important;
    border-left: none !important;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.45) !important;
    transition: height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }
  #side-panel.panel-folded { height: 52px !important; overflow: hidden; }

  .panel-fold-btn, #panel-toggle { display: flex !important; }

  #cam-presets {
    position: fixed !important;
    top: auto !important; left: 16px !important;
    bottom: calc(16vh + 8px) !important;
    flex-direction: row !important; gap: 10px;
    transform: none !important;
    transition: bottom 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }
  /* Folded: drive the button position from CSS (same vh units + transition as
     the panel) so they animate in perfect lockstep with the fold/unfold.
     .panel-is-folded is mirrored onto #app by panel-mobile.js for browsers
     without :has() support (older iOS Safari / Android WebView). */
  #app.panel-is-folded #cam-presets,
  #app:has(#side-panel.panel-folded) #cam-presets { bottom: calc(52px + 8px) !important; }
  .cam-preset-btn .label-wrap { display: none !important; }
  #site-brand, #site-address { display: none !important; }
}

/* ── Mobile only (≤767px): taller panel ── */
@media (max-width: 767px) {
  #side-panel { height: 19vh !important; }
  #side-panel.panel-folded { height: 48px !important; }
  #cam-presets { bottom: calc(19vh + 8px) !important; }
  #app.panel-is-folded #cam-presets,
  #app:has(#side-panel.panel-folded) #cam-presets { bottom: calc(48px + 8px) !important; }
  #nav-progress { bottom: calc(19vh + 20px); }
  #analytics-section { display: none !important; }
}
