/* ═══════════════════════════════════════════════════════
   Breakfast Bot Dashboard — "صباح الخير" Theme
   Warm cream & terracotta — like a sunny kitchen counter
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Changa:wght@400;500;600;700;800&display=swap');

:root {
  /* Warm light palette */
  --bg-page: #faf6f1;
  --bg-sidebar: #fff8f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fdf9f5;
  --bg-input: #faf6f1;
  --border: #e8ddd0;
  --border-light: #d4c8b8;

  /* Accent — terracotta & warm brown */
  --accent: #c0602a;
  --accent-hover: #a8501e;
  --accent-light: #f5e6d8;
  --accent-glow: rgba(192, 96, 42, 0.12);

  /* Category colors */
  --falafel: #bf7b2a;
  --falafel-bg: #fdf3e4;
  --potato: #5a8a30;
  --potato-bg: #eef5e6;
  --fatayer: #3a6fa0;
  --fatayer-bg: #e6eff8;
  --drinks: #7a50a0;
  --drinks-bg: #f0e8f6;

  /* Status */
  --green: #2d8a4e;
  --green-bg: #e4f5ec;
  --red: #c44030;
  --red-bg: #fce8e6;
  --yellow: #b8860b;
  --yellow-bg: #fdf5e0;

  /* Text */
  --text: #3a2e22;
  --text-muted: #8a7a68;
  --text-dim: #b0a090;

  /* Typography */
  --font-display: 'Changa', sans-serif;
  --font-body: 'Cairo', sans-serif;

  /* Spacing */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(58, 46, 34, 0.06);
  --shadow: 0 2px 8px rgba(58, 46, 34, 0.08);
  --shadow-lg: 0 8px 30px rgba(58, 46, 34, 0.1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Ctext x='20' y='40' font-size='22' opacity='0.04'%3E🥖%3C/text%3E%3Ctext x='140' y='30' font-size='18' opacity='0.035'%3E🧆%3C/text%3E%3Ctext x='80' y='90' font-size='20' opacity='0.03'%3E🥤%3C/text%3E%3Ctext x='200' y='80' font-size='16' opacity='0.04'%3E🥧%3C/text%3E%3Ctext x='30' y='150' font-size='17' opacity='0.035'%3E🥪%3C/text%3E%3Ctext x='160' y='140' font-size='22' opacity='0.03'%3E☕%3C/text%3E%3Ctext x='100' y='200' font-size='18' opacity='0.04'%3E🍽️%3C/text%3E%3Ctext x='220' y='190' font-size='16' opacity='0.035'%3E🧀%3C/text%3E%3Ctext x='50' y='245' font-size='20' opacity='0.03'%3E🫓%3C/text%3E%3Ctext x='180' y='240' font-size='17' opacity='0.04'%3E🥖%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────────── */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 16px 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: 0 3px 12px var(--accent-glow);
}

.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 1.25em;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-brand .tagline {
  font-size: 0.73em;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.nav-item .icon {
  font-size: 1.1em;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85em;
  transition: color 0.15s;
}

.sidebar-footer a:hover {
  color: var(--red);
}

.main {
  flex: 1;
  margin-right: 230px;
  padding: 32px 36px;
  max-width: 1100px;
}

/* ── Page header ─────────────────────────────────────── */

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.6em;
  font-weight: 700;
  color: var(--text);
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.88em;
  margin-top: 2px;
}

/* ── Stats cards ─────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.stat-card.green::before { background: var(--green); }
.stat-card.blue::before { background: var(--fatayer); }
.stat-card.purple::before { background: var(--drinks); }

.stat-number {
  font-family: var(--font-display);
  font-size: 2.1em;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-card.green .stat-number { color: var(--green); }
.stat-card.blue .stat-number { color: var(--fatayer); }
.stat-card.purple .stat-number { color: var(--drinks); }

.stat-label {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-top: 6px;
}

/* ── Cards ───────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Forms ───────────────────────────────────────────── */

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-input,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95em;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  direction: rtl;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.form-row > * {
  flex: 1;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95em;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #e8b4ae;
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85em;
}

/* ── Group chips ─────────────────────────────────────── */

.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-chip {
  position: relative;
}

.group-chip input[type="checkbox"] {
  display: none;
}

.group-chip label {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.15s;
  background: var(--bg-card);
}

.group-chip input:checked + label {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.group-chip label:hover {
  border-color: var(--border-light);
  background: var(--bg-input);
}

/* ── Tables ──────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--bg-input);
  padding: 11px 14px;
  text-align: right;
  font-weight: 600;
  font-size: 0.82em;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

td {
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.93em;
}

tr:hover td {
  background: var(--bg-card-hover);
}

/* ── Category headers ────────────────────────────────── */

.cat-header {
  padding: 9px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-header.falafel { background: var(--falafel-bg); color: var(--falafel); border: 1px solid #e8d4b8; border-bottom: none; }
.cat-header.potato  { background: var(--potato-bg);  color: var(--potato);  border: 1px solid #c8d8b8; border-bottom: none; }
.cat-header.fatayer { background: var(--fatayer-bg); color: var(--fatayer); border: 1px solid #b8c8d8; border-bottom: none; }
.cat-header.drinks  { background: var(--drinks-bg);  color: var(--drinks);  border: 1px solid #d0c0d8; border-bottom: none; }

/* ── Badges ──────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.badge-open   { background: var(--green-bg); color: var(--green); }
.badge-closed { background: var(--red-bg);   color: var(--red); }
.badge-paid   { background: var(--green-bg); color: var(--green); }
.badge-unpaid { background: var(--yellow-bg); color: var(--yellow); }

/* ── Payment checkbox ────────────────────────────────── */

.pay-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  background: var(--bg-input);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 0.8em;
}

.pay-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.pay-check:hover {
  border-color: var(--accent);
}

/* ── Cancelled row ───────────────────────────────────── */

tr.cancelled td {
  opacity: 0.45;
  text-decoration: line-through;
}

tr.cancelled .badge {
  text-decoration: none;
}

/* ── Session timer ───────────────────────────────────── */

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95em;
}

.timer.expired {
  color: var(--red);
}

/* ── Tip box ─────────────────────────────────────────── */

.tip {
  background: var(--accent-light);
  border: 1px solid #e0cdb8;
  border-right: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88em;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ── Menu item rows ──────────────────────────────────── */

.menu-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.menu-item-row:hover {
  background: var(--bg-card-hover);
}

.menu-item-row.inactive {
  opacity: 0.4;
}

.menu-item-name {
  font-weight: 500;
}

.menu-item-actions {
  display: flex;
  gap: 8px;
}

/* ── Login page ──────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0e4d4;
  background-image:
    linear-gradient(160deg, rgba(250,246,241,0.85) 0%, rgba(240,228,212,0.8) 50%, rgba(232,216,196,0.85) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Ctext x='20' y='40' font-size='28' opacity='0.07'%3E🥖%3C/text%3E%3Ctext x='140' y='30' font-size='24' opacity='0.06'%3E🧆%3C/text%3E%3Ctext x='80' y='90' font-size='26' opacity='0.05'%3E🥤%3C/text%3E%3Ctext x='200' y='80' font-size='22' opacity='0.07'%3E🥧%3C/text%3E%3Ctext x='30' y='150' font-size='23' opacity='0.06'%3E🥪%3C/text%3E%3Ctext x='160' y='140' font-size='28' opacity='0.05'%3E☕%3C/text%3E%3Ctext x='100' y='200' font-size='24' opacity='0.07'%3E🍽️%3C/text%3E%3Ctext x='220' y='190' font-size='22' opacity='0.06'%3E🧀%3C/text%3E%3Ctext x='50' y='245' font-size='26' opacity='0.05'%3E🫓%3C/text%3E%3Ctext x='180' y='240' font-size='23' opacity='0.07'%3E🥖%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 38px;
  width: 370px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-avatar {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 6px 24px var(--accent-glow);
  margin-bottom: 14px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.6em;
  color: var(--accent);
  font-weight: 700;
}

.login-brand .tagline {
  color: var(--text-dim);
  font-size: 0.85em;
  margin-top: 2px;
}

.login-error {
  background: var(--red-bg);
  border: 1px solid #e8b4ae;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.9em;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    right: auto;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }

  .nav-item {
    white-space: nowrap;
    padding: 8px 14px;
  }

  .layout {
    flex-direction: column;
  }

  .main {
    margin-right: 0;
    padding: 20px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
  }
}

/* ── Animations ──────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-card, .card {
  animation: fadeUp 0.35s ease both;
}
.stat-card:nth-child(2) { animation-delay: 0.04s; }
.stat-card:nth-child(3) { animation-delay: 0.08s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }

/* ── Scrollbar ───────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
