/**
 * WebAR Menu - AR Experience Styles
 * Modern, responsive styling for AR restaurant menu
 */

:root {
  --primary-color: #1a1a2e;
  --secondary-color: #16213e;
  --accent-color: #e94560;
  --accent-hover: #d63650;
  --background: #0f0f1a;
  --surface: #1a1a2e;
  --surface-elevated: #232342;
  --text-primary: #ffffff;
  --text-secondary: #b8b8d0;
  --text-muted: #8888a0;
  --border-color: #2d2d4a;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
  --z-loading: 1000;
  --z-ui: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .side-menu {
  left: auto;
  right: 0;
  transform: translateX(320px);
}

[dir="rtl"] .side-menu.open {
  transform: translateX(0);
}

[dir="rtl"] .settings-panel {
  right: auto;
  left: 0;
  transform: translateX(-320px);
}

[dir="rtl"] .settings-panel.open {
  transform: translateX(0);
}

[dir="rtl"] .category-scroll {
  direction: rtl;
}

[dir="rtl"] .dishes-list {
  direction: rtl;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  touch-action: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

svg {
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-loading);
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-content {
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.loading-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  color: var(--accent-color);
}

.loading-spinner {
  width: 100%;
  height: 100%;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 24px;
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto 12px;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #ff6b7a);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.loading-percent {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   AR SCENE CONTAINER
   ============================================ */
.ar-scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--background);
}

.ar-scene[hidden] {
  display: none;
}

/* A-Frame canvas */
#ar-scene-element canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ============================================
   UI OVERLAY
   ============================================ */
.ui-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-ui);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
  padding: 8px 16px;
}

.restaurant-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.restaurant-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--surface);
}

.restaurant-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.restaurant-name {
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.restaurant-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  border: 1px solid var(--border-color);
}

.icon-btn:hover,
.icon-btn:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1.05);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ============================================
   AR INSTRUCTIONS
   ============================================ */
.ar-instructions {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  gap: 16px;
  padding: 24px;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.ar-instructions.hidden {
  opacity: 0;
  pointer-events: none;
}

.instruction-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 28px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 280px;
  text-align: center;
  opacity: 1;
  transform: scale(1);
  transition: all var(--transition-normal);
}

.instruction-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-color), #ff6b7a);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.instruction-icon::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.surface-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
}

.tap-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z'/%3E%3C/svg%3E");
}

.gesture-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
}

.instruction-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.instruction-animation {
  width: 60px;
  height: 60px;
  opacity: 0.6;
}

.surface-animation {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23e94560' stroke-width='3' stroke-dasharray='200' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='360 50 50' dur='2s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center/contain no-repeat;
  animation: pulse 2s ease-in-out infinite;
}

.tap-animation {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='30' fill='%23e94560' opacity='0.3'%3E%3Canimate attributeName='r' from='10' to='40' dur='1s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' from='0.6' to='0' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center/contain no-repeat;
}

.gesture-animation {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg stroke='%23e94560' stroke-width='3' fill='none'%3E%3Cpath d='M30 50 Q50 30 70 50'%3E%3CanimateTransform attributeName='transform' type='translate' values='0 0;20 0;0 0' dur='2s' repeatCount='indefinite'/%3E%3C/path%3E%3Cpath d='M30 50 Q50 70 70 50'%3E%3CanimateTransform attributeName='transform' type='translate' values='0 0;-20 0;0 0' dur='2s' repeatCount='indefinite'/%3E%3C/path%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ============================================
   DISH INFO PANEL
   ============================================ */
.dish-info-panel {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  max-width: 400px;
  margin: 0 auto;
  z-index: var(--z-ui);
  pointer-events: auto;
  background: rgba(26, 26, 46, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(50px);
  opacity: 0;
}

.dish-info-panel.hidden {
  display: none;
}

.dish-header {
  display: flex;
  gap: 16px;
  padding: 20px;
}

.dish-thumbnail {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}

.dish-details {
  flex: 1;
  min-width: 0;
}

.dish-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.dish-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.dish-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dish-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-color);
  font-family: 'Playfair Display', serif;
}

.dish-category {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--surface);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-transform: capitalize;
}

.dish-actions {
  display: flex;
  gap: 12px;
  padding: 0 20px 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  flex: 1;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-primary:hover,
.btn-primary:active {
  background: var(--surface-elevated);
  border-color: var(--accent-color);
}

.btn-accent {
  background: var(--accent-color);
  color: white;
}

.btn-accent:hover,
.btn-accent:active {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover,
.btn-secondary:active {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.dish-nutrition {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

.dish-nutrition h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.nutrition-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--surface);
  border-radius: var(--radius-md);
}

.nutrition-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.nutrition-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   CATEGORY SELECTOR
   ============================================ */
.category-selector {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  z-index: var(--z-ui);
  pointer-events: auto;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
}

.category-selector.hidden {
  display: none;
}

.category-scroll {
  display: flex;
  gap: 8px;
  padding: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.category-btn:hover,
.category-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.category-icon {
  font-size: 1.125rem;
}

.category-count {
  font-size: 0.6875rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

.category-btn.active .category-count {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   BOTTOM CONTROLS
   ============================================ */
.bottom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  pointer-events: auto;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.control-btn:hover,
.control-btn:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1.1);
}

.control-btn svg {
  width: 24px;
  height: 24px;
}

.capture-btn {
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

.capture-btn:hover,
.capture-btn:active {
  background: var(--accent-hover);
  box-shadow: 0 6px 28px rgba(233, 69, 96, 0.5);
}

/* ============================================
   SIDE MENU
   ============================================ */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 100vw;
  z-index: var(--z-ui);
  background: var(--surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transform: translateX(-320px);
  transition: transform var(--transition-normal);
  pointer-events: auto;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.side-menu-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.close-btn:hover,
.close-btn:active {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.close-btn svg {
  width: 22px;
  height: 22px;
}

.side-menu-search {
  position: relative;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.side-menu-search input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.side-menu-search input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.side-menu-search input::placeholder {
  color: var(--text-muted);
}

.side-menu-search svg {
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

[dir="rtl"] .side-menu-search svg {
  left: auto;
  right: 36px;
}

.category-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.category-tab:hover,
.category-tab.active {
  background: var(--accent-color);
  color: white;
}

.dishes-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.no-dishes {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.dish-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  animation: slideIn 0.3s ease forwards;
  opacity: 0;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

[dir="rtl"] .dish-item {
  animation: slideInRTL 0.3s ease forwards;
}

@keyframes slideInRTL {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.dish-image {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
}

.dish-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

[dir="rtl"] .featured-badge {
  right: auto;
  left: 4px;
}

.dish-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dish-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dish-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dish-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-color);
  font-family: 'Playfair Display', serif;
}

.btn-view-ar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-view-ar:hover,
.btn-view-ar:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.btn-view-ar svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 100vw;
  z-index: var(--z-ui);
  background: var(--surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transform: translateX(320px);
  transition: transform var(--transition-normal);
  pointer-events: auto;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.settings-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.setting-section {
  margin-bottom: 28px;
}

.setting-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setting-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-option:hover {
  border-color: var(--accent-color);
}

.radio-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-custom {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.radio-option input:checked + .radio-custom {
  border-color: var(--accent-color);
}

.radio-option input:checked + .radio-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--accent-color);
  border-radius: 50%;
}

.radio-option span:last-child {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-option:hover {
  border-color: var(--accent-color);
}

.toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-custom {
  width: 48px;
  height: 28px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.toggle-custom::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.toggle-option input:checked + .toggle-custom {
  background: var(--accent-color);
}

.toggle-option input:checked + .toggle-custom::after {
  transform: translateX(20px);
}

.toggle-option span:last-child {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.setting-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 20px;
  padding-right: 48px;
  cursor: pointer;
}

.setting-select:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.modal-close:hover,
.modal-close:active {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.modal-close svg {
  width: 22px;
  height: 22px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.help-step {
  display: flex;
  gap: 16px;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.step-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-gestures h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.gesture-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gesture-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.gesture-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-color), #ff6b7a);
  flex-shrink: 0;
}

.gesture-icon::before {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  margin: 8px auto;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.pinch-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
}

.drag-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v0M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2'/%3E%3C/svg%3E");
}

.tap-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z'/%3E%3C/svg%3E");
}

.two-finger-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3Ccircle cx='18' cy='12' r='3'/%3E%3C/svg%3E");
}

.gesture-item span {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* ============================================
   CAPTURE PREVIEW
   ============================================ */
.capture-preview {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.capture-preview.hidden {
  display: none;
}

.capture-content {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.capture-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.capture-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 90vw;
  pointer-events: auto;
  animation: toastIn 0.4s ease forwards;
}

.toast-success {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
}

.toast-error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.toast-info {
  border-color: var(--accent-color);
  background: rgba(233, 69, 96, 0.15);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: #22c55e; }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: var(--accent-color); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(300px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .top-bar {
    padding: 8px 12px;
  }
  
  .restaurant-details {
    display: none;
  }
  
  .category-scroll {
    padding: 12px;
  }
  
  .category-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
  }
  
  .bottom-controls {
    gap: 8px;
    padding: 12px;
  }
  
  .control-btn {
    width: 48px;
    height: 48px;
  }
  
  .control-btn svg {
    width: 22px;
    height: 22px;
  }
  
  .dish-header {
    padding: 16px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .dish-thumbnail {
    width: 64px;
    height: 64px;
  }
  
  .dish-actions {
    padding: 0 16px 16px;
    flex-direction: column;
  }
  
  .nutrition-grid {
    gap: 6px;
  }
  
  .nutrition-item {
    padding: 10px 6px;
  }
  
  .nutrition-value {
    font-size: 0.875rem;
  }
  
  .nutrition-label {
    font-size: 0.625rem;
  }
  
  .side-menu,
  .settings-panel {
    width: 100vw;
    transform: translateX(-100vw);
  }
  
  .side-menu.open,
  .settings-panel.open {
    transform: translateX(0);
  }
  
  [dir="rtl"] .side-menu {
    transform: translateX(100vw);
  }
  
  [dir="rtl"] .side-menu.open {
    transform: translateX(0);
  }
  
  [dir="rtl"] .settings-panel {
    transform: translateX(-100vw);
  }
  
  [dir="rtl"] .settings-panel.open {
    transform: translateX(0);
  }
  
  .modal-content {
    margin: 12px;
    max-height: calc(100vh - 24px);
  }
  
  .capture-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .capture-actions .btn {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .category-selector {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
  }
  
  .category-selector.hidden {
    display: none;
  }
  
  .dish-info-panel {
    max-width: 480px;
  }
  
  .bottom-controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border-color: #ffffff;
    --text-secondary: #ffffff;
    --text-muted: #cccccc;
  }
  
  .icon-btn,
  .control-btn,
  .category-btn,
  .btn-view-ar {
    border-width: 2px;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .ui-overlay,
  .bottom-controls,
  .side-menu,
  .settings-panel,
  .modal,
  .capture-preview,
  .toast-container {
    display: none !important;
  }
  
  .ar-scene {
    position: static;
    height: auto;
  }
}