/* Transparent White Glassmorphism WebAR Experience Design System */
:root {
  --bg-main: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.18), 0 2px 8px 0 rgba(255, 255, 255, 0.4) inset;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.35);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --text-main: #0f172a;
  --text-muted: #334155;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  font-family: var(--font-family);
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text-main);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Transparent White Glassmorphism Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  color: var(--text-main);
}

/* Bottom Floating Navigation & Status Bar */
#app-header {
  position: absolute;
  bottom: 50px;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  width: min(92%, 520px);
  justify-content: space-between;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.brand-badge i {
  color: var(--primary);
  font-size: 1.25rem;
}

/* Status Pill Indicator */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: var(--text-main);
  transition: var(--transition-fast);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: pulse-dot 1.5s infinite alternate;
}

.status-pill.searching .status-dot {
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}

.status-pill.tracking .status-dot {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.status-pill.orbit .status-dot {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

@keyframes pulse-dot {
  0% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.2); }
}

/* Camera Reticle & Translucent QR Target Overlay */
#scanning-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 230px;
  height: 330px;
  pointer-events: none;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

#scanning-reticle.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.reticle-corner {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 4px solid var(--primary);
  transition: var(--transition-fast);
}

.reticle-top-left { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 12px 0 0 0; }
.reticle-top-right { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 12px 0 0; }
.reticle-bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 12px; }
.reticle-bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 12px 0; }

/* Translucent Card Border Target Preview Overlay inside scanning frame */
.qr-target-preview-wrapper {
  width: 195px;
  height: 290px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(56, 189, 248, 0.7);
  animation: pulse-qr 2.5s infinite alternate ease-in-out;
}

.qr-target-preview-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  opacity: 0.85;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  border-radius: 8px;
}

@keyframes pulse-qr {
  0% { opacity: 0.75; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.02); }
}

.reticle-line {
  position: absolute;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: scan-beam 2.2s ease-in-out infinite alternate;
  box-shadow: 0 0 12px var(--primary);
}

@keyframes scan-beam {
  0% { top: 10%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 90%; opacity: 0.3; }
}

.scanning-label {
  position: absolute;
  bottom: -44px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.scanning-label i {
  color: var(--primary);
}

/* Bottom Interactive Floating Control Toolbar */
#control-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 36px;
}

.btn-icon {
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--primary);
  transform: translateY(-2px);
  color: var(--primary);
}

.btn-icon:active {
  transform: scale(0.95);
}

.btn-icon.active {
  background: var(--primary);
  border-color: var(--glass-border);
  color: white;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
}

.btn-pill {
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.15);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-pill:hover {
  background: var(--glass-bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

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

.btn-primary-lg {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  width: 100%;
  justify-content: center;
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  cursor: pointer;
}

.btn-primary-lg:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
}

/* Modals & Guidance Card */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0f172a 0%, #070a14 100%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.modal-card {
  width: min(90%, 420px);
  padding: 32px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.modal-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}

/* 3D Orbit Canvas Fallback container */
#orbit-canvas-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
}

#orbit-canvas-container.active {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  #app-header {
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .brand-badge {
    font-size: 0.95rem;
  }

  #control-bar {
    gap: 6px;
    padding: 6px 10px;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .btn-pill {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  #scanning-reticle {
    width: 220px;
    height: 220px;
  }

  .qr-target-preview-wrapper {
    width: 170px;
    height: 170px;
  }
}

/* Ensure the A-Frame canvas and scene are transparent so the camera feed is visible */
a-scene,
.a-canvas {
  background-color: transparent !important;
  background: transparent !important;
}
