/* ==============================
   AR Viewer — Loupiote
   ============================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ==============================
   Loading Screen
   ============================== */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }
.loading-content { text-align: center; color: #fff; }
.loading-logo {
  font-size: 2rem; font-weight: 700; letter-spacing: 0.3em;
  margin-bottom: 4px;
}
.loading-subtitle { font-size: 0.75rem; color: #999; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 32px; }
.loading-spinner {
  width: 36px; height: 36px; margin: 0 auto 16px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text { font-size: 0.85rem; color: #aaa; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================
   Instruction Overlay
   ============================== */
#instruction-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#instruction-overlay.hidden { opacity: 0; pointer-events: none; }
.instruction-content { text-align: center; color: #fff; }
.instruction-icon { margin-bottom: 24px; animation: bob 2s ease-in-out infinite; }
.instruction-text { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.instruction-subtext { font-size: 0.85rem; color: rgba(255,255,255,0.6); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
.pulse-dot { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.scan-line { animation: scanDown 1.5s ease-in-out infinite; }
@keyframes scanDown { 0% { transform: translateY(0); } 100% { transform: translateY(8px); } }

/* ==============================
   Toast
   ============================== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 200;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 2rem; font-weight: 700;
  padding: 16px 32px;
  border-radius: 16px;
  pointer-events: none;
  transition: opacity 0.4s ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.toast.hidden { opacity: 0; }
.toast.visible { opacity: 1; }

/* ==============================
   Controls Panel
   ============================== */
#controls {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.6) 70%, transparent 100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#controls.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }

/* Presets */
.presets {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 12px;
}
.preset-btn {
  flex: 1; max-width: 110px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem; font-weight: 600;
  text-align: center; line-height: 1.3;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.preset-btn small { font-weight: 400; opacity: 0.7; }
.preset-btn.active {
  background: rgba(255,255,255,0.2);
  border-color: #fff;
  color: #fff;
}
.preset-btn:active { transform: scale(0.95); }

/* Height adjuster */
.height-adjuster {
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.adj-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.adj-btn:active {
  background: rgba(255,255,255,0.3);
  transform: scale(0.9);
}
.height-display {
  text-align: center; min-width: 100px;
}
#height-value {
  display: block;
  font-size: 1.8rem; font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.height-label {
  display: block;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* Shopify link */
.shopify-btn {
  display: block;
  margin: 12px auto 0;
  padding: 10px 24px;
  background: #fff;
  color: #000;
  font-size: 0.85rem; font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  text-align: center;
  max-width: 260px;
  transition: all 0.2s ease;
}
.shopify-btn:active { transform: scale(0.97); opacity: 0.9; }
.shopify-btn.hidden { display: none; }

/* ==============================
   A-Frame overrides
   ============================== */
.a-enter-vr, .a-orientation-modal { display: none !important; }
