/* ═══════════════════════════════════════════════════════════════════
   Reasmey Samrab — Restaurant System Stylesheet
   Warm orange/red Khmer theme · Fully responsive
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
  --primary: #e85d04;
  --primary-dark: #d35400;
  --primary-light: #ff8c42;
  --accent: #c1121f;
  --accent-light: #e63946;
  --warm: #fff4e6;
  --warm-dark: #ffe0c2;
  --text: #2d2018;
  --text-light: #6b5a4e;
  --white: #ffffff;
  --bg: #fdf6f0;
  --shadow: 0 4px 20px rgba(232, 93, 4, 0.12);
  --shadow-lg: 0 8px 40px rgba(232, 93, 4, 0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 72px;
  --cart-w: 420px;
}

body {
  font-family: 'Segoe UI', 'Noto Sans Khmer', 'Hanuman', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

/* ─── Header ───────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.site-header .logo {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-header .logo span.kh {
  font-size: 1.1rem;
  color: var(--accent);
}

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

.cart-btn {
  position: relative;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-btn:hover { background: var(--primary-dark); transform: scale(1.04); }
.cart-btn .cart-count {
  background: var(--white);
  color: var(--primary);
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.admin-link {
  color: var(--text-light);
  font-size: 0.85rem;
  text-decoration: none;
}
.admin-link:hover { color: var(--primary); }

/* ─── Hero ─────────────────────────────────────────────────────────── */
.hero {
  margin-top: var(--header-h);
  height: 52vh;
  min-height: 340px;
  background: linear-gradient(135deg, #e85d04 0%, #c1121f 60%, #780000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -20%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 10px;
  text-shadow: 0 3px 12px rgba(0,0,0,0.2);
}
.hero h1 .kh { display: block; font-size: 1.4rem; opacity: 0.9; margin-bottom: 4px; }
.hero p {
  font-size: 1.15rem;
  opacity: 0.92;
  max-width: 500px;
  margin: 0 auto 24px;
}
.hero .btn-menu {
  background: var(--white);
  color: var(--primary);
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.hero .btn-menu:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }

/* ─── Category Tabs ────────────────────────────────────────────────── */
.category-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px 12px;
  flex-wrap: wrap;
}
.cat-tab {
  background: var(--white);
  border: 2px solid var(--warm-dark);
  color: var(--text);
  padding: 9px 22px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.cat-tab:hover { border-color: var(--primary-light); color: var(--primary); }
.cat-tab.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

/* ─── Menu Grid ────────────────────────────────────────────────────── */
.menu-section { padding: 16px 24px 80px; max-width: 1200px; margin: 0 auto; }

.category-block { margin-bottom: 40px; }
.category-block > h2 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--warm-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.menu-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.menu-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.menu-card .img-wrap {
  height: 170px;
  background: linear-gradient(135deg, var(--warm), var(--warm-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.menu-card .card-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; }
.menu-card h3 { font-size: 1.05rem; margin-bottom: 4px; color: var(--text); }
.menu-card .desc { font-size: 0.85rem; color: var(--text-light); margin-bottom: 12px; flex: 1; }
.menu-card .price { font-size: 1.2rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.menu-card .add-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}
.menu-card .add-btn:hover { background: var(--primary-dark); }
.menu-card .add-btn:active { transform: scale(0.95); }

/* ─── Cart Drawer ──────────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: var(--cart-w);
  max-width: 100%;
  height: 100%;
  background: var(--white);
  z-index: 1600;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.12);
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
  padding: 20px 24px;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 1.2rem; }
.cart-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.cart-items { flex: 1; overflow-y: auto; padding: 12px 24px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--warm);
}
.cart-item .ci-name { flex: 1; font-size: 0.9rem; font-weight: 600; }
.cart-item .ci-price { font-size: 0.85rem; color: var(--primary); font-weight: 700; }
.cart-item .ci-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cart-item .ci-qty button {
  width: 26px; height: 26px;
  border: 1px solid var(--warm-dark);
  background: var(--white);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--primary);
  transition: var(--transition);
}
.cart-item .ci-qty button:hover { background: var(--warm); }
.cart-item .ci-qty span { min-width: 24px; text-align: center; font-weight: 600; font-size: 0.85rem; }
.cart-item .ci-remove {
  background: none;
  border: none;
  color: var(--accent-light);
  cursor: pointer;
  font-size: 1.1rem;
}

.cart-footer { padding: 20px 24px; border-top: 2px solid var(--warm); }
.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
}
.cart-total .amount { color: var(--primary); }

/* ─── Checkout Form ────────────────────────────────────────────────── */
.checkout-form .form-group { margin-bottom: 12px; }
.checkout-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}
.checkout-form input, .checkout-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--warm-dark);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  transition: var(--transition);
}
.checkout-form input:focus, .checkout-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232,93,4,0.1);
}
.checkout-btn {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.checkout-btn:hover { background: var(--primary-dark); }
.checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Empty State ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ─── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--white);
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 3000;
  opacity: 0;
  transition: var(--transition);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─── Confirmation Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  transform: scale(0.85);
  transition: var(--transition);
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-box .check-icon {
  width: 64px; height: 64px;
  background: #4caf50;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
}
.modal-box h3 { font-size: 1.3rem; margin-bottom: 8px; }
.modal-box p { color: var(--text-light); margin-bottom: 20px; }
.modal-box .btn-close {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px 32px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.modal-box .btn-close:hover { background: var(--primary-dark); }

/* ─── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 30px 20px;
  font-size: 0.85rem;
}
.site-footer a { color: var(--primary-light); }

/* ═══════════════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Admin Login ──────────────────────────────────────────────────── */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--text) 0%, #1a0f0a 100%);
}
.admin-login-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 380px;
  max-width: 90%;
  box-shadow: var(--shadow-lg);
}
.admin-login-box h2 { text-align: center; margin-bottom: 8px; color: var(--primary); }
.admin-login-box p { text-align: center; color: var(--text-light); margin-bottom: 24px; font-size: 0.88rem; }
.admin-login-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--warm-dark);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  margin-bottom: 14px;
  font-family: inherit;
}
.admin-login-box input:focus { outline: none; border-color: var(--primary); }
.admin-login-box button {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.admin-login-box button:hover { background: var(--primary-dark); }
.admin-login-box .err { color: var(--accent); text-align: center; font-size: 0.85rem; }

/* ─── Admin Dashboard ──────────────────────────────────────────────── */
.admin-dashboard { display: none; min-height: 100vh; background: var(--bg); }
.admin-dashboard.active { display: block; }

.admin-topbar {
  background: var(--white);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 500;
}
.admin-topbar h1 { font-size: 1.2rem; color: var(--primary); }
.admin-topbar .logout-btn {
  background: var(--accent);
  color: var(--white);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.admin-topbar .logout-btn:hover { opacity: 0.85; }

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 28px 0;
  max-width: 1100px;
  margin: 0 auto;
  border-bottom: 2px solid var(--warm);
}
.admin-tab {
  padding: 10px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-light);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.admin-content { padding: 24px 28px 80px; max-width: 1100px; margin: 0 auto; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ─── Stats Cards ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.stat-card .stat-icon { font-size: 1.8rem; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-light); }

/* ─── Admin Tables ─────────────────────────────────────────────────── */
.admin-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
}
table.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.88rem;
}
.admin-table th {
  background: var(--warm);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.admin-table tr { border-bottom: 1px solid var(--warm); }
.admin-table tr:last-child { border-bottom: none; }
.admin-table tr:hover { background: rgba(255,244,230,0.5); }

/* ─── Status Badges ────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}
.status-badge.pending    { background: #fff3cd; color: #856404; }
.status-badge.confirmed  { background: #d1ecf1; color: #0c5460; }
.status-badge.preparing  { background: #ffe0c2; color: #d35400; }
.status-badge.ready      { background: #d4edda; color: #155724; }
.status-badge.delivered  { background: #d3f8d3; color: #1b7a1b; }
.status-badge.cancelled  { background: #f8d7da; color: #721c24; }

/* ─── Status Select ────────────────────────────────────────────────── */
.status-select {
  padding: 5px 10px;
  border: 1px solid var(--warm-dark);
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ─── Action Buttons ───────────────────────────────────────────────── */
.btn-sm {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-sm:hover { background: var(--primary-dark); }
.btn-sm.danger { background: var(--accent); }
.btn-sm.danger:hover { background: var(--accent-light); }

/* ─── Add Item Form (Admin) ────────────────────────────────────────── */
.add-item-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.add-item-form h3 { margin-bottom: 16px; color: var(--text); }
.add-item-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.add-item-form label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  display: block;
  margin-bottom: 4px;
}
.add-item-form input, .add-item-form select, .add-item-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--warm-dark);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
}
.add-item-form .form-actions { margin-top: 16px; display: flex; gap: 10px; }

/* ─── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --cart-w: 100%; }
  .site-header { padding: 0 14px; }
  .site-header .logo { font-size: 1.15rem; }
  .site-header .logo span.kh { font-size: 0.9rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.95rem; }
  .menu-grid { grid-template-columns: 1fr; }
  .category-tabs { gap: 8px; padding: 20px 12px 8px; }
  .cat-tab { padding: 7px 16px; font-size: 0.82rem; }
  .menu-section { padding: 12px 14px 60px; }
  .admin-content { padding: 16px 14px 60px; }
  .admin-tabs { padding: 12px 14px 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px 16px; }
  .stat-card .stat-value { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .menu-grid { gap: 14px; }
  .hero { min-height: 280px; height: 42vh; }
  .hero h1 { font-size: 1.5rem; }
  .hero h1 .kh { font-size: 1.1rem; }
  .hero .btn-menu { padding: 12px 28px; font-size: 0.9rem; }
}

/* ─── Animations ───────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.menu-card { animation: fadeInUp 0.4s ease-out; }
.fade-in { animation: fadeInUp 0.3s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
.loader {
  width: 36px; height: 36px;
  border: 3px solid var(--warm-dark);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
