/* ============================================================================
   CHIRI FOOD - Unified Design System
   Cho: order.html, order-admin.html, order-kitchen.html, admin-order.html
   Phong cách: Gaming/iPhone - Glass morphism + Neon + Spring animation
   ============================================================================ */

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

/* =========================================================
   DESIGN TOKENS
   ========================================================= */
:root {
  /* ==== Colors - Neon + Glass ==== */
  --c-primary: #00f0ff;
  --c-accent: #ff006e;
  --c-gold: #ffd700;
  --c-success: #00ff88;
  --c-warning: #ff9800;
  --c-danger: #ff3b30;
  --c-info: #00a8ff;
  
  /* ==== Background ==== */
  --bg-base: #0a0a1a;
  --bg-deep: #050510;
  --bg-surface: #12122a;
  --bg-elevated: #1a1a2e;
  --bg-hover: #232338;
  
  /* ==== Glass ==== */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: 24px;
  
  /* ==== Text ==== */
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-tertiary: #6a6a80;
  
  /* ==== Borders ==== */
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  
  /* ==== Fonts ==== */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* ==== Radius ==== */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-full: 100px;
  
  /* ==== Shadows ==== */
  --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);
  --shadow-glow-primary: 0 0 24px rgba(0, 240, 255, 0.4);
  --shadow-glow-accent: 0 0 24px rgba(255, 0, 110, 0.4);
  --shadow-glow-gold: 0 0 24px rgba(255, 215, 0, 0.4);
  
  /* ==== Safe area ==== */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* =========================================================
   RESET + BASE
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  padding-top: var(--safe-top);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--c-primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* =========================================================
   UTILITY
   ========================================================= */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-gold { color: var(--c-gold); }
.text-primary { color: var(--c-primary); }
.text-success { color: var(--c-success); }
.text-danger { color: var(--c-danger); }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* =========================================================
   BACKGROUND PARTICLES
   ========================================================= */
.chiri-bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(circle at 15% 20%, rgba(0, 240, 255, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(255, 0, 110, 0.08) 0%, transparent 45%);
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 20px) scale(1.05); }
}

/* =========================================================
   HEADER - Glass morphism
   ========================================================= */
.chiri-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  background: rgba(10, 10, 26, 0.75);
  border-bottom: 1px solid var(--glass-border);
  padding: 12px 16px;
}

.chiri-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

.chiri-header-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--c-gold);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chiri-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Primary - Gradient neon */
.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #0a0a1a;
  box-shadow: var(--shadow-glow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(0, 240, 255, 0.6);
}

/* Secondary - Glass */
.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}

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

/* Gold */
.btn-gold {
  background: linear-gradient(135deg, var(--c-gold), #f9a825);
  color: #1a1a2e;
  box-shadow: var(--shadow-glow-gold);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(255, 215, 0, 0.6);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, var(--c-danger), #e02a20);
  color: #fff;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(255, 59, 48, 0.5);
}

/* Success */
.btn-success {
  background: linear-gradient(135deg, var(--c-success), #00a854);
  color: #0a0a1a;
}

/* Icon button */
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Sizes */
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 20px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-md);
  transition: all 0.3s;
}

.card:hover {
  border-color: rgba(0, 240, 255, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.card-body { padding: 0; }
.card-footer {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

/* =========================================================
   STATS GRID
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--c-primary);
  box-shadow: var(--shadow-glow-primary);
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--c-gold);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}

.table thead {
  background: rgba(0, 0, 0, 0.4);
}

.table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(0, 240, 255, 0.03); }

.table img {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  object-fit: cover;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-primary {
  background: rgba(0, 240, 255, 0.15);
  color: var(--c-primary);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.badge-gold {
  background: rgba(255, 215, 0, 0.15);
  color: var(--c-gold);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-success {
  background: rgba(0, 255, 136, 0.15);
  color: var(--c-success);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-warning {
  background: rgba(255, 152, 0, 0.15);
  color: var(--c-warning);
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-danger {
  background: rgba(255, 59, 48, 0.15);
  color: var(--c-danger);
  border: 1px solid rgba(255, 59, 48, 0.3);
}

.badge-muted {
  background: rgba(160, 160, 192, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(160, 160, 192, 0.2);
}

/* =========================================================
   INPUTS / FORMS
   ========================================================= */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.1);
}

.form-input::placeholder { color: var(--text-tertiary); }

/* =========================================================
   MODAL - Bottom sheet on mobile, centered on desktop
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-gold);
  margin-bottom: 20px;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

/* =========================================================
   BOTTOM SHEET (iOS style)
   ========================================================= */
.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: rgba(15, 15, 30, 0.98);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.7);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200;
  padding-bottom: var(--safe-bottom);
}

.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-tertiary);
  margin: 12px auto 8px;
  opacity: 0.5;
}

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  top: calc(80px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 14px 24px;
  border-radius: var(--r-full);
  background: rgba(20, 20, 40, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--c-primary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-glow-primary);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-color: var(--c-success); box-shadow: 0 0 24px rgba(0, 255, 136, 0.5); }
.toast.error { border-color: var(--c-danger); box-shadow: 0 0 24px rgba(255, 59, 48, 0.5); }

/* =========================================================
   TAB / PILL navigation
   ========================================================= */
.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: var(--r-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  white-space: nowrap;
}

.tab:active { transform: scale(0.94); }

.tab.active {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #0a0a1a;
  border-color: transparent;
  box-shadow: var(--shadow-glow-primary);
}

/* =========================================================
   SIDEBAR (cho admin desktop)
   ========================================================= */
.layout-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--bg-base);
}

.sidebar {
  background: rgba(10, 10, 26, 0.95);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 24px 20px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--c-gold);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 240, 255, 0.08);
  color: var(--c-primary);
  border-left-color: var(--c-primary);
  font-weight: 700;
}

.nav-item span:first-child {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  /* Sidebar → Bottom nav */
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 6px 0 calc(6px + var(--safe-bottom));
    border-right: none;
    border-top: 1px solid var(--border);
    background: rgba(10, 10, 26, 0.98);
    backdrop-filter: blur(20px);
    z-index: 100;
    overflow-x: auto;
  }
  
  .sidebar-logo { display: none; }
  
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 10px 4px;
    font-size: 10px;
    text-align: center;
    border-left: none;
    border-top: 3px solid transparent;
    justify-content: center;
    min-width: 72px;
  }
  
  .nav-item span:first-child {
    font-size: 22px;
    width: auto;
  }
  
  .nav-item.active {
    border-left: none;
    border-top-color: var(--c-primary);
  }
  
  .main-content {
    padding: 16px 16px 90px;
  }
  
  /* Modal → Bottom sheet */
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .modal-content {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  
  @keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  
  /* Stats grid 2 cột */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .stat-value { font-size: 22px; }
  
  /* Table scroll ngang */
  .table-wrap {
    margin: 0 -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .table th, .table td {
    padding: 12px;
    font-size: 12px;
  }
  
  .table img {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 400px) {
  .stat-value { font-size: 20px; }
  .stat-card { padding: 14px; }
  .main-content { padding: 12px 12px 90px; }
}
