/* Mama Layla admin — plain CSS, RTL */

/* Cairo (self-hosted, variable weight 200–1000, SIL OFL) */
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/cairo-arabic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/cairo-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  /* Brand palette (from the Mama Layla logo) — shared with the Flutter app, see CLAUDE.md */
  --brand: #d7143a;        /* crimson red */
  --brand-dark: #a80e2c;
  --brand-soft: #fde8ec;
  --accent: #f4b32e;       /* golden yellow */
  --accent-dark: #8a5a00;
  --accent-soft: #fef3d9;
  --brown: #4a1f17;        /* outline brown */
  --pink: #ea3552;
  --leaf: #5a8a2b;

  --bg: #fff8f1;           /* warm cream */
  --surface: #ffffff;
  --text: #2b1410;
  --muted: #7a625a;
  --border: #f0e2d6;
  --ok: #3f7a1f;
  --ok-soft: #e9f4df;
  --warn: var(--accent-dark);
  --warn-soft: var(--accent-soft);
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info: #1d5fa8;
  --info-soft: #e3eefb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(74, 31, 23, .06);
  --font: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --appbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
}
/* Cairo everywhere, including form controls (browsers don't inherit fonts there by default) */
button, input, select, textarea, optgroup, table, th, td { font-family: var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--brown); color: #f6e7dc;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--appbar-h); padding: 0 18px;
  color: #fff; font-weight: 800; font-size: 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand:hover { text-decoration: none; }
.brand-logo { height: 48px; width: auto; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.sidebar .brand span { color: var(--accent); }
.sidebar nav { padding: 14px 10px; flex: 1; }
.sidebar .nav-label { font-size: 12px; color: #c9a898; padding: 10px 10px 6px; }
.sidebar nav a {
  display: flex; justify-content: space-between; align-items: center;
  color: #f1dfd3; padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; font-weight: 600;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar .count { background: var(--accent); color: var(--brown); font-weight: 700; border-radius: 99px; font-size: 12px; padding: 0 8px; }
.sidebar .count.info { background: #4a8fd9; }
.sidebar nav a.active .count { background: #fff; color: var(--brand-dark); }
.sidebar .sidebar-foot { padding: 14px 18px; font-size: 12px; color: #c9a898; border-top: 1px solid rgba(255,255,255,.08); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* App bar (top header on every page) */
.appbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--appbar-h);
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 24px;
}
.appbar-start, .appbar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.appbar .today { color: var(--muted); font-size: 13px; white-space: nowrap; }
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; font-size: 18px; color: var(--text);
}
.appbar-brand { display: none; align-items: center; gap: 8px; font-weight: 800; color: var(--brand); }
.appbar-brand img { height: 36px; width: auto; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
}
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.user-menu .who { line-height: 1.2; }
.user-menu .who strong { display: block; font-size: 14px; }
.user-menu .who span { font-size: 12px; color: var(--muted); }
.user-menu .dropdown {
  position: absolute; left: 0; top: calc(100% + 8px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px;
}
.user-menu .dropdown .meta { padding: 8px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu .dropdown button {
  width: 100%; text-align: right; background: none; border: 0; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; color: var(--bad); font-weight: 600;
}
.user-menu .dropdown button:hover { background: var(--bad-soft); }

.main { flex: 1; padding: 24px; }

/* Page header */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.page-header .crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.page-header .crumbs a { color: var(--muted); }
.page-header .crumbs a:hover { color: var(--brand); }
.page-header .crumbs .sep { opacity: .5; }
.page-header h1 { margin: 0; font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header .subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-header .page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; right: 0; top: 0; z-index: 40;
    transform: translateX(100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); }
  .menu-toggle { display: grid; place-items: center; }
  .appbar-brand { display: flex; }
  .appbar { padding: 0 16px; }
  .appbar .today, .user-menu .who { display: none; }
  .user-menu summary { padding: 3px; }
  .main { padding: 16px; }
  .page-header h1 { font-size: 22px; }
}

/* Cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; }
.stat .hint { font-size: 12px; color: var(--muted); }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fff4ea; }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--border); display: block; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: #eee; color: #444; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* Buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 7px 14px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #fbeee4; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.success { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.error { color: var(--bad); font-size: 13px; margin-top: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 160px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

/* Pagination */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { color: #bbb; }

/* Login */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 50% 0%, var(--accent-soft), var(--bg) 60%);
}
.login-logo { display: block; width: 150px; height: auto; margin: 0 auto 8px; }
.login-card { width: 100%; max-width: 380px; border-top: 4px solid var(--brand); text-align: center; }
.login-card form { text-align: start; }
.login-card .btn { width: 100%; justify-content: center; }

/* Media gallery */
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

details.reject summary { cursor: pointer; list-style: none; }
details.reject[open] { width: 100%; }
details.reject form { margin-top: 8px; display: flex; gap: 6px; }
details.reject input { flex: 1; }

/* Orders */
.money-table td:last-child { text-align: left; font-variant-numeric: tabular-nums; }
.money-table tr.total td { font-weight: 800; font-size: 16px; }
.money-table tr.sub td { color: var(--muted); font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 16px 0; }
.timeline li::before { content: ""; position: absolute; right: 5px; top: 8px; bottom: -8px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; right: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); }
.timeline li.done::after { background: var(--ok); border-color: var(--ok); }
.timeline li.cancelled::after { background: var(--bad); border-color: var(--bad); }
.timeline .t-title { font-weight: 700; }
.timeline .t-meta { font-size: 12px; color: var(--muted); }
.action-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.action-box form { display: flex; gap: 6px; flex-wrap: wrap; }
.action-box input[type=text] { width: 240px; }
.stat.accent { border-color: var(--brand); background: var(--brand-soft); }

/* Stories & reviews */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.story-card { padding: 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.story-card > a { position: relative; display: block; }
.story-card img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: var(--border); display: block; }
.story-card .story-type { position: absolute; top: 8px; right: 8px; }
.stars { color: var(--accent); letter-spacing: 1px; white-space: nowrap; }
.stars .muted { color: #ecdcd0; }

/* Live new-order alerts (admin/partials/live.blade.php) */
[hidden] { display: none !important; }
.alerts-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 600 13px var(--font); padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.alerts-btn.on { color: var(--ok); border-color: #cfe5bf; background: var(--ok-soft); }
.alerts-btn.attention {
  color: var(--brown); border-color: var(--accent); background: var(--accent-soft);
  animation: ml-pulse 1.6s ease-in-out infinite;
}
@keyframes ml-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 179, 46, .55); }
  50% { box-shadow: 0 0 0 7px rgba(244, 179, 46, 0); }
}
.live-modal {
  position: fixed; inset: 0; z-index: 100; padding: 16px;
  background: rgba(43, 20, 16, .55);
  display: flex; align-items: center; justify-content: center;
}
.live-box {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: 16px; border-top: 6px solid var(--brand);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); padding: 20px;
  animation: ml-pop .25s ease-out;
}
@keyframes ml-pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.live-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.live-head h2 { margin: 0; flex: 1; color: var(--brand); font-size: 22px; }
.live-bell { font-size: 30px; display: inline-block; animation: ml-ring 1s ease-in-out 3; transform-origin: 50% 0; }
@keyframes ml-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(18deg); } 40% { transform: rotate(-16deg); } 60% { transform: rotate(10deg); } 80% { transform: rotate(-6deg); } }
.live-x { background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.live-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.live-item {
  display: block; color: var(--text); padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg);
}
.live-item:hover { text-decoration: none; border-color: var(--brand); }
.live-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.live-num { color: var(--brand); direction: ltr; }
.live-item .badge { margin-top: 6px; }
.live-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.live-actions .btn:first-child { flex: 1; justify-content: center; }
@media (max-width: 700px) {
  .alerts-btn span { display: none; }
  .alerts-btn { padding: 6px 10px; }
}
.live-actions .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Search pickers (partials/picker.blade.php + js/admin-picker.js) */
.picker { position: relative; }
.picker-results {
    position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 30; max-height: 320px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(43, 20, 16, .12);
}
.picker-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 14px;
    background: none; border: 0; border-bottom: 1px solid var(--border); text-align: start; cursor: pointer; font: inherit;
}
.picker-item:last-child { border-bottom: 0; }
.picker-item span { font-size: 12px; color: var(--muted); direction: rtl; }
.picker-item:hover, .picker-item.active { background: var(--brand-soft); }
.picker-empty { padding: 12px 14px; color: var(--muted); }
.picker-chosen {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
    background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 10px; font-weight: 700;
}
.picker-clear { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-weight: 700; }

/* Order chat transcript (admin order page) */
.chat-line { padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; max-width: 92%; }
.chat-line.customer { background: #f6f1ea; }
.chat-line.chef { background: var(--brand-soft); margin-inline-start: auto; }

/* صانع البوستات (admin/studio) */
.studio { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 18px; align-items: start; }
.studio hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0 12px; }
.studio-previews { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.studio-previews figure { margin: 0; text-align: center; }
.studio-previews canvas { display: block; width: 260px; height: auto; border-radius: 14px; box-shadow: var(--shadow); background: #fff8f1; }
.studio-previews figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: center; }
.studio .small-btn { padding: 4px 10px; font-size: 13px; }
.studio:not(.has-design) .studio-previews figure, .studio:not(.has-design) #studio-dl-both { display: none; }
.studio.has-design .studio-empty { display: none; }
.studio-empty { padding: 60px 10px; text-align: center; }
@media (max-width: 900px) { .studio { grid-template-columns: 1fr; } .studio-previews canvas { width: 42vw; } }
.studio-inline { display: flex; gap: 8px; }
.studio-inline input { flex: 1; min-width: 0; }
.studio-ai-box { background: #fff7e6; border: 1px dashed var(--accent, #f4b32e); border-radius: 12px; padding: 10px 12px; }
.studio-ai-caption { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.studio-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.studio-posts .card { padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.studio-posts img { width: 100%; border-radius: 10px; aspect-ratio: 4 / 5; object-fit: cover; background: #fff8f1; }
.studio-posts .title { font-weight: 800; line-height: 1.4; }
.studio-posts .btns { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-posts .btns .btn { padding: 4px 10px; font-size: 13px; }
