/* ---------- ROOT THEME ---------- */
:root {
  --primary: #ffffff;
  --secondary: #f2f2f2;
  --text: #111111;
  --muted: #777777;
  --accent: #000000;
  --accent: #0b74de;
  --radius: 14px;
}

/* Dark theme variables */
body.dark {
  /* slightly lighter dark palette for better element definition */
  --primary: #0f1620;
  --secondary: #0b141a;
  --text: #ffffff;
  --muted: #b8c9d6;
  --accent: #3fa9ff;
  --card-border: rgba(255,255,255,0.06);
}

/* Smooth transitions for theme changes */
body, .card, .modal-card, .admin-panel, .cart-sidebar {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* ---------- RESET ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--secondary);
  color: var(--text);
}

/* ---------- AUTH LAYOUT ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  padding: 20px;
}

.auth-card {
  background: var(--primary);
  max-width: 420px;
  margin: auto;
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.auth-title {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid #ddd;
  font-size: 1rem;
  background: var(--secondary);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--primary);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
}

.btn-primary:hover {
  opacity: 0.9;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ---------- NAV ---------- */
.top-nav {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  z-index: 10;
}

.top-nav a,
.cart-toggle {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- MENU GRID ---------- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 24px;
}

.card {
  background: var(--primary);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h3 {
  font-size: 1.2rem;
}

.price {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- CART SIDEBAR ---------- */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: var(--primary);
  box-shadow: -6px 0 20px rgba(0,0,0,0.12);
  padding: 24px;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.cart-sidebar.open {
  right: 0;
}

.cart-sidebar h2 {
  margin-bottom: 16px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.cart-item button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
}

.cart-footer {
  margin-top: auto;
}

.cart-total {
  font-weight: bold;
  margin-bottom: 12px;
}

/* ---------- MODALS ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal.open {
  display: flex;
}

.modal-card {
  background: white;
  padding: 24px;
  border-radius: 18px;
  width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card.wide {
  width: 80%;
  max-width: 900px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-cancel {
  padding: 12px 18px;
  background: #ddd;
  color: #111;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ---------- OPTIONS ---------- */
.option-group {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}

.option-item {
  display: grid;
  grid-template-columns: 1fr 80px 30px;
  gap: 6px;
  margin-bottom: 6px;
}

.option-item input {
  flex: 1;
}

.order-option {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 10px;
}

/* ---------- ADMIN PANEL ---------- */
.admin-action {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-action .muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- LIVE ORDERS MODAL ---------- */
#liveOrdersModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

#liveOrdersModal.open {
  display: flex;
}

#liveOrdersModal .modal-card {
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
}

#liveOrdersModal .order-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}

/* ---------- CHECKOUT ---------- */
.checkout-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* Receipt panel for checkout page */
.checkout-receipt-panel {
  background: var(--primary);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}
.checkout-receipt-panel .receipt-item {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.checkout-receipt-panel .receipt-item:last-child { border-bottom: none; }
.checkout-receipt-panel h2 { margin: 0 0 8px 0; }

/* dark mode variants */
body.dark .checkout-receipt-panel {
  background: var(--primary);
  border: 1px solid var(--card-border, rgba(255,255,255,0.06));
}

/* Thank-you page styling to respect theme */
.checkmark-circle { display:inline-block; }
body, body.dark {
  background: var(--secondary);
  color: var(--text);
}
.checkmark { stroke: var(--accent); }
.thankyou-card { background: var(--primary); }

.checkout-modal.open {
  display: flex;
}

.checkout-card {
  background: white;
  padding: 28px;
  width: 320px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-card input {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.checkout-card .cancel {
  background: none;
  border: none;
  margin-top: 8px;
  cursor: pointer;
}

/* ---------- ANNOUNCEMENTS ---------- */
.announcement {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ---------- MEDIA QUERIES ---------- */
@media (max-width: 768px) {
  .menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    padding: 12px;
  }

  .cart-sidebar {
    width: 280px;
  }

  .modal-card {
    width: 90%;
  }
}
.admin-container {
  display: flex;
  gap: 20px;
  padding: 24px;
}

.admin-panel {
  flex: 1;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  overflow-y: auto;
  max-height: 80vh;
}

.menu-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.option-groups {
  margin-top: 12px;
}

.option-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.add-group {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

/* ---------- ADMIN UI TIDY ---------- */
.admin-panel {
  padding: 16px;
}

.admin-panel .admin-action {
  gap: 8px;
  align-items: center;
  display: flex;
  flex-wrap: wrap;
}

/* make admin buttons compact (override global full-width) */
.admin-panel .btn-primary,
.admin-panel .btn-cancel {
  width: auto;
  padding: 8px 12px;
  font-size: 0.95rem;
}

/* Icon helpers for buttons */
.btn-icon { display:inline-flex; align-items:center; gap:8px; }
.btn-icon::before{ display:inline-block; width:16px; height:16px; font-size:14px; line-height:16px; }
.icon-add::before{ content: "\2795"; }
.icon-edit::before{ content: "\270E"; }
.icon-delete::before{ content: "\1F5D1"; }
.icon-announcement::before{ content: "\1F514"; }
.icon-orders::before{ content: ""; }
.icon-clear::before{ content: "\2716"; }
.btn-icon::before { color: white; opacity: 0.95; }
.admin-panel .btn-primary.btn-icon { background: var(--accent); }

.admin-panel .menu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.admin-panel .card {
  padding: 12px;
  border-radius: 12px;
}

.card-actions button { width: auto; padding: 8px 10px; }

.option-groups { margin-top: 10px; }
.option-items { display: flex; flex-direction: column; gap: 8px; }
.option-item { display: flex; align-items: center; gap: 8px; }
.option-item span { flex: 1; }
.option-item button { padding: 6px 10px; }

.add-group input { flex: 1; padding: 10px; }
.add-group .btn-primary { padding: 8px 10px; width: auto; }

/* reduce visual weight of admin panels */
.admin-panel h2 { margin-bottom: 12px; font-size: 1.1rem; }

@media (max-width: 900px) {
  .admin-panel .menu-cards { grid-template-columns: 1fr; }
}

/* Small floating theme toggle (sun / moon) */
.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--text);
  border: 1px solid var(--card-border, rgba(0,0,0,0.06));
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.theme-toggle:hover{ transform: translateY(-1px); }

/* Settings gear inside the settings container */
.settings-gear {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--text);
  border: 1px solid var(--card-border, rgba(0,0,0,0.06));
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  cursor: pointer;
  font-size: 18px;
}

/* Profile avatar styling */
#globalSettings img#userAvatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--card-border, rgba(0,0,0,0.06));
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  cursor: pointer;
}

/* Make UI elements more defined in dark mode */
body.dark .card,
body.dark .modal-card,
body.dark .admin-panel,
body.dark .cart-sidebar {
  background: var(--primary);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}

/* Slightly lighter controls for visibility */
body.dark .btn-primary { background: var(--accent); }
body.dark .btn-cancel { background: transparent; color: var(--muted); }

/* Inputs, selects, textareas and labels in dark mode */
body.dark .input,
body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="password"],
body.dark select,
body.dark textarea {
  background: var(--primary);
  color: var(--text);
  border: 1px solid var(--card-border, rgba(255,255,255,0.06));
}

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

body.dark label,
body.dark .auth-subtitle,
body.dark .muted {
  color: var(--text);
}

body.dark .input::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder,
body.dark select::placeholder {
  color: var(--muted);
}

/* Thank you / checkmark animation */
.checkmark-circle { display:inline-block; }
.checkmark { width:96px; height:96px; stroke:var(--accent); stroke-width:4; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:10; }
.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 4; stroke: var(--accent); fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; stroke: var(--accent); stroke-width: 4; animation: stroke 0.3s 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }

@keyframes stroke {
  to { stroke-dashoffset: 0; }
}

