/* ==========================================================================
   LenzuraArt WebAR Viewer Stylesheet
   ========================================================================== */

:root {
  --primary-color: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.5);
  --bg-dark: #090d16;
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-full: 9999px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   AR Viewport (Camera Feed & Three.js Canvas)
   -------------------------------------------------------------------------- */
#ar-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

#camera-feed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
}

#webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background: transparent !important;
}

/* --------------------------------------------------------------------------
   Header Navigation HUD (Minimalist)
   -------------------------------------------------------------------------- */
#viewer-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  background: transparent;
  pointer-events: none;
}

#viewer-header > * {
  pointer-events: auto;
}

.header-brand .brand-text {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
}

.hud-btn-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.hud-btn-circle:hover {
  background: rgba(30, 41, 59, 0.9);
  transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   Floating Bottom Info Pill & Modal
   -------------------------------------------------------------------------- */
.floating-info-pill {
  position: absolute;
  bottom: 24px;
  right: 20px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
}

.floating-info-pill i {
  color: var(--accent-cyan);
  font-size: 14px;
}

.floating-info-pill:hover {
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(6, 182, 212, 0.5);
}

.info-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.info-modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.info-modal-card {
  position: relative;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-slide-up {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --------------------------------------------------------------------------
   Scan Overlay & Reticle Frame
   -------------------------------------------------------------------------- */
#scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#scan-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.reticle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.reticle-frame {
  position: relative;
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  border-radius: 24px;
}

.corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--accent-cyan);
  border-style: solid;
  filter: drop-shadow(0 0 8px var(--accent-cyan-glow));
}

.corner-tl {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 18px;
}

.corner-tr {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 18px;
}

.corner-bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 18px;
}

.corner-br {
  bottom: 0;
  right: 0;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 18px;
}

.scan-laser {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-cyan) 50%, transparent 100%);
  box-shadow: 0 0 12px var(--accent-cyan);
  animation: laser-scan 2.4s ease-in-out infinite alternate;
  border-radius: 2px;
}

@keyframes laser-scan {
  0% {
    top: 5%;
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    top: 95%;
    opacity: 0.3;
  }
}

.reticle-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.reticle-caption i {
  color: var(--accent-cyan);
  font-size: 18px;
}

.reticle-caption p {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.reticle-caption span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Locked / Tracking State */
#scan-overlay.locked .corner {
  border-color: #10b981;
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.8));
}

#scan-overlay.locked .scan-laser {
  display: none;
}

#scan-overlay.locked .reticle-caption {
  border-color: rgba(16, 185, 129, 0.5);
}

#scan-overlay.locked .reticle-caption i {
  color: #10b981;
}

#scan-overlay.locked .reticle-caption p {
  color: #a7f3d0;
}

/* --------------------------------------------------------------------------
   Target Found Banner
   -------------------------------------------------------------------------- */
#target-found-banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  z-index: 15;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: banner-pop 0.4s ease-out;
}

#target-found-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -20px);
  pointer-events: none;
}

@keyframes banner-pop {
  0% { transform: translate(-50%, -20px) scale(0.9); opacity: 0; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Artwork Info Actions & Meta
   -------------------------------------------------------------------------- */
.artwork-meta h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.artwork-meta p#info-artwork-artist {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.artwork-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 16px;
  max-height: 60px;
  overflow-y: auto;
}

.artwork-actions {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-color), var(--accent-cyan));
  color: #fff;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: all 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-cyan-glow);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* --------------------------------------------------------------------------
   Desktop Test Simulator Drawer
   -------------------------------------------------------------------------- */
.sim-drawer {
  position: absolute;
  top: 70px;
  right: 20px;
  width: min(90vw, 360px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  z-index: 20;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sim-drawer.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.96);
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.sim-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.icon-btn:hover {
  color: #fff;
}

.sim-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.sim-preview-box {
  position: relative;
  width: 100%;
  height: 160px;
  background: #020617;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.sim-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sim-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.sim-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background: #4f46e5;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sim-artworks-list label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sim-artworks-list select {
  width: 100%;
  padding: 8px 12px;
  background: #0f172a;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

/* --------------------------------------------------------------------------
   Mobile Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  #viewer-header {
    padding: 12px 14px;
  }
  .hud-btn span {
    display: none;
  }
  .artwork-badge {
    max-width: 150px;
  }
  .artwork-info-drawer {
    padding: 12px 16px 20px 16px;
  }
}
