/* ================================================================
   DOI PHA HEE CRAFT ARABICA - WebAR INTERACTIVE HUD & APP STYLES
   Theme: Eco-Luxury Artisan (Forest Emerald, Champagne Gold, Glassmorphism)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sarabun:wght@300;400;600&display=swap');

:root {
  --bg-dark: #06120D;
  --forest-deep: #0B1F16;
  --forest-light: #163E2D;
  --gold-glow: #FCE196;
  --gold-main: #D4AF37;
  --gold-dark: #916F22;
  --white-pure: #FFFFFF;
  --white-muted: #D1DDD6;
  --glass-bg: rgba(9, 24, 17, 0.78);
  --glass-border: rgba(212, 175, 55, 0.35);
  --glass-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--white-pure);
  user-select: none;
}

#ar-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* -------------------------------------------------------------
   Backgrounds: Camera Stream & Simulation Mode
   ------------------------------------------------------------- */
#camera-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  display: none; /* activated when user switches to real camera */
  transform: scaleX(-1); /* mirror front camera or auto-adapt */
}

.simulated-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(circle at 50% 30%, #153828 0%, #0B1D15 50%, #040A07 100%);
  overflow: hidden;
}

/* Atmospheric Mountain Silhouette in Simulation Mode */
.simulated-bg::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, transparent 0%, rgba(4, 10, 7, 0.8) 100%),
              radial-gradient(ellipse at 50% 120%, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* Three.js Canvas */
#webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
}

#webgl-canvas:active {
  cursor: grabbing;
}

/* -------------------------------------------------------------
   3D Projected World Hotspot Pins
   ------------------------------------------------------------- */
.ar-pin {
  position: absolute;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease, transform 0.2s ease;
  display: none; /* Synced by script */
}

.pin-bubble {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--gold-main);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 10px rgba(212, 175, 55, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-glow);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  animation: pulsePin 2.5s infinite ease-in-out;
}

.pin-bubble:hover {
  transform: scale(1.08);
  border-color: var(--white-pure);
}

@keyframes pulsePin {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 8px rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 18px rgba(212, 175, 55, 0.6); }
}

.pin-dot {
  width: 7px;
  height: 7px;
  background: var(--gold-glow);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-glow);
}

/* -------------------------------------------------------------
   AR HUD Overlay (Layer 3)
   ------------------------------------------------------------- */
.ar-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px 24px;
}

.hud-interactive {
  pointer-events: auto;
}

/* Topbar */
.hud-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.brand-badge {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  padding: 8px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--glass-shadow);
}

.brand-badge .icon {
  font-size: 22px;
}

.brand-badge .text-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-glow);
  letter-spacing: 1px;
}

.brand-badge .text-sub {
  font-size: 9.5px;
  color: var(--white-muted);
  letter-spacing: 0.5px;
  display: block;
}

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

.btn-hud-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--glass-shadow);
}

.btn-hud-icon:hover {
  transform: translateY(-2px);
  background: rgba(22, 62, 45, 0.9);
  border-color: var(--gold-glow);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.btn-hud-icon.active {
  background: var(--gold-main);
  color: var(--bg-dark);
}

/* Status Tracking Pill */
.tracking-pill {
  margin-top: 10px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 5px 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--white-pure);
  box-shadow: var(--glass-shadow);
}

.tracking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981;
  animation: pulseDot 2s infinite ease-in-out;
}

.tracking-pill.searching .tracking-dot {
  background: #F59E0B;
  box-shadow: 0 0 10px #F59E0B;
}

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

/* -------------------------------------------------------------
   Center Scanning Reticle Overlay (Camera Mode Target Lock)
   ------------------------------------------------------------- */
.scanner-reticle-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scanner-reticle-overlay.visible {
  opacity: 1;
}

.reticle-box {
  width: 100%;
  height: 100%;
  position: relative;
  border: 1px dashed rgba(212, 175, 55, 0.4);
  border-radius: 16px;
}

.reticle-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--gold-glow);
  border-style: solid;
  border-width: 0;
}

.rc-tl { top: -2px; left: -2px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 14px; }
.rc-tr { top: -2px; right: -2px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 14px; }
.rc-bl { bottom: -2px; left: -2px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 14px; }
.rc-br { bottom: -2px; right: -2px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 14px; }

.scanner-laser {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-glow), transparent);
  box-shadow: 0 0 12px var(--gold-glow);
  animation: laserScan 2.4s infinite ease-in-out;
}

@keyframes laserScan {
  0% { top: 5%; opacity: 0.2; }
  50% { top: 90%; opacity: 1; }
  100% { top: 5%; opacity: 0.2; }
}

.reticle-hint {
  text-align: center;
  margin-top: 14px;
  font-size: 11px;
  color: var(--gold-glow);
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  font-weight: 500;
}

/* -------------------------------------------------------------
   Audio Caption & Subtitles Bar
   ------------------------------------------------------------- */
.hud-caption-bar {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glass-shadow);
  pointer-events: auto;
}

.sound-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.sound-bar {
  width: 3px;
  height: 100%;
  background: var(--gold-main);
  border-radius: 3px;
  animation: soundBeat 1.2s infinite ease-in-out;
}

.sound-bar:nth-child(1) { animation-delay: 0.0s; height: 40%; }
.sound-bar:nth-child(2) { animation-delay: 0.2s; height: 80%; }
.sound-bar:nth-child(3) { animation-delay: 0.4s; height: 100%; }
.sound-bar:nth-child(4) { animation-delay: 0.1s; height: 60%; }

.sound-waves.paused .sound-bar {
  animation: none;
  height: 25% !important;
}

@keyframes soundBeat {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1.0); }
}

.caption-text {
  flex-grow: 1;
  font-size: 12px;
  line-height: 1.45;
  color: #F3F4F6;
}

.caption-time {
  font-size: 10px;
  color: var(--gold-glow);
  font-family: monospace;
}

/* -------------------------------------------------------------
   Bottom Category Navigation Bar
   ------------------------------------------------------------- */
.hud-bottom-nav {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--glass-border);
  border-radius: 28px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 6px;
  box-shadow: var(--glass-shadow);
  pointer-events: auto;
}

.nav-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 18px;
  background: transparent;
  border: none;
  color: var(--white-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab-btn .tab-icon {
  font-size: 20px;
  transition: transform 0.2s;
}

.nav-tab-btn .tab-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.nav-tab-btn:hover {
  color: var(--white-pure);
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(22, 62, 45, 0.5));
  border: 1px solid var(--gold-main);
  color: var(--gold-glow);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}

.nav-tab-btn.active .tab-icon {
  transform: scale(1.15);
}

/* Floating Quick Controls (Side Right) */
.hud-side-controls {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.btn-floating-tool {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--gold-glow);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--glass-shadow);
  transition: all 0.2s ease;
}

.btn-floating-tool:hover {
  transform: scale(1.1);
  border-color: var(--white-pure);
  background: rgba(22, 62, 45, 0.9);
}

/* -------------------------------------------------------------
   Bottom Sheet Drawer Modal (Progressive Disclosure)
   ------------------------------------------------------------- */
.ar-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ar-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.ar-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 85vh;
  background: linear-gradient(180deg, #0E291D 0%, #081710 100%);
  border-top: 2px solid var(--gold-main);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7);
  z-index: 60;
  transform: translateY(105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ar-drawer.active {
  transform: translateY(0);
}

.drawer-drag-handle {
  width: 44px;
  height: 5px;
  background: rgba(212, 175, 55, 0.5);
  border-radius: 4px;
  margin: 12px auto 6px;
  cursor: grab;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.drawer-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  color: var(--gold-glow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-drawer-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #D1D5DB;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-drawer-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.drawer-body {
  padding: 20px 24px 36px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #E2E8F0;
  line-height: 1.6;
}

/* Drawer Section Content Cards */
.drawer-content-pane {
  display: none;
}

.drawer-content-pane.active {
  display: block;
  animation: fadeInPane 0.3s ease;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.info-hero-card {
  background: rgba(22, 62, 45, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.info-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.stat-metric-card {
  background: rgba(8, 23, 16, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-metric-card .stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-glow);
  font-family: 'Cinzel', serif;
}

.stat-metric-card .stat-lbl {
  font-size: 11px;
  color: #A0AEC0;
  margin-top: 4px;
}

/* Interactive Drip Brewing Steps */
.brewing-step-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}

.brew-step {
  display: flex;
  gap: 14px;
  background: rgba(8, 23, 16, 0.5);
  border-left: 3px solid var(--gold-main);
  border-radius: 8px;
  padding: 12px 14px;
  align-items: flex-start;
}

.step-num {
  background: var(--gold-main);
  color: var(--bg-dark);
  font-weight: 800;
  font-size: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc h4 {
  font-size: 13px;
  color: var(--gold-glow);
  margin-bottom: 3px;
}

.step-desc p {
  font-size: 11.5px;
  color: #CBD5E1;
}

/* CTA Community Reorder Card */
.community-cta-box {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(22, 62, 45, 0.7));
  border: 1.5px solid var(--gold-main);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-top: 10px;
}

.btn-cta-gold {
  background: linear-gradient(135deg, var(--gold-glow), var(--gold-main));
  color: var(--bg-dark);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.4);
  transition: all 0.2s ease;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-cta-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.7);
}

/* -------------------------------------------------------------
   Responsive Breakpoints
   ------------------------------------------------------------- */
@media (max-width: 600px) {
  .ar-hud {
    padding: 12px 14px 18px;
  }
  .hud-bottom-nav {
    border-radius: 22px;
    padding: 4px 6px;
  }
  .nav-tab-btn .tab-label {
    font-size: 9.5px;
  }
  .info-grid-2col {
    grid-template-columns: 1fr;
  }
  .brand-badge .text-title {
    font-size: 11px;
  }
  .brand-badge .text-sub {
    font-size: 8px;
  }
}
