/**
 * Kiosk Menu - Sci-Fi HUD Premium UI
 * 
 * Design principles:
 * - Motion discipline: 2-3 animations max at once
 * - Material realism: single light model, subtle grain
 * - Typography hierarchy: bold titles, lighter names, bold prices
 * - Performance tiers: Low/Medium/High via quality toggle
 * - Unified with admin panel sci-fi aesthetic
 */

:root {
  /* Core palette */
  --bg-deep: #050a14;
  --bg-mid: #0f172a;
  --bg-surface: rgba(15, 23, 42, 0.85);
  
  /* Accent colors - Sci-Fi Cyan/Teal */
  --cyan: #00d4ff;
  --cyan-bright: #00f3ff;
  --cyan-glow: rgba(0, 212, 255, 0.5);
  --teal: #0d9488;
  --teal-bright: #14b8a6;
  --teal-glow: rgba(20, 184, 166, 0.4);
  
  /* Text hierarchy */
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-cyan: #7dd3fc;
  
  /* Borders & surfaces */
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-cyan: rgba(0, 243, 255, 0.3);
  --glass-bg: rgba(15, 23, 42, 0.7);
  
  /* Lighting (driven by fx.js v3) */
  --mx: 0.5;
  --my: 0.5;
  --light-x: 50%;
  --light-y: 50%;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  
  /* Material controls (auto-adjusted by quality tier in fx.js) */
  --specular: 0.22;
  --rim: 0.14;
  
  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: var(--text-primary);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════
   BACKGROUND - Single ambient gradient + vignette
   Replaces multiple animated orbs with cleaner approach
   ═══════════════════════════════════════════════════════════ */

.bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Ambient gradient - subtle, not animated */
.bg-effects::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 120% 80% at 80% 20%, var(--cyan-glow), transparent 50%),
    radial-gradient(ellipse 100% 60% at 20% 80%, var(--teal-glow), transparent 50%);
  opacity: 0.5;
}

/* Vignette */
.bg-effects::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, var(--bg-deep) 100%);
  pointer-events: none;
}

/* Hide DOM orbs - canvas handles particles now */
.orb { display: none; }
.particles { display: none; }

/* ═══════════════════════════════════════════════════════════
   FX CANVAS
   ═══════════════════════════════════════════════════════════ */

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   HEADER / HUD - Cleaner, less animation
   ═══════════════════════════════════════════════════════════ */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  background: linear-gradient(180deg, 
    rgba(5, 10, 20, 0.95) 0%,
    rgba(15, 23, 42, 0.8) 70%,
    transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-cyan);
  z-index: 100;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.1em;
  color: var(--text-cyan);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 212, 255, 0.3);
}

.logo-icon {
  color: var(--cyan-bright);
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(0, 243, 255, 0.5));
}

.hud-center {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 20px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.live-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #fca5a5;
}

.hud-right {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   MENU GRID
   ═══════════════════════════════════════════════════════════ */

.wall {
  position: absolute;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-xl);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  scroll-behavior: smooth;
  transition: opacity 0.2s ease;
}

/* Custom scrollbar */
.wall::-webkit-scrollbar {
  width: 8px;
}

.wall::-webkit-scrollbar-track {
  background: transparent;
}

.wall::-webkit-scrollbar-thumb {
  background: var(--border-cyan);
  border-radius: 4px;
}

.wall::-webkit-scrollbar-thumb:hover {
  background: var(--cyan);
}

/* ═══════════════════════════════════════════════════════════
   CATEGORY CARDS - Premium machined acrylic material
   - Unified light rig (--specular, --rim from fx.js v3)
   - Inner bevel ring (thickness cue)
   - Micro-noise texture
   - Pointer-tracking specular + rim
   - 3D tilt with mass-like settling
   ═══════════════════════════════════════════════════════════ */

.card {
  position: relative;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(0, 243, 255, 0.28);
  border-radius: 16px;
  padding: var(--space-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  /* Depth shadows */
  box-shadow:
    0 6px 26px rgba(0,0,0,0.55),
    0 14px 60px rgba(0,0,0,0.35),
    0 0 0 1px rgba(0, 243, 255, 0.06),
    0 0 26px rgba(0, 212, 255, 0.07),
    inset 0 2px 4px rgba(0,0,0,0.34),
    inset 0 -1px 2px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.10);

  /* 3D transform */
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition:
    transform 0.45s var(--ease-out-expo),
    box-shadow 0.35s ease-out,
    border-color 0.25s ease-out;
  overflow: hidden;
  will-change: transform;
}

/* Inner bevel ring (thickness cue) + micro-noise */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background:
    /* micro-noise texture */
    repeating-radial-gradient(
      circle at 10% 20%,
      rgba(255,255,255,0.018) 0px,
      rgba(255,255,255,0.018) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 4px
    ),
    /* inner bevel */
    linear-gradient(
      180deg,
      rgba(255,255,255,0.08) 0%,
      rgba(255,255,255,0.02) 18%,
      rgba(0,0,0,0.00) 55%,
      rgba(0,0,0,0.18) 100%
    );
  mix-blend-mode: overlay;
  opacity: 0.9;
}

/* Specular + rim (unified light rig, quality-tuned via --specular/--rim) */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.28s ease;
  background:
    /* pointer specular (quality-tuned) */
    radial-gradient(
      ellipse 52% 34% at var(--light-x) var(--light-y),
      rgba(255,255,255,var(--specular)) 0%,
      rgba(255,255,255, calc(var(--specular) * 0.45)) 26%,
      rgba(255,255,255, calc(var(--specular) * 0.15)) 42%,
      transparent 72%
    ),
    /* rim light (quality-tuned) */
    linear-gradient(
      135deg,
      rgba(0,243,255,var(--rim)) 0%,
      transparent 28%,
      transparent 72%,
      rgba(0,243,255, calc(var(--rim) * 0.75)) 100%
    );
}

.card:hover::after {
  opacity: 1;
}

.card:hover {
  border-color: rgba(0, 243, 255, 0.44);
  box-shadow:
    0 14px 46px rgba(0,0,0,0.62),
    0 26px 78px rgba(0,0,0,0.40),
    0 0 0 1px rgba(0, 243, 255, 0.40),
    0 0 44px rgba(0, 212, 255, 0.18),
    0 0 92px rgba(0, 212, 255, 0.10),
    inset 0 2px 4px rgba(0,0,0,0.34),
    inset 0 -1px 2px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.14);
}

/* Mass-like settling animation on hover-out */
.card:not(:hover) {
  transition:
    transform 0.65s cubic-bezier(0.30, 1.55, 0.50, 1),
    box-shadow 0.4s ease-out,
    border-color 0.25s ease-out;
}

.card:active {
  transform: perspective(1000px) rotateX(0deg) rotateY(0deg) translateY(-2px) scale(0.98);
  transition: transform 0.1s ease-in;
}

/* Ensure content is above pseudo layers */
.card > * {
  position: relative;
  z-index: 3;
}

/* Category title with reveal animation */
.card h2 {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-cyan);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  position: relative;
  z-index: 3;
  /* Clip reveal setup */
  overflow: hidden;
}

/* Accent bar with glow */
.card h2::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--cyan-bright), var(--cyan));
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.6);
  flex-shrink: 0;
}

/* Animated line reveal */
.card h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--border-cyan), transparent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.6s var(--ease-out-expo);
}

.card:hover h2::after {
  transform: scaleX(1);
}

/* ═══════════════════════════════════════════════════════════
   MENU ITEMS - Clean rows with consistent heights
   ═══════════════════════════════════════════════════════════ */

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-lg);
  min-height: 56px;
  padding: var(--space-md) var(--space-md);
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  z-index: 3;
  /* Magnetic hover - tiny tracking feel */
  transition: 
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.3s var(--ease-out-expo),
    padding-left 0.3s var(--ease-out-expo);
}

.row:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--border-cyan);
  /* Magnetic pull effect */
  padding-left: calc(var(--space-md) + 4px);
  transform: translateX(2px);
}

.row:active {
  transform: translateX(2px) scale(0.995);
  transition: transform 0.1s ease;
}

.row + .row {
  margin-top: var(--space-sm);
}

/* Item name - lighter weight for hierarchy */
.name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* Description (optional) */
.description {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Price pill - bold, tabular numerals with shine sweep */
.price {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cyan-bright);
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
  position: relative;
  overflow: hidden;
}

/* Shine sweep animation */
.price::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  transition: left 0.5s ease;
}

.row:hover .price::after {
  left: 100%;
}

/* ═══════════════════════════════════════════════════════════
   HIGHLIGHTED / FEATURED ITEMS
   Subtle glow, no continuous pulse animation
   ═══════════════════════════════════════════════════════════ */

.row.highlight {
  background: rgba(0, 212, 255, 0.12);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.row.highlight .name {
  color: var(--text-cyan);
  font-weight: 700;
}

.row.highlight .price {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--cyan-bright);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   ERROR DISPLAY
   ═══════════════════════════════════════════════════════════ */

.error {
  position: fixed;
  left: var(--space-lg);
  right: var(--space-lg);
  bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fecaca;
  font-size: 14px;
  font-weight: 500;
  white-space: pre-wrap;
  z-index: 200;
}

.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   LOADING SKELETON
   ═══════════════════════════════════════════════════════════ */

.loading-skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.1) 0%,
    rgba(148, 163, 184, 0.2) 50%,
    rgba(148, 163, 184, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════
   DEV PANEL
   ═══════════════════════════════════════════════════════════ */

.dev-panel {
  position: fixed;
  top: 100px;
  right: var(--space-lg);
  width: 180px;
  padding: var(--space-md);
  background: rgba(5, 10, 20, 0.95);
  border: 1px solid var(--cyan);
  border-radius: 10px;
  font-size: 12px;
  font-family: 'Inter', monospace;
  z-index: 9999;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.dev-panel.hidden { display: none; }

.dev-title {
  font-weight: 700;
  color: var(--cyan-bright);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.dev-stat {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.dev-stat span {
  color: var(--cyan);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dev-control {
  margin-top: var(--space-sm);
}

.dev-control label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.dev-control select {
  flex: 1;
  padding: 4px 6px;
  background: var(--bg-mid);
  border: 1px solid var(--border-cyan);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 11px;
}

.dev-control input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--cyan);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
  .wall {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1400px) {
  .wall {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .hud { padding: var(--space-md) var(--space-lg); }
  .wall { top: 70px; padding: var(--space-md); gap: var(--space-md); }
  .card { padding: var(--space-md); }
  .card h2 { font-size: 12px; margin-bottom: var(--space-md); }
  .name { font-size: 16px; }
  .price { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  #fx { display: none; }
  
  .card:hover { transform: none; }
  .row:hover { transform: none; }
}

@media (prefers-contrast: more) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --text-cyan: #00ffff;
  }
  
  .card { border-width: 2px; }
  .row { border-width: 2px; }
  .name, .price { text-shadow: none; }
}
