/* ============================================
   AR Menu — Photogrammetry 360° Studio UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #121214;
  --bg-card: #1a1a1f;
  --bg-card-hover: #222228;
  --bg-glass: rgba(26, 26, 31, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.85);

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent-primary: #f59e0b;
  --accent-secondary: #f97316;
  --accent-gradient: linear-gradient(135deg, #f97316, #f59e0b, #eab308);
  --accent-glow: rgba(249, 115, 22, 0.35);

  --danger: #ef4444;
  --success: #22c55e;
  --badge-bg: rgba(245, 158, 11, 0.15);
  --badge-text: #f59e0b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(249, 115, 22, 0.3);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--accent-glow);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  padding: var(--space-md) 0 var(--space-lg);
}

.header__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.header__icon {
  font-size: 26px;
}

.header__name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header__tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header__divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  margin-top: var(--space-md);
}

.add-item-btn {
  background: var(--accent-gradient);
  color: #000;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s ease;
}

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

/* Section Title & Tabs */
.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.section-title__icon { font-size: 18px; }
.section-title__text { font-size: 18px; font-weight: 700; }
.section-title__count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.category-tabs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}

.category-tab {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.category-tab.active {
  background: var(--accent-gradient);
  color: #000;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* Product Card Grid */
.product-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  position: relative;
}

.product-card__viewer {
  position: relative;
  width: 100%;
  height: 280px;
  background: var(--bg-secondary);
}

model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  --progress-bar-color: var(--accent-primary);
  outline: none;
}

.product-card__badge {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 3;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.product-card__delete {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 4;
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  backdrop-filter: blur(8px);
}

.product-card__body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.product-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.product-card__name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.product-card__price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-primary);
}

.product-card__description {
  font-size: 14px;
  color: var(--text-secondary);
}

.product-card__dimensions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
}

.ar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 14px var(--space-md);
  background: var(--accent-gradient);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s ease;
}

.ar-cta:active {
  transform: scale(0.97);
}

.mv-ar-button {
  background: var(--accent-gradient);
  color: #000;
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: 10;
}

/* Modal Overlay & Photogrammetry Full View */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  padding: var(--space-lg);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card--full {
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modal-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  font-size: 24px;
  color: var(--text-muted);
  padding: 4px 8px;
}

/* Photogrammetry Studio Viewfinder */
.photo-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.photo-guide-banner {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid var(--border-accent);
  color: var(--accent-primary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-md);
}

.photogrammetry-viewfinder {
  position: relative;
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#photo-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 360 Degree Target Ring Overlay */
.ring-360-container {
  position: absolute;
  width: 220px;
  height: 220px;
  pointer-events: none;
}

.ring-360-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 3;
}

.ring-progress {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 276;
  stroke-dashoffset: 276;
  transition: stroke-dashoffset 0.4s ease;
}

.ring-node {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
}

.ring-node.captured {
  background: var(--success);
  border-color: var(--success);
  color: #000;
}

.ring-node.active {
  background: var(--accent-primary);
  border-color: #fff;
  color: #000;
  box-shadow: 0 0 10px var(--accent-primary);
}

.angle-0 { top: 10%; left: 50%; }
.angle-45 { top: 22%; left: 78%; }
.angle-90 { top: 50%; left: 90%; }
.angle-135 { top: 78%; left: 78%; }
.angle-180 { top: 90%; left: 50%; }
.angle-225 { top: 78%; left: 22%; }
.angle-270 { top: 50%; left: 10%; }
.angle-315 { top: 22%; left: 22%; }

.capture-badge {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: #fff;
}

/* Thumbnails Strip */
.photo-thumbnails-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: var(--space-md) 0;
  min-height: 70px;
}

.thumb-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--accent-primary);
  flex-shrink: 0;
}

/* Shutter Button */
.photogrammetry-controls {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.btn-shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 4px;
  transition: transform 0.15s ease;
}

.btn-shutter:active { transform: scale(0.92); }

.btn-shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ef4444;
}

/* Processing Stage */
.processing-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-md);
}

.processing-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.process-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--space-md) 0;
}

.process-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.4s ease;
}

.processing-log {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  width: 100%;
  text-align: left;
}

.success-banner {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-md);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  color: #000;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-secondary {
  padding: 14px var(--space-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  border-radius: var(--radius-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row .form-group { flex: 1; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

input, select, textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.footer {
  text-align: center;
  padding: var(--space-xl) 0;
  font-size: 12px;
  color: var(--text-muted);
}
