/* ============================================================
   DESIGN SYSTEM — QR MENU PRO
   Dark Premium Theme inspired by Toast POS / Majoo
   ============================================================ */

/* Fonts loaded via <link preload> in HTML for better performance */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --brand-primary: #FF6B35;
  --brand-primary-light: #FF8C5A;
  --brand-primary-dark: #E55A25;
  --brand-secondary: #FFB347;
  --brand-accent: #FF6B35;

  /* Dark UI Palette */
  --bg-base: #0D0D0F;
  --bg-surface: #161618;
  --bg-elevated: #1E1E21;
  --bg-card: #252528;
  --bg-hover: #2E2E32;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  /* Borders */
  --border-subtle: rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --border-brand: rgba(255, 107, 53, 0.4);

  /* Text */
  --text-primary: #F2F2F4;
  --text-secondary: #A0A0A8;
  --text-tertiary: #636368;
  --text-inverse: #0D0D0F;
  --text-brand: #FF6B35;

  /* Status Colors */
  --status-new: #3B82F6;
  --status-new-bg: rgba(59,130,246,0.12);
  --status-process: #F59E0B;
  --status-process-bg: rgba(245,158,11,0.12);
  --status-ready: #10B981;
  --status-ready-bg: rgba(16,185,129,0.12);
  --status-done: #6B7280;
  --status-done-bg: rgba(107,114,128,0.12);

  /* Semantic */
  --success: #10B981;
  --success-bg: rgba(16,185,129,0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245,158,11,0.1);
  --danger: #EF4444;
  --danger-bg: rgba(239,68,68,0.1);
  --info: #3B82F6;
  --info-bg: rgba(59,130,246,0.1);

  /* Typography */
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-brand: 0 4px 20px rgba(255,107,53,0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────────── */
.display-xl { font-family: var(--font-display); font-size: clamp(28px, 5vw, 48px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.display-lg { font-family: var(--font-display); font-size: clamp(22px, 4vw, 36px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.heading-lg { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.heading-md { font-size: 16px; font-weight: 600; }
.heading-sm { font-size: 14px; font-weight: 600; }
.body-lg { font-size: 16px; font-weight: 400; }
.body-md { font-size: 14px; font-weight: 400; }
.body-sm { font-size: 12px; font-weight: 400; }
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border: none; border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--transition-fast); text-decoration: none; white-space: nowrap;
  padding: 10px 20px; line-height: 1;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--brand-primary); color: white;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-primary-light); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #0D0D0F; }
.btn-warning:hover { background: #D97706; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radius-md); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover { border-color: var(--border-default); }
.card-elevated {
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.card-brand { border-color: var(--border-brand); }

/* ── Badges & Status Pills ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
}
.badge-new { background: var(--status-new-bg); color: var(--status-new); border: 1px solid rgba(59,130,246,0.25); }
.badge-process { background: var(--status-process-bg); color: var(--status-process); border: 1px solid rgba(245,158,11,0.25); }
.badge-ready { background: var(--status-ready-bg); color: var(--status-ready); border: 1px solid rgba(16,185,129,0.25); }
.badge-done { background: var(--status-done-bg); color: var(--status-done); border: 1px solid rgba(107,114,128,0.25); }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
  animation: pulse-dot 2s infinite;
}
.dot-new { background: var(--status-new); }
.dot-process { background: var(--status-process); }
.dot-ready { background: var(--status-ready); }
.dot-done { background: var(--status-done); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ── Form Elements ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: var(--font-body); font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-tertiary); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636368' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-textarea { resize: vertical; min-height: 90px; }

/* ── Loading ────────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px; border: 2px solid var(--border-default);
  border-top-color: var(--brand-primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%; border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: var(--space-3);
  z-index: 9999; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 380px; pointer-events: all;
  animation: slideIn 0.3s ease forwards;
}
.toast.removing { animation: slideOut 0.3s ease forwards; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: var(--space-4); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: all var(--transition-base);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  transform: scale(0.95); transition: transform var(--transition-base);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-6); border-bottom: 1px solid var(--border-subtle);
}
.modal-body { padding: var(--space-6); }
.modal-footer {
  display: flex; gap: var(--space-3); justify-content: flex-end;
  padding: var(--space-6); border-top: 1px solid var(--border-subtle);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Utility Classes ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-inline: var(--space-4); }
.py-3 { padding-block: var(--space-3); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-brand { color: var(--brand-primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border-subtle); }
.grid { display: grid; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceIn { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }

.animate-fade { animation: fadeIn 0.3s ease; }
.animate-up { animation: slideUp 0.3s ease; }
.animate-bounce { animation: bounceIn 0.4s ease; }

/* ── Responsive Helpers ─────────────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
