/* ============================================================
   Bejaia Delivery — shared design system
   Palette: deep coastal navy + Mediterranean teal + harissa
   spice accent + warm sand background. Sans-serif throughout
   (Sora for headings, Inter for body).
   ============================================================ */

:root {
  --navy: #16323F;
  --navy-light: #1F4A5C;
  --teal: #2EC4B6;
  --teal-dark: #1FA89B;
  --harissa: #E8633A;
  --saffron: #F4B740;
  --sand: #F7F4EE;
  --white: #FFFFFF;
  --ink: #1E242B;
  --muted: #6E7A85;
  --border: #E4DFD3;
  --success: #3AA655;
  --danger: #D64550;

  --radius: 10px;
  --shadow: 0 2px 16px rgba(22, 50, 63, 0.09), 0 1px 3px rgba(22, 50, 63, 0.05);
  --shadow-hover: 0 8px 28px rgba(22, 50, 63, 0.15);
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --t: 0.18s ease;
}

* { box-sizing: border-box; }

/* Dark gradient gives glass panels something to blur/tint against */
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: linear-gradient(145deg, #0d2230 0%, #16323F 55%, #1a4a5a 100%);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0 0 .4em 0;
  letter-spacing: -0.01em;
}

a { color: var(--teal-dark); text-decoration: none; transition: color var(--t); }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* ---------- Layout shell: sidebar + main ---------- */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Frosted glass sidebar over the body gradient */
.sidebar {
  width: 230px;
  background: rgba(22, 50, 63, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 18px;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* Subtle teal shimmer at the top of the sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(46, 196, 182, 0.07) 0%, transparent 100%);
  pointer-events: none;
}

.sidebar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 4px;
  position: relative;
}
.sidebar .brand span { color: var(--teal); }
.sidebar .role-tag {
  font-size: .75rem;
  color: var(--saffron);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 28px;
  position: relative;
}

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; position: relative; }
.sidebar nav a, .sidebar nav button.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.75);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: .94rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background var(--t), color var(--t), transform 0.12s ease;
}
.sidebar nav a:hover, .sidebar nav button.navlink:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  transform: translateX(3px);
  text-decoration: none;
}
.sidebar nav a.active, .sidebar nav button.navlink.active {
  background: var(--teal);
  color: var(--navy);
  box-shadow: 0 2px 12px rgba(46, 196, 182, 0.3);
}

.sidebar .user-box {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
  margin-top: 14px;
  font-size: .85rem;
  position: relative;
}
.sidebar .user-box .name { font-weight: 600; }
.sidebar .logout {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  width: 100%;
  transition: background var(--t), border-color var(--t);
}
.sidebar .logout:hover { background: var(--harissa); border-color: transparent; }

/* Main content: semi-opaque sand over the dark gradient */
.main {
  flex: 1;
  padding: 28px 36px;
  height: 100vh;
  overflow-y: auto;
  background: rgba(247, 244, 238, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeInUp 0.35s ease-out both;
}

.main h1 { font-size: 1.6rem; }
.main .subtitle { color: var(--muted); margin-bottom: 24px; }

/* ---------- Cards ---------- */

.card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: box-shadow var(--t), transform var(--t);
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.card h3 { font-size: 1.05rem; margin-bottom: 8px; }

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  transition: transform 0.15s ease-out, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(22, 50, 63, 0.18);
}
.btn:active { transform: scale(.97) translateY(0); box-shadow: none; }
.btn-primary { background: var(--teal); color: var(--navy); }
.btn-primary:hover { background: var(--teal-dark); color: #fff; box-shadow: 0 4px 14px rgba(46, 196, 182, 0.35); }
.btn-secondary { background: rgba(247, 244, 238, 0.9); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: #efe9db; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b8333d; box-shadow: 0 4px 14px rgba(214, 69, 80, 0.35); }
.btn-warning { background: var(--saffron); color: var(--navy); }
.btn-warning:hover { background: #e0a52f; box-shadow: 0 4px 14px rgba(244, 183, 64, 0.35); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Forms ---------- */

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--navy); }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  margin-bottom: 14px;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.18);
}
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

/* ---------- Badges / status ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  transition: opacity var(--t);
}
.badge-pending   { background: #FCE9DD; color: var(--harissa); }
.badge-accepted  { background: #E3F3FB; color: #1B7AA8; }
.badge-preparing { background: #FFF3CF; color: #9A7A12; }
.badge-ready     { background: #E1F6F3; color: var(--teal-dark); }
.badge-picked_up,
.badge-delivering { background: #E7E6FB; color: #5B4FCB; }
.badge-delivered { background: #E5F4E8; color: var(--success); }
.badge-cancelled,
.badge-rejected  { background: #FBE5E7; color: var(--danger); }

/* ---------- Order tracker (signature element) ---------- */

.tracker {
  display: flex;
  align-items: flex-start;
  margin: 18px 0 24px;
  overflow-x: auto;
}
.tracker .step {
  flex: 1;
  min-width: 90px;
  text-align: center;
  position: relative;
  padding-top: 28px;
}
.tracker .step .dot {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--border);
  z-index: 2;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.tracker .step.done .dot { border-color: var(--teal); background: var(--teal); }
.tracker .step.current .dot {
  border-color: var(--harissa);
  background: var(--harissa);
  box-shadow: 0 0 0 5px rgba(232, 99, 58, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
.tracker .step .line {
  position: absolute;
  top: 10px; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  z-index: 1;
  transition: background 0.3s ease;
}
.tracker .step.done .line, .tracker .step.current .line { background: var(--teal); }
.tracker .step:first-child .line { left: 50%; }
.tracker .step:last-child .line { right: 50%; }
.tracker .step .label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  transition: color 0.3s ease;
}
.tracker .step.current .label { color: var(--harissa); }
.tracker .step.done .label { color: var(--teal-dark); }

/* ---------- Misc ---------- */

.muted { color: var(--muted); font-size: .88rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex { display: flex; gap: 10px; align-items: center; }
.map { width: 100%; height: 260px; border-radius: var(--radius); border: 1px solid var(--border); }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t);
}

/* ---------- Animations ---------- */

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232, 99, 58, 0.18); }
  50%       { box-shadow: 0 0 0 8px rgba(232, 99, 58, 0.08); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(16px); }
}

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

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 50, 63, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 22px 14px 18px;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(22, 50, 63, 0.28);
  font-size: .95rem;
  font-weight: 500;
  z-index: 9999;
  max-width: 360px;
  min-width: 220px;
  white-space: pre-wrap;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--teal);
  animation: toastIn .25s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
.toast.out {
  animation: toastOut .3s ease forwards;
}
.toast::before {
  content: '✓';
  font-size: 1.1rem;
  color: var(--teal);
  flex-shrink: 0;
  font-weight: 700;
}
.toast.error {
  background: rgba(61, 18, 24, 0.92);
  border-left-color: var(--danger);
}
.toast.error::before {
  content: '!';
  color: var(--danger);
}
.error-text { color: var(--danger); font-size: .85rem; margin: -6px 0 12px; }

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 34, 48, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(13, 34, 48, 0.3);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 360px;
  animation: modalIn .25s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13, 34, 48, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(13, 34, 48, 0.28);
  animation: modalIn .25s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.modal h3 { margin-bottom: 4px; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); transition: background var(--t); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: rgba(46, 196, 182, 0.04); }

/* ---------- Cart ---------- */

.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); background: rgba(247, 244, 238, 0.8);
  cursor: pointer; font-weight: 700;
  transition: background var(--t), border-color var(--t), transform 0.1s ease;
}
.qty-control button:hover { background: var(--teal); border-color: var(--teal); color: var(--navy); transform: scale(1.1); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs button {
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.tabs button.active { color: var(--navy); border-bottom-color: var(--harissa); }
.tabs button:hover:not(.active) { color: var(--ink); }

/* ---------- Stat cards (admin overview) ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--t), transform var(--t);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.stat-card .value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--navy); }
.stat-card .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card.accent .value { color: var(--harissa); }
.stat-card.profit .value { color: var(--teal-dark); }

/* ---------- Balance banner ---------- */

.balance-banner {
  background: rgba(22, 50, 63, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.balance-banner .value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--saffron); }
.balance-banner .label { font-size: .8rem; color: rgba(255, 255, 255, 0.7); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Info rows (order breakdown, ETA) ---------- */

.info-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .92rem; }
.info-row .muted { color: var(--muted); }
.eta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(225, 246, 243, 0.9); color: var(--teal-dark); padding: 4px 12px; border-radius: 999px;
  font-weight: 600; font-size: .85rem;
  backdrop-filter: blur(4px);
}
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); display: inline-block; }
.offline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); display: inline-block; }

/* ---------- Custom scrollbar ---------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(22, 50, 63, 0.2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(22, 50, 63, 0.35); }

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .app-shell { flex-direction: column; height: auto; overflow: visible; }
  .sidebar {
    width: 100%; height: auto; overflow-y: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar::before { display: none; }
  .sidebar .brand, .sidebar .role-tag { width: 100%; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .user-box { display: none; }
  .main { height: auto; overflow-y: visible; padding: 18px; animation: none; }
}
