/* ============================================================
   تصميم قائمة المطعم — RTL
   ============================================================ */
:root {
  --bg:          #14100c;
  --bg-soft:     #1d1712;
  --card:        #241d16;
  --card-2:      #2c231a;
  --line:        #3a2e22;
  --ink:         #f6efe4;
  --ink-soft:    #cdbda6;
  --ink-dim:     #9b8a74;
  --gold:        #e0b154;
  --gold-soft:   #f0d49a;
  --green:       #7fb069;
  --red:         #d96a5a;
  --radius:      16px;
  --shadow:      0 10px 30px rgba(0,0,0,.35);
  --font: 'Cairo', 'Tajawal', 'Segoe UI', 'Dubai', 'Tahoma', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(224,177,84,.13), transparent 60%),
    radial-gradient(700px 400px at 10% 0%, rgba(127,176,105,.08), transparent 60%);
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 18px 60px;
}

/* إخفاء المحتوى حتى تصل البيانات — يمنع ظهور اسم مؤقت ثم تغيّره */
.wrap.booting { opacity: 0; }
.wrap.ready   { opacity: 1; transition: opacity .18s ease; }

.brand h1:empty::before,
.range:empty::before {
  content: '\00a0';                 /* يحجز الارتفاع فلا تقفز الصفحة */
}

/* ---------------- الترويسة ---------------- */
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

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

.brand .mark {
  width: 52px; height: 52px;
  flex: none;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 14px;
  background: linear-gradient(145deg, #3a2c1c, #241b12);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.brand h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: .2px;
}

.brand .sub {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--ink-dim);
}

.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------- الأزرار ---------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 11px;
  cursor: pointer;
  transition: .16s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { background: var(--card-2); border-color: #4c3c2b; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-gold {
  background: linear-gradient(180deg, var(--gold), #c9973d);
  border-color: #a97e2c;
  color: #241a08;
}
.btn-gold:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--gold), #c9973d); }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffd9d2; border-color: #5d3229; background: #38211c; }
.btn-danger:hover { background: #46271f; border-color: #7a4034; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-icon { padding: 8px 11px; }

/* ---------------- شريط الأسبوع ---------------- */
.weekbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--bg-soft), rgba(29,23,18,.55));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.weekbar .label { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 3px; }
.weekbar .range { font-size: 19px; font-weight: 800; color: var(--gold-soft); }
.nav-group { display: flex; align-items: center; gap: 8px; }

.pill {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}
.pill-ok   { color: #d5f0c8; background: #1d2c19; border-color: #3c5d33; }
.pill-warn { color: #ffe3b8; background: #33260f; border-color: #6b4d1d; }

/* ---------------- شبكة الأيام ---------------- */
.days {
  display: grid;
  /* auto-fill لا auto-fit: تبقى البطاقات بحجمها الطبيعي عند تبقّي يوم أو يومين */
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 16px;
}

.day {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 210px;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}

.day-head .dname { font-size: 17px; font-weight: 800; }
.day-head .ddate { font-size: 12.5px; color: var(--ink-dim); }

.day.today { border-color: rgba(224,177,84,.55); }
.day.today .day-head {
  background: linear-gradient(180deg, rgba(224,177,84,.16), transparent);
}
.day.today .dname { color: var(--gold); }

.badge-today {
  font-size: 11px;
  font-weight: 700;
  color: #241a08;
  background: var(--gold);
  border-radius: 999px;
  padding: 2px 9px;
}

.day-body { padding: 12px 16px 16px; flex: 1; }

.cat-block + .cat-block { margin-top: 13px; }

.cat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.cat-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

ul.meals { list-style: none; margin: 0; padding: 0; }

ul.meals li {
  position: relative;
  padding: 5px 15px 5px 0;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.6;
}
ul.meals li::before {
  content: '';
  position: absolute;
  right: 3px;
  top: 14px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .8;
}

.empty {
  color: var(--ink-dim);
  font-size: 13.5px;
  text-align: center;
  padding: 26px 6px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* ---------------- تسجيل الدخول ---------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card .mark { margin: 0 auto 12px; }
.login-card h2 { margin: 0 0 6px; font-size: 21px; }
.login-card p.hint { margin: 0 0 18px; color: var(--ink-dim); font-size: 13.5px; }

label.fld { display: block; text-align: right; margin-bottom: 12px; }
label.fld span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }

input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--ink);
  background: #1a140f;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  outline: none;
  transition: .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(224,177,84,.14);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 120px; font-size: 12.5px; line-height: 1.6; }

.msg {
  font-size: 13.5px;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  display: none;
}
.msg.show { display: block; }
.msg.err { background: #3a2119; border: 1px solid #6b3327; color: #ffcfc5; }
.msg.ok  { background: #1d2c19; border: 1px solid #3c5d33; color: #d5f0c8; }

/* ---------------- لوحة الإدارة ---------------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.editor-day .day-body { padding-top: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  font-size: 13.5px;
}
.chip button {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #452a23;
  color: #ffd0c7;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.chip button:hover { background: #6b3a2e; }

.add-row { display: flex; gap: 8px; }
.add-row select { flex: 1; min-width: 0; }

section.panel { margin-top: 28px; }
section.panel > h3 {
  font-size: 17px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
section.panel > h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  align-items: start;
}

.dish-list { max-height: 340px; overflow: auto; margin-top: 4px; }
.dish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(58,46,34,.6);
  font-size: 14px;
}
.dish-row:last-child { border-bottom: 0; }
.dish-row .cat { font-size: 11.5px; color: var(--ink-dim); }

.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row > label.fld { flex: 1; min-width: 150px; margin-bottom: 0; }

.note { font-size: 12.5px; color: var(--ink-dim); line-height: 1.7; }

.foot {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------- الطباعة ---------------- */
@media print {
  :root { --ink: #1a1208; --ink-soft: #4a3c28; --ink-dim: #6b5c46; --line: #d8cbb4; }
  html, body { background: #fff !important; color: #1a1208 !important; }
  body { background-image: none !important; }
  .no-print, .head-actions, .foot { display: none !important; }
  .wrap { max-width: none; padding: 0; opacity: 1 !important; }
  .day, .card, .weekbar {
    background: #fff !important;
    border: 1px solid #d8cbb4 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .day-head { background: #f7f1e6 !important; }
  .day.today { border-color: #b8912f !important; }
  .day.today .dname, .weekbar .range { color: #8a6a1c !important; }
  ul.meals li { color: #1a1208 !important; }
  .brand .mark { background: #f7f1e6 !important; }
  .days { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

@media (max-width: 560px) {
  .brand h1 { font-size: 21px; }
  .weekbar { padding: 12px 14px; }
  .weekbar .range { font-size: 16px; }
}
