/* Brozia – shared styles (customer site + admin) */
:root {
  --brand: #c8161d;
  --brand-dark: #9e0f15;
  --accent: #f6b21b;
  --ink: #1d1b19;
  --muted: #6f6a64;
  --line: #ece7e1;
  --bg: #faf7f3;
  --card: #ffffff;
  --ok: #1a7f37;
  --bad: #c8161d;
  --warn-bg: #fff6dd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 20, 10, .05), 0 4px 16px rgba(30, 20, 10, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 96px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.mt { margin-top: 24px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.ar { font-family: "Noto Sans Arabic", Tahoma, sans-serif; color: var(--muted); font-weight: 500; direction: rtl; }
h2 .ar { font-size: .8em; margin-left: 6px; }
.h2 { font-size: 1.5rem; }
.h3 { font-size: 1.15rem; }
.page-title { font-size: 1.6rem; margin: 4px 0 16px; }

/* Top bar */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.25rem; letter-spacing: .5px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--brand-dark); display: grid; place-items: center; font-weight: 900; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: #fff; padding: 8px 10px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.cart-link { position: relative; display: flex; }
.cart-count { position: absolute; top: 0; right: 0; background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.cart-count[hidden] { display: none; }

/* Hero */
.hero { background: linear-gradient(135deg, #2a1410 0%, #5a1a12 55%, var(--brand) 100%); color: #fff; border-radius: 20px; padding: 28px 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero::after { content: "🍗"; position: absolute; right: 18px; bottom: -10px; font-size: 110px; opacity: .18; transform: rotate(-12deg); }
.hero h1 { font-size: 2rem; margin-bottom: 4px; }
.hero p { margin: 0 0 14px; opacity: .9; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); padding: 5px 10px; border-radius: 999px; font-size: .85rem; }

/* Category tabs */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 12px; position: sticky; top: 60px; background: var(--bg); z-index: 40; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; }
.cat-tabs a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.menu-section { scroll-margin-top: 120px; margin-bottom: 26px; }
.menu-section h2 { font-size: 1.3rem; }

/* Cards & grid */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.item { display: flex; flex-direction: column; overflow: hidden; }
.item-img { aspect-ratio: 4 / 3; background: #f3ede6; }
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.item-img.noimg { display: grid; place-items: center; font-size: 54px; background: linear-gradient(135deg, #fff1df, #ffe1c2); }
.item-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.item-body h3 { font-size: 1.02rem; margin: 0 0 2px; }
.item-body p { margin: 6px 0 0; }
.item-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-size: 1.05rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; background: #eee; color: var(--ink); text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f1c6c8; }
.btn-sm { padding: 6px 12px; font-size: .875rem; border-radius: 8px; }
.btn-lg { padding: 14px 18px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--bad); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper[hidden] { display: none; }
.stepper button { width: 34px; height: 34px; border: 0; background: #fff; font-size: 1.15rem; font-weight: 700; color: var(--brand); cursor: pointer; }
.stepper button:hover { background: #fdf0ef; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }

/* Floating cart bar */
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(560px, calc(100% - 24px)); background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 600; }
.cart-bar:hover { text-decoration: none; background: #000; }
.cart-bar[hidden] { display: none; }

/* Forms */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #ddd5cc; border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200, 22, 29, .25); border-color: var(--brand); }
input:disabled { background: #f5f2ee; color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-weight: 500; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; border: 1px solid; }
.alert-success { background: #e9f7ee; border-color: #bfe5cc; color: #14532d; }
.alert-error { background: #fdecec; border-color: #f5c2c4; color: #7f1d1d; }
.alert-warning { background: var(--warn-bg); border-color: #f3dc9a; color: #6b4e00; }
.alert-info { background: #eef4ff; border-color: #c9d8fb; color: #1e3a8a; }
.alert[hidden] { display: none; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--card); border-radius: var(--radius); }

/* Cart / checkout */
.checkout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.line { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line img, .line-noimg { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; }
.line-noimg { display: grid; place-items: center; background: #fff1df; font-size: 26px; }
.line-main { flex: 1; min-width: 0; }
.line-name { font-weight: 600; }
.line-total { width: 90px; text-align: right; font-weight: 700; }
.totals { margin-top: 12px; }
.totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals > div[hidden] { display: none; }
.totals .grand { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 14px; border: 2px solid var(--line); border-radius: 12px; font-weight: 700; background: #fff; }
.seg input:checked + span { border-color: var(--brand); background: #fff4f3; color: var(--brand); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: #fffdfb; }
.box[hidden] { display: none; }
.box.pay { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; }
.addr { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; cursor: pointer; background: #fff; }
.addr input { margin-top: 4px; }
.addr span .small { display: block; }
.addr-out { opacity: .75; cursor: not-allowed; background: #fbf7f7; }

/* Auth */
.auth { max-width: 420px; margin: 20px auto; text-align: center; }
.auth form { text-align: left; }
.auth-icon { width: 64px; height: 64px; border-radius: 50%; background: #e7f9ee; display: grid; place-items: center; margin: 0 auto 12px; }
.otp-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-weight: 700; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; }

/* Profile */
.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; align-items: start; }
.map { height: 320px; border-radius: 12px; margin: 10px 0; border: 1px solid var(--line); z-index: 1; }
.dist-info { margin-bottom: 12px; font-weight: 600; }
.addr-card { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.addr-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; white-space: nowrap; }
.badge { display: inline-block; background: #fff4d6; color: #7a5600; border-radius: 6px; font-size: .72rem; font-weight: 700; padding: 1px 6px; vertical-align: middle; }

/* Orders */
.list { display: grid; gap: 10px; }
.order-row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); }
.order-row:hover { text-decoration: none; box-shadow: 0 0 0 2px #f2d6d4, var(--shadow); }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eee; white-space: nowrap; }
.s-new { background: #e7efff; color: #1d4ed8; }
.s-accepted { background: #fff3d6; color: #8a5a00; }
.s-ready, .s-out_for_delivery { background: #e6f7ec; color: #166534; }
.s-completed { background: #ececec; color: #444; }
.s-cancelled { background: #fde8e8; color: #9b1c1c; }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.timeline { list-style: none; padding: 0; margin: 18px 0; display: flex; }
.timeline li { flex: 1; text-align: center; position: relative; font-size: .8rem; color: var(--muted); padding-top: 26px; }
.timeline li::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: #e5ded6; z-index: 1; }
.timeline li::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px; background: #e5ded6; }
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--ink); font-weight: 600; }
.timeline li.done::before, .timeline li.done::after { background: var(--ok); }
.timeline li.current::before { box-shadow: 0 0 0 5px rgba(26, 127, 55, .2); }
table.lines { width: 100%; border-collapse: collapse; margin: 8px 0 14px; }
table.lines td { padding: 7px 0; border-bottom: 1px solid var(--line); }
table.lines .sub td { color: var(--muted); }
table.lines .grand td { font-weight: 800; font-size: 1.1rem; border-bottom: 0; }
.placed { text-align: center; margin-bottom: 16px; }
.placed-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 34px; display: grid; place-items: center; margin: 0 auto 10px; }

.footer { border-top: 1px solid var(--line); padding: 20px 0 90px; font-size: .9rem; color: var(--muted); background: #fff; }

@media (max-width: 820px) {
  .checkout, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .nav a { padding: 8px 7px; font-size: .88rem; }
  .brand-name { display: none; }
  .hero h1 { font-size: 1.6rem; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .item-body { padding: 10px; }
  .item-body h3 { font-size: .93rem; }
  .item-foot { flex-direction: column; align-items: stretch; }
  .item-foot .btn, .item-foot .stepper { width: 100%; justify-content: space-between; }
  .item-foot .stepper button { flex: none; }
  .line-total { width: 74px; font-size: .9rem; }
}

/* ================= Admin ================= */
.admin-body { background: #f4f2ef; }
.admin-top { background: var(--ink); }
.admin-top .brand-mark { background: var(--brand); color: #fff; }
.admin-nav a.active { background: rgba(255,255,255,.16); }
.admin-main { padding-top: 20px; padding-bottom: 60px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a:hover { text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.4rem; }
.orders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ocard { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px; border-top: 4px solid #ccc; display: flex; flex-direction: column; gap: 8px; }
.ocard.st-new { border-top-color: #2563eb; animation: pulse 2s ease-in-out 3; }
.ocard.st-accepted { border-top-color: #e2a300; }
.ocard.st-ready, .ocard.st-out_for_delivery { border-top-color: var(--ok); }
.ocard.st-cancelled { border-top-color: var(--bad); opacity: .8; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .25); } }
.ocard-head { display: flex; justify-content: space-between; align-items: flex-start; }
.ocard ul { margin: 0; padding-left: 18px; }
.ocard .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.ocard .actions form { display: inline; }
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .92rem; }
table.data th { background: #faf8f5; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
table.data .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f3ede6; display: grid; place-items: center; }
.table-wrap { overflow-x: auto; }
.inline-form { display: inline; }
.pill-off { background: #eee; color: #777; }
.pill-on { background: #e6f7ec; color: #166534; }
.cat-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-row input[type=text] { width: auto; flex: 1 1 140px; padding: 7px 10px; }
.cat-row input[type=number] { width: 80px; padding: 7px 10px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; background: #f6f3ef; padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 820px) {
  .settings-grid { grid-template-columns: 1fr !important; }
  .admin-top .topbar-inner { height: auto; flex-direction: column; align-items: stretch; padding: 8px 12px; gap: 6px; }
  .admin-nav { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { white-space: nowrap; }
  .admin-top .brand-name { display: inline; font-size: 1.05rem; }
  .orders-grid { grid-template-columns: 1fr; }
  .toolbar .page-title { font-size: 1.3rem; }
}
@media print {
  .topbar, .toolbar, .actions, .footer, .tabs, .stats { display: none !important; }
}
