/* ============================================
   VELVET WAYZ v2 — CORE DESIGN SYSTEM
   ============================================
   Palette: Deep Black + Velvet Purple Neon
   Feel: Tesla + Blade Runner + Premium GPS
   ============================================ */

:root {
  /* === Base Colors === */
  --vw-black: #0A0A0A;
  --vw-black-glass: rgba(10, 10, 10, 0.88);
  --vw-black-deep: #050505;
  --vw-surface: #121212;
  --vw-surface-elevated: #1A1A1A;
  --vw-border: rgba(255, 255, 255, 0.08);
  --vw-border-strong: rgba(255, 255, 255, 0.15);

  /* === Velvet Purple Neon === */
  --vw-purple: #9D4EDD;
  --vw-purple-bright: #C77DFF;
  --vw-purple-glow: rgba(157, 78, 221, 0.6);
  --vw-purple-dim: rgba(157, 78, 221, 0.2);
  --vw-purple-dark: #5A189A;

  /* === Accent Colors === */
  --vw-cyan: #00F5D4;
  --vw-cyan-glow: rgba(0, 245, 212, 0.5);
  --vw-gold: #FFD700;
  --vw-gold-dim: rgba(255, 215, 0, 0.3);
  --vw-red: #FF0055;
  --vw-red-glow: rgba(255, 0, 85, 0.5);
  --vw-green: #00FF88;
  --vw-green-glow: rgba(0, 255, 136, 0.4);
  --vw-orange: #FF9500;

  /* === Typography === */
  --vw-font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --vw-font-mono: 'SF Mono', 'Courier New', monospace;
  --vw-text-primary: #FFFFFF;
  --vw-text-secondary: rgba(255, 255, 255, 0.6);
  --vw-text-tertiary: rgba(255, 255, 255, 0.35);
  --vw-text-muted: rgba(255, 255, 255, 0.2);

  /* === Spacing === */
  --vw-safe-top: env(safe-area-inset-top, 0px);
  --vw-safe-bottom: env(safe-area-inset-bottom, 0px);
  --vw-nav-height: 72px;
  --vw-hud-height: 120px;

  /* === Shadows & Glows === */
  --vw-glow-purple: 0 0 20px var(--vw-purple-glow), 0 0 40px var(--vw-purple-dim);
  --vw-glow-cyan: 0 0 15px var(--vw-cyan-glow);
  --vw-glow-gold: 0 0 15px var(--vw-gold-dim);
  --vw-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.6);
  --vw-shadow-float: 0 8px 32px rgba(0, 0, 0, 0.8);

  /* === Transitions === */
  --vw-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --vw-transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --vw-transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--vw-black);
  color: var(--vw-text-primary);
  font-family: var(--vw-font-display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Glass UI Base === */
.vw-glass {
  background: var(--vw-black-glass);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--vw-border);
  border-radius: 16px;
}

.vw-glass-strong {
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid var(--vw-border-strong);
  border-radius: 20px;
}

.vw-glass-panel {
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.95) 0%, rgba(10, 10, 10, 0.98) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--vw-border);
  border-radius: 24px 24px 0 0;
}

/* === Neon Glow Effects === */
.vw-glow-purple {
  box-shadow: var(--vw-glow-purple);
}

.vw-glow-cyan {
  box-shadow: var(--vw-glow-cyan);
}

.vw-glow-gold {
  box-shadow: var(--vw-glow-gold);
}

.vw-text-glow-purple {
  text-shadow: 0 0 10px var(--vw-purple-glow), 0 0 20px var(--vw-purple-dim);
}

.vw-text-glow-cyan {
  text-shadow: 0 0 10px var(--vw-cyan-glow);
}

/* === Buttons === */
.vw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-family: var(--vw-font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--vw-text-primary);
  background: var(--vw-surface-elevated);
  border: 1px solid var(--vw-border);
  cursor: pointer;
  transition: all var(--vw-transition-fast);
  min-height: 44px;
  min-width: 44px;
  position: relative;
  overflow: hidden;
}

.vw-btn:active {
  transform: scale(0.96);
}

.vw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.vw-btn-primary {
  background: linear-gradient(135deg, var(--vw-purple) 0%, var(--vw-purple-dark) 100%);
  border: none;
  box-shadow: 0 4px 16px var(--vw-purple-dim);
}

.vw-btn-primary:hover:not(:disabled) {
  box-shadow: var(--vw-glow-purple);
  transform: translateY(-1px);
}

.vw-btn-cyan {
  background: linear-gradient(135deg, var(--vw-cyan) 0%, #00B4A8 100%);
  color: var(--vw-black);
  border: none;
  font-weight: 700;
}

.vw-btn-danger {
  background: linear-gradient(135deg, var(--vw-red) 0%, #CC0044 100%);
  border: none;
}

.vw-btn-ghost {
  background: transparent;
  border: 1px solid var(--vw-border-strong);
}

.vw-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--vw-purple);
}

/* === Loading States === */
.vw-btn[data-loading="true"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: vw-spin 0.6s linear infinite;
}

.vw-btn[data-loading="true"] {
  color: transparent;
}

@keyframes vw-spin {
  to { transform: rotate(360deg); }
}

/* === Error States === */
.vw-btn[data-error="true"] {
  border-color: var(--vw-red);
  box-shadow: 0 0 8px var(--vw-red-glow);
}

.vw-btn[data-success="true"] {
  border-color: var(--vw-green);
  box-shadow: 0 0 8px var(--vw-green-glow);
}

/* === Inputs === */
.vw-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--vw-surface);
  border: 1px solid var(--vw-border);
  border-radius: 12px;
  color: var(--vw-text-primary);
  font-family: var(--vw-font-display);
  font-size: 16px;
  outline: none;
  transition: all var(--vw-transition-fast);
}

.vw-input:focus {
  border-color: var(--vw-purple);
  box-shadow: 0 0 0 3px var(--vw-purple-dim);
}

.vw-input::placeholder {
  color: var(--vw-text-muted);
}

/* === Toggle Switch === */
.vw-toggle {
  position: relative;
  width: 52px;
  height: 32px;
  background: var(--vw-surface-elevated);
  border-radius: 16px;
  border: 1px solid var(--vw-border);
  cursor: pointer;
  transition: all var(--vw-transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.vw-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: var(--vw-text-secondary);
  border-radius: 50%;
  transition: all var(--vw-transition-fast);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vw-toggle:checked {
  background: linear-gradient(135deg, var(--vw-purple) 0%, var(--vw-purple-dark) 100%);
  border-color: var(--vw-purple);
}

.vw-toggle:checked::after {
  left: 25px;
  background: #fff;
  box-shadow: 0 0 8px var(--vw-purple-glow);
}

.vw-toggle:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* === Cards === */
.vw-card {
  background: var(--vw-surface);
  border: 1px solid var(--vw-border);
  border-radius: 16px;
  padding: 16px;
  transition: all var(--vw-transition-fast);
}

.vw-card:hover {
  border-color: var(--vw-border-strong);
  box-shadow: var(--vw-shadow-card);
}

.vw-card-active {
  border-color: var(--vw-purple);
  box-shadow: 0 0 0 1px var(--vw-purple), var(--vw-glow-purple);
}

/* === Bottom Sheet === */
.vw-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: var(--vw-glass-panel);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform var(--vw-transition-slow);
  z-index: 1000;
  overflow-y: auto;
  padding-bottom: var(--vw-safe-bottom);
}

.vw-bottom-sheet.open {
  transform: translateY(0);
}

.vw-bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--vw-border-strong);
  border-radius: 2px;
  margin: 12px auto;
}

/* === Overlays === */
.vw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--vw-transition-base);
  z-index: 999;
}

.vw-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--vw-border-strong);
  border-radius: 2px;
}

/* === Utility === */
.vw-hidden { display: none !important; }
.vw-invisible { visibility: hidden; }
.vw-flex { display: flex; }
.vw-flex-col { display: flex; flex-direction: column; }
.vw-items-center { align-items: center; }
.vw-justify-center { justify-content: center; }
.vw-justify-between { justify-content: space-between; }
.vw-gap-2 { gap: 8px; }
.vw-gap-3 { gap: 12px; }
.vw-gap-4 { gap: 16px; }
.vw-p-3 { padding: 12px; }
.vw-p-4 { padding: 16px; }
.vw-px-4 { padding-left: 16px; padding-right: 16px; }
.vw-py-3 { padding-top: 12px; padding-bottom: 12px; }
.vw-text-sm { font-size: 14px; }
.vw-text-xs { font-size: 12px; }
.vw-text-lg { font-size: 18px; }
.vw-text-xl { font-size: 24px; }
.vw-text-2xl { font-size: 32px; }
.vw-font-bold { font-weight: 700; }
.vw-font-semibold { font-weight: 600; }
.vw-text-primary { color: var(--vw-text-primary); }
.vw-text-secondary { color: var(--vw-text-secondary); }
.vw-text-tertiary { color: var(--vw-text-tertiary); }
.vw-text-purple { color: var(--vw-purple-bright); }
.vw-text-cyan { color: var(--vw-cyan); }
.vw-text-gold { color: var(--vw-gold); }
.vw-text-red { color: var(--vw-red); }
.vw-text-green { color: var(--vw-green); }

/* === Screen Container === */
#vw-app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--vw-black);
}

.vw-screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  padding-top: var(--vw-safe-top);
  padding-bottom: calc(var(--vw-nav-height) + var(--vw-safe-bottom));
}

.vw-screen.active {
  display: block;
}

/* === Top Bar === */
.vw-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding: 0 16px;
  padding-top: var(--vw-safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(10,10,10,0.9) 0%, transparent 100%);
  z-index: 500;
  pointer-events: none;
}

.vw-top-bar > * {
  pointer-events: auto;
}

.vw-top-bar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--vw-text-primary);
}

/* === Animation Keyframes === */
@keyframes vw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes vw-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes vw-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes vw-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.vw-animate-pulse {
  animation: vw-pulse 2s ease-in-out infinite;
}

.vw-animate-slide-up {
  animation: vw-slide-up var(--vw-transition-slow) ease-out;
}

.vw-animate-fade-in {
  animation: vw-fade-in var(--vw-transition-base) ease-out;
}

/* ── MAP SCREEN FULLSCREEN FIX ── */
.vw-screen[data-screen="map"] {
  position: fixed !important;
  inset: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
}

.vw-screen[data-screen="map"] #vw-map-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
