/* لوحة تحكم محتوى قرية أبو بدوي — تستخدم متغيّرات style.css (فاتح/داكن تلقائيًا). */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 18px;
  min-height: 100vh;
}

/* ── القائمة الجانبية ─────────────────────────────────────────────── */
.side { position: sticky; top: 14px; display: grid; gap: 14px; }
.side .brandrow { display: flex; align-items: center; gap: 10px; }
.side .brandrow img { width: 34px; height: 34px; border-radius: 10px; background: var(--card); }
.side .brandrow b { font-size: .98rem; }
.side .brandrow span { display: block; font-size: .74rem; color: var(--ink-soft); }
.side .brandrow .logobtn { margin-inline-start: auto; min-width: 0; min-height: 26px; padding: 3px 7px; font-size: .68rem; }

.nav { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; }
.nav button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: right;
  padding: 10px 11px; border: 0; border-radius: 11px; background: transparent; color: var(--ink);
  font-family: inherit; font-size: .9rem; cursor: pointer; }
.nav button:hover { background: var(--brand-soft); }
.nav button.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav button .n { margin-inline-start: auto; font-size: .72rem; opacity: .75; }

.who { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; font-size: .8rem; color: var(--ink-soft); display: grid; gap: 9px; }
.who b { color: var(--ink); font-size: .84rem; word-break: break-all; }

/* ── الأيقونات والصفوف المشتركة بين القائمة وشريط الأقسام ───────── */
.ic { display: inline-flex; line-height: 0; }
.icell { display: grid; place-items: center; width: 22px; flex: 0 0 22px; color: inherit; }
.ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── شريط الأقسام: قائمة جانبية بأسلوب المتاجر، قابلة للتصغير ────── */
.rail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; display: grid; gap: 6px; }
.railhead { display: flex; align-items: center; gap: 8px; padding: 2px 4px 7px;
  border-bottom: 1px solid var(--line); }
.railhead b { font-size: .82rem; }
.railhead .n { margin-inline-start: auto; font-size: .72rem; color: var(--ink-soft); }
.railtoggle { display: grid; place-items: center; min-width: 32px; min-height: 32px; padding: 0 6px; }
.secnav { display: grid; gap: 3px; max-height: 44vh; overflow: auto; overscroll-behavior: contain; }
.secnav .sec { display: flex; align-items: center; gap: 9px; width: 100%; text-align: right;
  padding: 9px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font-family: inherit; font-size: .85rem; cursor: pointer; }
.secnav .sec:hover { background: var(--brand-soft); }
.secnav .sec.active { background: var(--brand); color: #fff; font-weight: 600; }
.secnav .sec .n { margin-inline-start: auto; font-size: .7rem; opacity: .75; }

/* الوضع المصغّر: عمود أيقونات فقط */
.shell.railmin { grid-template-columns: 74px minmax(0, 1fr); }
.shell.railmin .brandrow { flex-direction: column; text-align: center; }
.shell.railmin .brandrow > div { display: none; }
.shell.railmin .ct { display: none; }
.shell.railmin .nav button { justify-content: center; padding: 10px 4px; }
.shell.railmin .nav .n { display: none; }
.shell.railmin .railhead { flex-direction: column; gap: 5px; }
.shell.railmin .railhead b { display: none; }
.shell.railmin .railhead .n { margin-inline-start: 0; }
.shell.railmin .secnav .sec { justify-content: center; padding: 9px 4px; position: relative; }
.shell.railmin .secnav .sec .n { position: absolute; inset-block-start: 1px; inset-inline-end: 3px;
  margin: 0; font-size: .58rem; opacity: 1; padding: 0 4px; border-radius: 999px; background: var(--brand-soft); }
.shell.railmin .secnav .sec.active .n { background: rgba(255, 255, 255, .28); }
.shell.railmin .railtoggle svg { transform: rotate(180deg); }
.shell.railmin .who { display: none; }
.shell.railmin .secnav { max-height: none; }
.shell.railmin .side { gap: 10px; }

/* ── الشريط العلوي للمنطقة الرئيسية ───────────────────────────────── */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.top h1 { font-size: 1.15rem; margin: 0; }
.top .sub { font-size: .8rem; color: var(--ink-soft); }
.main { min-width: 0; display: grid; gap: 14px; }

.banner { border-radius: 14px; padding: 11px 14px; font-size: .84rem; border: 1px solid var(--line);
  background: var(--card); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.banner.bad { border-color: #b3413a; color: #b3413a; }
.banner.info { border-color: var(--brand); color: var(--brand); }

/* ── البطاقات والنماذج ───────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; }
.card > h2 { font-size: .98rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card > h2 .n { font-size: .74rem; color: var(--ink-soft); font-weight: 400; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; } }

label { display: block; font-size: .78rem; color: var(--ink-soft); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--paper); color: var(--ink); font-family: inherit; font-size: .88rem;
}
textarea { min-height: 150px; line-height: 1.75; resize: vertical; }
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: 2px; height: 40px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink); }

.btn { padding: 9px 18px; border-radius: 999px; border: 1px solid transparent; background: var(--brand);
  color: #fff; font-family: inherit; font-size: .85rem; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn.warn { background: transparent; color: #b3413a; border-color: #c98b86; }
.btn.plain { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.spacer { margin-inline-start: auto; }

/* ── الجداول ─────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.table th { font-size: .74rem; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.table tr:hover td { background: var(--brand-soft); }
.table .num { width: 68px; }
.table .acts { white-space: nowrap; }
.iconbtn { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 9px;
  min-width: 34px; min-height: 34px; padding: 0 8px; cursor: pointer; font-size: .82rem; }
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }
.wrap { overflow-x: auto; }

.tag { display: inline-block; font-size: .7rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); }
.tag.published { color: #2e7d5b; border-color: #2e7d5b; }
.tag.draft { color: #9a6b00; border-color: #c9a227; }
.tag.scheduled { color: #2b5fa8; border-color: #2b5fa8; }
.tag.archived { color: var(--ink-soft); }
.tag.off { color: #b3413a; border-color: #b3413a; }

/* ── الوسائط ─────────────────────────────────────────────────────── */
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 16px; text-align: center;
  color: var(--ink-soft); cursor: pointer; transition: border-color .15s, background .15s; font-size: .84rem; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 11px; }
.thumb { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--paper); display: grid; }
.thumb .box { aspect-ratio: 4/3; display: grid; place-items: center; background: #0e1116; color: #cfd8d8; font-size: .74rem; }
.thumb .box img, .thumb .box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .box.audio { background: var(--paper); color: var(--ink-soft); }
.thumb .foot { display: flex; align-items: center; gap: 6px; padding: 6px 7px; font-size: .72rem; }
.thumb .foot input { font-size: .72rem; padding: 4px 6px; flex: 1; min-width: 0; }
.thumb .note { align-self: start; margin: 6px 7px -2px; font-size: .68rem; padding: 1px 7px;
  border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; }
.bar { height: 4px; background: var(--line); }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

/* ── حالات وإشعارات ─────────────────────────────────────────────── */
.state { font-size: .82rem; padding: 8px 12px; border-radius: 11px; background: var(--paper);
  border: 1px solid var(--line); min-height: 20px; }
.state.ok { border-color: #2e7d5b; color: #2e7d5b; }
.state.bad { border-color: #b3413a; color: #b3413a; }
.toast { position: fixed; inset-inline: 0; bottom: 18px; margin: 0 auto; width: fit-content; max-width: 92vw;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: .84rem;
  box-shadow: var(--shadow); z-index: 40; }
.muted { color: var(--ink-soft); font-size: .8rem; }
.preview { border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: var(--paper);
  font-size: .9rem; line-height: 1.8; overflow-wrap: anywhere; }
.preview h2 { font-size: 1rem; } .preview h3 { font-size: .95rem; }

/* شريط القوائم على الشاشات الصغيرة */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; }
  .nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .nav button { width: auto; white-space: nowrap; }

  /* التصغير بلا معنى على عرض ضيق: يعود الشريط موسّعًا وأفقيا */
  .shell.railmin { grid-template-columns: 1fr; }
  .shell.railmin .ct, .shell.railmin .railhead b, .shell.railmin .nav .n { display: inline; }
  .shell.railmin .brandrow { flex-direction: row; text-align: right; }
  .shell.railmin .brandrow > div { display: block; }
  .shell.railmin .nav button { justify-content: flex-start; padding: 10px 11px; }
  .shell.railmin .who { display: grid; }
  .railtoggle { display: none; }
  .railhead { border-bottom: 0; padding-bottom: 0; }
  .secnav { grid-auto-flow: column; grid-auto-columns: max-content; max-height: none; overflow-x: auto; }
  .secnav .sec { width: auto; white-space: nowrap; }
  .shell.railmin .secnav .sec { justify-content: flex-start; padding: 9px; position: static; }
  .shell.railmin .secnav .sec .n { position: static; inset: auto; margin-inline-start: 8px;
    background: none; font-size: .7rem; }
}
