/* ============================================================================
   مدادكم — نظام التصميم المشترك
   مبني على الهوية البصرية: الأخضر الزيتوني، الكريمي، شعار القلم
   RTL عربي بالكامل
   ============================================================================ */

:root {
  /* الألوان من ملف الباليت */
  --olive:        #414B3B;   /* الأساسي الداكن */
  --olive-deep:   #2E362B;   /* الثانوي الأغمق */
  --sage:         #6B7A5E;   /* أخضر فاتح للتمييز */
  --cream:        #F9F4F0;   /* الخلفية الأساسية */
  --cream-warm:   #F5F1E6;   /* محايد دافئ */
  --stone:        #A8A29E;   /* محايد رمادي */

  --ink:          #2E362B;   /* لون النص */
  --ink-soft:     #5A5F54;   /* نص ثانوي */

  --radius:       14px;
  --radius-sm:    8px;
  --shadow:       0 4px 20px rgba(46, 54, 43, 0.08);
  --shadow-lg:    0 12px 40px rgba(46, 54, 43, 0.14);

  --maxw:         1160px;
}

/* ===== الوضع الليلي ===== */
[data-theme="dark"] {
  --cream:        #1a1d18;
  --cream-warm:   #232720;
  --ink:          #E8E4DC;
  --ink-soft:     #A8A89E;
  --olive:        #8FA37E;
  --olive-deep:   #7A8C6A;
}
[data-theme="dark"] body { background: #1a1d18; color: #E8E4DC; }
[data-theme="dark"] .navbar { background: rgba(26,29,24,.95); border-bottom-color: rgba(143,163,126,.15); }
[data-theme="dark"] .card, [data-theme="dark"] .pane, [data-theme="dark"] .admin-panel { background: #232720; border-color: rgba(143,163,126,.12); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: #2a2e24; color: #E8E4DC; border-color: rgba(143,163,126,.2); }
[data-theme="dark"] .reader-wrap, [data-theme="dark"] .pane { background: #232720; }
[data-theme="dark"] .text-content { color: #E8E4DC; }

/* زر تبديل الوضع */
.theme-toggle { background:none; border:1.5px solid rgba(65,75,59,.2); border-radius:8px; width:36px; height:36px; cursor:pointer; font-size:1.1rem; display:grid; place-items:center; }
.theme-toggle:hover { border-color: var(--olive); }



* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Tajawal", "Segoe UI", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  direction: rtl;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* الخط العربي من جوجل فونتس — يُحمّل في رأس كل صفحة */

h1, h2, h3, h4 {
  font-family: "Tajawal", sans-serif;
  font-weight: 800;
  line-height: 1.3;
  color: var(--olive);
}

a { color: inherit; text-decoration: none; }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

/* ---- شريط التنقل ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(249, 244, 240, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(65, 75, 59, 0.1);
}
.navbar-inner {
  display: flex; align-items: center; 
  height: 72px; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; color: var(--olive); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--olive); display: grid; place-items: center;
  color: var(--cream); font-size: 1.1rem;
}
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-link { font-weight: 600; color: var(--ink-soft); transition: color .2s; white-space: nowrap; }
.nav-link:hover { color: var(--olive); }
.nav-admin { color: var(--sage); }
#nav-auth { display: flex; align-items: center; gap: 16px; }

.nav-toggle { display: none; background: none; border: 0; font-size: 1.6rem; color: var(--olive); cursor: pointer; }

/* ---- الأزرار ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: 1rem;
  padding: 12px 26px; border-radius: var(--radius-sm); border: 0;
  cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--olive); color: var(--cream); }
.btn-primary:hover { background: var(--olive-deep); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--olive); border: 1.5px solid var(--olive); }
.btn-ghost:hover { background: var(--olive); color: var(--cream); }
.btn-sm { padding: 8px 18px; font-size: .92rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- الأقسام ---- */
.section { padding: 80px 0; }
.eyebrow { color: var(--sage); font-weight: 700; letter-spacing: .5px; margin-bottom: 10px; }
.section-title { font-size: 2.2rem; margin-bottom: 12px; }
.section-sub { color: var(--ink-soft); font-size: 1.1rem; max-width: 600px; }
.center { text-align: center; }
.center .section-sub { margin-inline: auto; }

/* ---- البطل (Hero) ---- */
.hero {
  background:
    radial-gradient(circle at 80% 20%, rgba(107,122,94,.18), transparent 50%),
    var(--cream);
  padding: 90px 0 70px;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center; }
.hero h1 { font-size: 3.1rem; margin-bottom: 18px; }
.hero h1 .accent { color: var(--sage); }
.hero p { font-size: 1.2rem; color: var(--ink-soft); margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* بطاقة معاينة الاختبار في البطل */
.preview-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 26px; border: 1px solid rgba(65,75,59,.08);
}
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.preview-tag { background: var(--cream-warm); color: var(--olive); font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.preview-q { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed rgba(65,75,59,.12); }
.preview-q:last-child { border-bottom: 0; }
.q-num { width: 26px; height: 26px; flex-shrink: 0; background: var(--olive); color: var(--cream); border-radius: 7px; display: grid; place-items: center; font-size: .82rem; font-weight: 700; }
.q-text { flex: 1; font-size: .96rem; }
.bloom-pill { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: rgba(107,122,94,.15); color: var(--sage); white-space: nowrap; }

/* ---- شريط الإحصاءات ---- */
.stats { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 36px; }
.stat-num { font-size: 2.4rem; font-weight: 800; color: var(--olive); }
.stat-label { color: var(--ink-soft); font-size: .95rem; }

/* ---- شبكة المزايا ---- */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 46px; }
.feature {
  background: #fff; border-radius: var(--radius); padding: 28px;
  border: 1px solid rgba(65,75,59,.08); transition: transform .2s, box-shadow .2s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon { font-size: 1.8rem; margin-bottom: 12px; }
.feature h3 { font-size: 1.2rem; margin-bottom: 8px; }
.feature p { color: var(--ink-soft); font-size: .98rem; }

/* ---- الاقتباس (هوية العلامة) ---- */
.quote-band { background: var(--olive); color: var(--cream); padding: 60px 0; text-align: center; }
.quote-band blockquote { font-size: 1.9rem; font-weight: 700; max-width: 760px; margin-inline: auto; line-height: 1.5; }
.quote-band cite { display: block; margin-top: 16px; color: var(--stone); font-style: normal; font-size: 1rem; }

/* ---- المكتبة: الفلاتر + الشبكة ---- */
.library-layout { display: grid; grid-template-columns: 270px 1fr; gap: 32px; align-items: start; }
.filters {
  background: #fff; border-radius: var(--radius); padding: 20px;
  border: 1px solid rgba(65,75,59,.08); position: sticky; top: 90px;
  box-shadow: 0 2px 12px rgba(65,75,59,.04);
}
.filters > .filter-group:not(:last-of-type) { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid rgba(65,75,59,.07); }
.filter-group { margin-bottom: 18px; }
.filter-group > label, .filter-group h4 { display:block; font-size: .82rem; font-weight: 800; margin-bottom: 10px; color: var(--olive); letter-spacing:.01em; }
.filter-group input[type="text"], .filter-group select {
  width:100%; padding:10px 13px; border:1.5px solid rgba(65,75,59,.18);
  border-radius:10px; font-family:inherit; font-size:.92rem; box-sizing:border-box;
  background:var(--cream-warm); transition:border-color .15s, background .15s;
}
.filter-group input[type="text"]:focus, .filter-group select:focus { outline:none; border-color:var(--olive); background:#fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: .85rem; padding: 6px 14px; border-radius: 20px; cursor: pointer;
  background: var(--cream-warm); color: var(--ink-soft); border: 1.5px solid transparent;
  transition: all .15s; user-select: none; font-weight:600;
}
.chip:hover { border-color: var(--sage); color:var(--olive); }
.chip.active { background: var(--olive); color: var(--cream); border-color:var(--olive); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.result-count { font-weight: 700; color: var(--olive); }
.sort-select { font-family: inherit; padding: 9px 14px; border-radius: var(--radius-sm); border: 1.5px solid rgba(65,75,59,.2); background: #fff; color: var(--ink); cursor: pointer; font-weight:600; }
/* رأس قائمة النتائج: عدّاد + ترتيب */
.results-bar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.results-count { font-size:.9rem; color:var(--ink-soft); font-weight:700; }
.results-count b { color:var(--olive); }
/* الجوال: الفلتر يصير فوق النتائج بدون قطع */
@media(max-width:900px){
  .filters { position:static; }
  .filter-group .chip-row { gap:8px; }
}

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.text-card {
  background: #fff; text-decoration: none; color: inherit; border-radius: var(--radius); padding: 22px;
  border: 1px solid rgba(65,75,59,.08); display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.text-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.type-badge { align-self: flex-start; font-size: .76rem; font-weight: 700; padding: 3px 11px; border-radius: 20px; margin-bottom: 12px; }
.type-informational { background: rgba(107,122,94,.16); color: var(--sage); }
.type-narrative { background: rgba(168,162,158,.22); color: var(--ink-soft); }
.type-poetic { background: rgba(65,75,59,.12); color: var(--olive); }
.text-card h3 { font-size: 1.15rem; margin-bottom: 10px; }
.card-excerpt { color: var(--ink-soft); font-size: .92rem; flex: 1; margin-bottom: 14px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: var(--ink-soft); margin-bottom: 14px; }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-foot { display: flex; gap: 8px; }

/* حالة التحميل والفراغ */
.state-msg { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(65,75,59,.2); border-top-color: var(--olive); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- النماذج (دخول/تسجيل/أدمن) ---- */
.auth-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 40px 20px; }
.auth-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 440px; border: 1px solid rgba(65,75,59,.08); }
.auth-card h1 { font-size: 1.8rem; margin-bottom: 6px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--ink-soft); margin-bottom: 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font-family: inherit; font-size: 1rem; padding: 11px 14px;
  border: 1.5px solid rgba(65,75,59,.2); border-radius: var(--radius-sm);
  background: var(--cream); color: var(--ink); transition: border .2s;
  box-sizing: border-box;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--olive); }
.field textarea { resize: vertical; min-height: 100px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--ink-soft); font-size: .95rem; }
.auth-foot a { color: var(--olive); font-weight: 700; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .94rem; }
.alert-error { background: #fae8e8; color: #9b2c2c; }
.alert-success { background: rgba(107,122,94,.18); color: var(--olive); }
.alert-info { background: var(--cream-warm); color: var(--ink-soft); }

/* ---- لوحة التحكم (أدمن) ---- */
.admin-layout { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 24px; padding-top: 32px; max-width: 1400px; }
.admin-layout > main { min-width: 0; }
.admin-nav { background: #fff; border-radius: var(--radius); padding: 16px; border: 1px solid rgba(65,75,59,.08); position: sticky; top: 90px; }
.admin-nav button { display: block; width: 100%; text-align: right; background: none; border: 0; font-family: inherit; font-size: 1rem; font-weight: 600; color: var(--ink-soft); padding: 11px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; }
.admin-nav button:hover { background: var(--cream-warm); }
.admin-nav button.active { background: var(--olive); color: var(--cream); }
.admin-panel { background: #fff; border-radius: var(--radius); padding: 28px; border: 1px solid rgba(65,75,59,.08); }
.admin-panel h2 { font-size: 1.5rem; margin-bottom: 20px; }

/* ===== إدارة المحتوى — جدول عريض قابل للبحث (يتّسع لآلاف العناصر) ===== */
.manage-searchbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.manage-searchbar input {
  flex:1; min-width:240px; padding:11px 15px; border:1.5px solid rgba(65,75,59,.18);
  border-radius:10px; font-family:inherit; font-size:.95rem; background:var(--cream-warm);
  transition:border-color .15s, background .15s;
}
.manage-searchbar input:focus { outline:none; border-color:var(--olive); background:#fff; }
.manage-count { font-size:.88rem; font-weight:700; color:var(--ink-soft); white-space:nowrap; }
.manage-count b { color:var(--olive); }

.manage-table { font-size:.85rem; }
.manage-table th { font-size:.73rem; padding:8px 5px; }
.manage-table td { vertical-align:middle; padding:8px 5px; }
.mng-code {
  display:inline-block; font-family:monospace; font-weight:700; font-size:.8rem;
  background:var(--cream-warm); color:var(--olive); padding:3px 8px; border-radius:7px;
  cursor:pointer; white-space:nowrap; transition:background .15s;
}
.mng-code:hover { background:rgba(65,75,59,.14); }
.mng-title { font-weight:700; color:var(--ink); max-width:170px; white-space:normal; line-height:1.35; }
.mng-free { color:#2E7D32; font-weight:700; }
.mng-dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-inline-end:6px; vertical-align:middle; }
.mng-dot.on { background:#2E7D32; }
.mng-dot.off { background:rgba(65,75,59,.3); }
.mng-acts { display:flex; gap:4px; align-items:center; }
.mng-btn {
  display:inline-grid; place-items:center; width:31px; height:31px; border-radius:8px;
  border:1px solid rgba(65,75,59,.15); background:#fff; cursor:pointer; font-size:.9rem;
  text-decoration:none; transition:all .12s; line-height:1;
}
.mng-btn:hover { background:var(--cream-warm); border-color:var(--olive); }
.mng-btn.edit { background:var(--olive); border-color:var(--olive); }
.mng-btn.del:hover { background:rgba(155,44,44,.1); border-color:#9b2c2c; }
[data-theme="dark"] .mng-btn { background:#232720; }

/* ===== لوحة البلاغات ===== */
.reports-list { display:flex; flex-direction:column; gap:14px; }
.report-card { background:#fff; border:1px solid rgba(65,75,59,.12); border-radius:12px; padding:16px; border-right:4px solid var(--ink-soft); }
.report-card.status-new { border-right-color:#d97706; }
.report-card.status-in_progress { border-right-color:#2563eb; }
.report-card.status-resolved { border-right-color:#2E7D32; opacity:.75; }
.report-top { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; }
.report-cat { font-weight:800; color:var(--olive); font-size:.95rem; }
.report-status { font-size:.74rem; font-weight:700; padding:3px 10px; border-radius:20px; }
.report-status.s-new { background:rgba(217,119,6,.12); color:#d97706; }
.report-status.s-in_progress { background:rgba(37,99,235,.12); color:#2563eb; }
.report-status.s-resolved { background:rgba(46,125,50,.12); color:#2E7D32; }
.report-text { font-size:.88rem; color:var(--ink-soft); margin-bottom:8px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.report-msg { background:var(--cream-warm); padding:12px; border-radius:8px; font-size:.92rem; line-height:1.7; margin-bottom:8px; }
.report-meta { font-size:.78rem; color:var(--ink-soft); font-family:monospace; margin-bottom:12px; word-break:break-all; }
.report-acts { display:flex; gap:8px; flex-wrap:wrap; }
[data-theme="dark"] .report-card { background:#232720; }

/* ===== نافذة تفاصيل المستخدم ===== */
.ud-name { font-size:1.2rem; font-weight:800; color:var(--ink); margin-bottom:16px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ud-badge { font-size:.7rem; font-weight:700; padding:2px 9px; border-radius:20px; }
.ud-badge.admin { background:rgba(124,58,237,.12); color:#7c3aed; }
.ud-badge.ban { background:rgba(155,44,44,.12); color:#9b2c2c; }
.ud-badge.ok { background:rgba(46,125,50,.12); color:#2E7D32; }
.ud-row { display:flex; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid rgba(65,75,59,.08); font-size:.92rem; }
.ud-label { color:var(--ink-soft); font-weight:600; }
.ud-val { color:var(--ink); font-weight:700; text-align:left; }
.ud-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:18px; }
.ud-stat { background:var(--cream-warm); border-radius:10px; padding:14px 8px; text-align:center; }
.ud-stat-num { font-size:1.3rem; font-weight:800; color:var(--olive); }
.ud-stat-lbl { font-size:.75rem; color:var(--ink-soft); margin-top:2px; }
@media(max-width:900px){ .manage-table { min-width:820px; } }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.q-builder { border: 1px dashed rgba(65,75,59,.25); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.q-builder-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.q-remove { background: none; border: 0; color: #9b2c2c; cursor: pointer; font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.data-table th, .data-table td { text-align: right; padding: 11px 14px; border-bottom: 1px solid rgba(65,75,59,.1); font-size: .92rem; }
.data-table th { color: var(--olive); font-weight: 700; }
.table-action { background: none; border: 0; color: var(--olive); cursor: pointer; font-weight: 700; font-size: .9rem; }

/* ---- التذييل ---- */
.footer { background: var(--olive-deep); color: var(--cream); padding: 56px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 36px; }
.footer h4 { color: var(--cream); font-size: 1.05rem; margin-bottom: 14px; }
.footer p { color: var(--stone); font-size: .95rem; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 9px; }
.footer a { color: var(--stone); font-size: .94rem; transition: color .2s; }
.footer a:hover { color: var(--cream); }
.footer-brand { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; margin-bottom: 12px; }
.footer-bottom { border-top: 1px solid rgba(249,244,240,.15); padding-top: 22px; text-align: center; color: var(--stone); font-size: .9rem; }

/* ---- النص المفرد ---- */
.text-view { max-width: 800px; margin-inline: auto; }
.text-view-head { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 2px solid rgba(65,75,59,.12); }
.text-view-head h1 { font-size: 2.2rem; margin-bottom: 14px; }
.text-body { font-size: 1.15rem; line-height: 2; white-space: pre-wrap; background: #fff; padding: 32px; border-radius: var(--radius); border: 1px solid rgba(65,75,59,.08); margin-bottom: 28px; }
.questions-block { background: var(--cream-warm); padding: 28px; border-radius: var(--radius); }
.questions-block h2 { font-size: 1.4rem; margin-bottom: 18px; }
.question-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px dashed rgba(65,75,59,.15); }
.question-item:last-child { border-bottom: 0; }
.download-bar { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0; padding: 20px; background: #fff; border-radius: var(--radius); border: 1px solid rgba(65,75,59,.08); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .library-layout { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .filters, .admin-nav { position: static; }
  /* قائمة المدير: شريط أفقي قابل للتمرير بدل عمود يقطع الشاشة */
  .admin-nav { display: flex; gap: 6px; overflow-x: auto; padding: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .admin-nav button { display: inline-block; width: auto; white-space: nowrap; flex-shrink: 0; text-align: center; font-size: .92rem; padding: 10px 14px; }
  .admin-panel { padding: 18px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}

:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }

/* ===== رأس الصفحة المتجاوب ===== */
.nav-active { color:var(--olive) !important; font-weight:800 !important; border-bottom:2px solid var(--olive); }

@media(max-width:700px){ .two-col{ grid-template-columns:1fr !important; } }

/* ===== جدول الطلبات المرمّز بالألوان ===== */
.req-table { width:100%; border-collapse:collapse; font-size:.9rem; }
.req-table th { text-align:right; padding:11px 12px; background:var(--cream-warm); font-weight:700; color:var(--olive); font-size:.82rem; border-bottom:2px solid rgba(65,75,59,.1); }
.req-table td { padding:11px 12px; border-bottom:1px solid rgba(65,75,59,.08); vertical-align:middle; }
.req-table tr.row-new td:first-child { border-right:3px solid #2563eb; }
.req-table tr.row-in_progress td:first-child { border-right:3px solid #d97706; }
.req-table tr.row-done td:first-child { border-right:3px solid #16a34a; }
.req-table tr.row-cancelled td:first-child { border-right:3px solid #9b2c2c; }
.req-table tr.row-cancelled { opacity:.55; }
.st-pill { display:inline-block; padding:3px 11px; border-radius:20px; font-size:.78rem; font-weight:700; white-space:nowrap; }
.st-new { background:#dbeafe; color:#1e40af; }
.st-in_progress { background:#fed7aa; color:#9a3412; }
.st-done { background:#dcfce7; color:#166534; }
.st-cancelled { background:#fde2e2; color:#9b2c2c; }
.req-num-cell { font-weight:800; color:var(--olive); white-space:nowrap; }
.req-req-cell { max-width:280px; }
.req-expand { cursor:pointer; color:var(--sage); font-size:.82rem; font-weight:700; }
.req-detail { background:var(--cream-warm); }
.req-detail td { padding:16px; }
.req-table tr.row-needs_info td:first-child,.req-table tr.row-needs_revision td:first-child { border-right:3px solid #7c3aed; }
.st-needs_info,.st-needs_revision { background:#ede9fe; color:#6d28d9; }

/* ===== التذييل الموحّد ===== */
.site-footer { background:var(--olive-deep); color:var(--cream); margin-top:60px; padding:40px 20px 24px; }
.footer-inner { max-width:1100px; margin:0 auto; text-align:center; }
.site-footer .footer-brand { font-size:1.4rem; font-weight:800; margin-bottom:18px; display:inline-flex; align-items:center; gap:8px; }
.footer-social { display:flex; justify-content:center; gap:14px; margin-bottom:20px; }
.social-btn { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; color:#fff; transition:transform .2s, opacity .2s; }
.social-btn:hover { transform:translateY(-3px); opacity:.85; }
.social-btn.wa { background:#25D366; }
.social-btn.ig { background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }
.social-btn.em { background:var(--sage); }
.footer-links { display:flex; justify-content:center; gap:20px; flex-wrap:wrap; margin-bottom:18px; }
.footer-links a { color:rgba(249,244,240,.85); font-size:.92rem; }
.footer-links a:hover { color:#fff; }
.footer-bottom { font-size:.82rem; color:rgba(249,244,240,.6); padding-top:18px; border-top:1px solid rgba(249,244,240,.15); }

/* منع التمرير الأفقي للصفحة */
html, body { overflow-x: hidden; max-width: 100%; }

/* تثبيت عرض الصفحة بغضّ النظر عن شريط التمرير (يمنع تزحزح القائمة) */
html { scrollbar-gutter: stable; }

/* ===== شارة السعر على البطاقات ===== */
.card-top { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:6px; }

/* بطاقة المحتوى: رابط + أزرار (يدعم زر تعديل المدير) */
.card-code { display:inline-block; font-family:monospace; font-size:.72rem; font-weight:700; color:var(--olive); background:rgba(65,75,59,.08); padding:2px 8px; border-radius:6px; margin-top:8px; letter-spacing:.02em; }
.code-badge { font-family:monospace; font-weight:800; letter-spacing:.03em; background:var(--olive) !important; color:var(--cream) !important; }
.text-card .card-link { display:flex; flex-direction:column; text-decoration:none; color:inherit; flex:1; }
.card-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:auto; padding-top:12px; align-items:center; }
.card-actions .btn { align-self:flex-start; }
.card-edit-btn { white-space:nowrap; }

/* نافذة التعديل المنبثقة (مشتركة بين كل الصفحات) */
.modal-overlay { position:fixed; inset:0; background:rgba(20,24,18,.55); z-index:9997; display:flex; align-items:flex-start; justify-content:center; padding:24px 14px; overflow-y:auto; }
.modal-card { background:var(--cream); border-radius:16px; width:100%; max-width:560px; box-shadow:0 20px 60px rgba(0,0,0,.3); margin:auto; }
[data-theme="dark"] .modal-card { background:#232720; }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 22px; border-bottom:1px solid rgba(65,75,59,.12); }
.modal-head h3 { font-size:1.1rem; color:var(--olive); margin:0; }
.modal-x { background:none; border:0; font-size:1.3rem; cursor:pointer; color:var(--ink-soft); line-height:1; padding:4px 8px; border-radius:8px; }
.modal-x:hover { background:rgba(65,75,59,.1); }
.modal-body { padding:20px 22px; }
.modal-foot { display:flex; gap:10px; justify-content:flex-end; padding:16px 22px; border-top:1px solid rgba(65,75,59,.12); }
@media(max-width:600px){ .modal-foot { flex-direction:column-reverse; } .modal-foot .btn { width:100%; } }

.price-tag { background:var(--olive); color:var(--cream); font-weight:800; font-size:.85rem; padding:4px 12px; border-radius:20px; white-space:nowrap; }
.price-tag.free { background:#dcfce7; color:#166534; }

/* ===== صندوق الشراء ===== */
.buy-box { display:flex; flex-direction:column; gap:18px; margin:20px 0; }
.buy-preview { background:#fff; border:1px solid rgba(65,75,59,.1); border-radius:var(--radius); padding:24px; text-align:center; box-shadow:var(--shadow); }
.preview-img { max-width:100%; max-height:420px; border-radius:10px; box-shadow:var(--shadow); border:1px solid rgba(65,75,59,.08); }
.preview-placeholder { padding:40px 20px; display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:200px; background:var(--cream-warm); border-radius:10px; gap:10px; }
.preview-placeholder .pv-title { font-weight:700; color:var(--olive); font-size:1.05rem; text-align:center; }
.buy-action { background:#fff; border:2px solid var(--olive); border-radius:var(--radius); padding:24px; text-align:center; box-shadow:var(--shadow); max-width:480px; margin:0 auto; width:100%; box-sizing:border-box; }
.buy-price { font-size:2.4rem; font-weight:800; color:var(--olive); }
.buy-price span { font-size:1rem; font-weight:600; color:var(--ink-soft); }

/* ===== المراجعات (تخطيط عمودي احترافي — يعمل على الجوال والكمبيوتر) ===== */
.reviews-block { background:#fff; border:1px solid rgba(65,75,59,.1); border-radius:var(--radius); padding:24px; margin-top:22px; box-shadow:var(--shadow); }
.reviews-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:18px; padding-bottom:14px; border-bottom:1px solid rgba(65,75,59,.1); }
.reviews-head h3 { margin:0; font-size:1.2rem; color:var(--olive); }
.rating-summary { display:flex; align-items:center; gap:8px; }
.rating-num { font-size:1.6rem; font-weight:800; color:var(--olive); }
.rating-stars { color:#f59e0b; font-size:1.1rem; }
.rating-count { color:var(--ink-soft); font-size:.85rem; }

/* صندوق كتابة المراجعة: كل عنصر في سطره، textarea بعرض كامل */
.add-review { background:var(--cream-warm); border-radius:12px; padding:18px; margin-bottom:22px; }
.add-review > label { display:block; font-weight:700; font-size:.92rem; color:var(--ink); margin-bottom:8px; }
.star-input { display:flex; gap:6px; font-size:1.9rem; color:#f59e0b; cursor:pointer; margin-bottom:14px; line-height:1; }
.star-input .star { transition:transform .1s; }
.star-input .star:hover { transform:scale(1.15); }
.add-review textarea {
  display:block; width:100%; box-sizing:border-box; min-height:84px; resize:vertical;
  padding:12px 14px; border:1.5px solid rgba(65,75,59,.18); border-radius:10px;
  font-family:inherit; font-size:.95rem; background:#fff; color:var(--ink);
  margin-bottom:14px; transition:border-color .15s;
}
.add-review textarea:focus { outline:none; border-color:var(--olive); }
.add-review .btn { width:auto; }
@media(max-width:560px){ .add-review .btn { width:100%; } }

/* قائمة المراجعات */
.reviews-list { display:flex; flex-direction:column; gap:0; }
.review-item { padding:16px 0; border-bottom:1px solid rgba(65,75,59,.07); }
.review-item:last-child { border-bottom:0; }
.review-meta { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.review-meta strong { color:var(--ink); }
.review-stars { color:#f59e0b; font-size:1rem; letter-spacing:1px; }
.review-date { color:var(--ink-soft); font-size:.78rem; margin-inline-start:auto; }
.review-item p { margin-top:7px; color:var(--ink-soft); font-size:.94rem; line-height:1.7; }
[data-theme="dark"] .add-review textarea { background:#1f231c; color:var(--ink); }

/* ===== لوحة متابعة المدير ===== */
.dash-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:16px; }
.dash-grid.primary { grid-template-columns:repeat(4,1fr); }
@media(max-width:980px){ .dash-grid.primary { grid-template-columns:repeat(2,1fr); } }
@media(max-width:560px){ .dash-grid, .dash-grid.primary { grid-template-columns:repeat(2,1fr); } }
@media(max-width:380px){ .dash-grid, .dash-grid.primary { grid-template-columns:1fr; } }
.dash-card { background:#fff; border:1px solid rgba(65,75,59,.1); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); display:flex; flex-direction:column; justify-content:center; min-height:96px; text-align:right; }
.dash-card.hl { background:linear-gradient(135deg,var(--olive),var(--olive-deep)); color:var(--cream); border:0; }
.dash-card.hl .dash-label,.dash-card.hl .dash-sub { color:rgba(249,244,240,.85); }
.dash-label { font-size:.82rem; color:var(--ink-soft); margin-bottom:6px; }
.dash-num { font-size:1.7rem; font-weight:800; color:var(--olive); line-height:1.1; }
.dash-card.hl .dash-num { color:#fff; }
.dash-sub { font-size:.75rem; color:var(--ink-soft); margin-top:4px; }
.dash-tables { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; margin-top:8px; }
.dash-tables > div { min-width:0; overflow-x:auto; -webkit-overflow-scrolling:touch; }
@media(max-width:820px){ .dash-tables { grid-template-columns:1fr; } }
.dash-table-box { background:#fff; border:1px solid rgba(65,75,59,.1); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); }
.dash-table-box h3 { margin-bottom:12px; color:var(--olive); font-size:1.05rem; }
.mini-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.mini-table th { text-align:right; padding:8px; color:var(--ink-soft); font-size:.78rem; border-bottom:1px solid rgba(65,75,59,.1); }
.mini-table td { padding:8px; border-bottom:1px solid rgba(65,75,59,.06); }

/* رد الإدارة على المراجعات */
.admin-reply { background:#ede9fe; border-right:3px solid #7c3aed; padding:8px 12px; border-radius:8px; margin-top:8px; font-size:.88rem; }

/* ===== تلميع عام واتساق المحاذاة ===== */
.section { padding: 40px 0; }
.section-title { margin-bottom: 8px; line-height: 1.3; }
.section-sub { margin-bottom: 24px; color: var(--ink-soft); }
.eyebrow { margin-bottom: 10px; }
/* اتساق ارتفاع البطاقات */
.cards-grid { align-items: stretch; }
.text-card { display: flex; flex-direction: column; height: 100%; transition: transform .2s, box-shadow .2s; }
.text-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.text-card h3 { margin: 8px 0; line-height: 1.4; }
/* اتساق الحقول */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-weight: 700; font-size: .9rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid rgba(65,75,59,.2);
  border-radius: 10px; font-family: inherit; font-size: .95rem; box-sizing: border-box;
  background: #fff; transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--olive);
}
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 140px; }
/* اتساق الأزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
/* محاذاة الحاويات */
.container { padding-inline: 20px; box-sizing: border-box; }
/* تناسق العناوين في كل الأقسام */
h1, h2, h3 { line-height: 1.35; }

/* ========================================================
   القائمة العلوية الموحّدة — نظام واحد نظيف
   بنية ثلاثية: الشعار (يمين) · الروابط (وسط) · الأدوات (يسار)
   ======================================================== */
.navbar { width:100%; left:0; right:0; }
.navbar-inner {
  display:flex; align-items:center; gap:18px;
  width:100%; max-width:var(--maxw); box-sizing:border-box;
  margin-inline:auto; padding-inline:24px; position:relative;
}
.navbar-inner .brand { flex-shrink:0; }
.nav-center { display:flex; align-items:center; gap:18px; flex:1; justify-content:center; flex-wrap:nowrap; }
.nav-end { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.nav-auth-box { display:inline-flex; align-items:center; gap:8px; }
.nav-request-btn { white-space:nowrap; flex-shrink:0; }
.theme-toggle { flex-shrink:0; background:none; border:0; font-size:1.3rem; cursor:pointer; line-height:1; padding:4px; }
.nav-burger { display:none; background:none; border:0; font-size:1.6rem; cursor:pointer; color:var(--olive); line-height:1; padding:0 4px; }

/* ===== الجوال: تحت 980px تنطوي الروابط والأدوات في قائمة البرغر ===== */
@media(max-width:980px){
  .navbar-inner { gap:10px; justify-content:space-between; flex-wrap:wrap; height:auto; min-height:72px; padding-block:10px; }
  .brand { order:1; margin-inline-end:auto; }
  .theme-toggle { order:2; }
  .nav-burger { display:block; order:3; }

  /* الروابط: قائمة منسدلة تبدأ تحت الشريط */
  .nav-center {
    display:none; order:4; width:100%;
    flex-direction:column; align-items:stretch;
    background:var(--cream); padding:14px 18px 6px; gap:4px;
    border-top:1px solid rgba(65,75,59,.1); margin-top:10px;
    border-radius:0 0 12px 12px;
  }
  .nav-center.open { display:flex; }
  .nav-center .nav-link { padding:11px 6px; border-bottom:1px solid rgba(65,75,59,.06); }
  .nav-center .nav-link:last-child { border-bottom:0; }

  /* الأدوات: تأتي أسفل الروابط في نفس التدفّق (لا تتراكب فوقها) */
  .nav-end {
    display:none; order:5; width:100%;
    flex-direction:column; align-items:stretch;
    background:var(--cream); padding:0 18px 16px; gap:10px;
    border-radius:0 0 12px 12px;
  }
  .nav-end.open { display:flex; }
  .nav-auth-box { flex-direction:column; align-items:stretch; gap:10px; width:100%; }
  .nav-auth-box a, .nav-auth-box button { width:100%; text-align:center; }
  .nav-request-btn { display:flex !important; width:100%; }
}

/* ============================================================
   تمرير أفقي سلس للجداول على الجوال (مع مؤشّر بصري)
   ============================================================ */
.data-table, .req-table {
  min-width: 600px;          /* يحتفظ بعرضه بدل الانضغاط — فيظهر التمرير */
  width: 100%;
}
.mini-table { width: 100%; }   /* جداول اللوحة تتسع لعمودها، لا تُجبر على عرض ثابت على الديسكتوب */
/* حاوية التمرير: نلفّ بها كل جدول تلقائياً عبر JS، ونصمّمها هنا */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;   /* تمرير سلس على iOS */
  position: relative;
  border-radius: var(--radius);
  scrollbar-width: thin;
}
/* مؤشّر بصري: تدرّج خفيف على الحافة يلمّح أن فيه محتوى مخفي */
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(65,75,59,.3); border-radius: 3px; }
/* تلميح "اسحب" يظهر على الجوال فقط */
.table-hint {
  display: none; font-size: .78rem; color: var(--ink-soft);
  text-align: center; padding: 6px; background: var(--cream-warm);
  border-radius: 8px; margin-bottom: 8px;
}
@media(max-width:760px){
  .table-hint { display: block; }
  .data-table, .req-table, .mini-table { min-width: 560px; }
  /* خلايا الجدول لا تلتفّ كثيراً — تبقى مقروءة */
  .data-table td, .req-table td, .mini-table td { white-space: nowrap; }
  /* نسمح لخلية المحتوى/العنوان بالالتفاف عشان ما تطول كثير */
  .data-table td:first-child, .req-table td:nth-child(2) { white-space: normal; min-width: 120px; }
}

/* ============================================================
   إصلاح تمرير الجداول — نفس آلية dash-nav الناجحة
   ============================================================ */
.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}
/* الحاوية الأم يجب ألا تمنع التمرير */
.admin-panel, .card, .panel { max-width: 100%; }
.admin-panel { overflow: visible; }
/* الجدول داخل الحاوية: عرض ثابت يفرض التمرير */
.table-scroll > table { min-width: 640px; width: max-content; max-width: none; }
@media(max-width:760px){
  .table-scroll > table { min-width: 600px; }
}

/* ===== رمز الدرهم والسعر ===== */
.aed-symbol { color: currentColor; }
.price-num { font-weight: 800; }
.price-free { color: #166534; font-weight: 800; }
.price-tag .aed-symbol { width: 0.9em; height: 0.9em; }
.buy-price .aed-symbol { width: 0.8em; height: 0.8em; vertical-align: -0.05em; }
.buy-price { display: flex; align-items: center; justify-content: center; gap: 2px; }

/* ===== صندوق السعر في الطلب + حالات دورة العمل ===== */
.quote-box { background: var(--cream-warm); border: 2px solid var(--olive); border-radius: 12px; padding: 16px; margin: 12px 0; text-align: center; }
.st-quoted { background:#fef3c7; color:#b45309; }
.st-revision { background:#ede9fe; color:#7c3aed; }
.st-in_progress { background:#dbeafe; color:#1e40af; }

/* ===== أزرار وضع التعديل (رفع/اختيار) ===== */
.edit-mode-btn { flex:1; border:1.5px solid rgba(65,75,59,.2); }
.edit-mode-btn.active { background:var(--olive); color:var(--cream); border-color:var(--olive); }

/* السعر: الرمز يسار الرقم دائماً */
.price-wrap { display:inline-flex; align-items:center; gap:3px; direction:ltr; }

/* ============================================================
   بطاقات طلبات المدير — عرض واضح ومنظّم
   ============================================================ */
.req-cards { display: flex; flex-direction: column; gap: 14px; }
.req-card {
  background: #fff; border: 1px solid rgba(65,75,59,.12); border-radius: 14px;
  overflow: hidden; transition: box-shadow .2s;
}
.req-card:hover { box-shadow: 0 4px 16px rgba(65,75,59,.08); }
.req-card.is-cancelled { opacity: .65; }
[data-theme="dark"] .req-card { background: #232720; border-color: rgba(143,163,126,.15); }

.req-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer; gap: 10px; flex-wrap: wrap;
  background: var(--cream-warm); border-bottom: 1px solid rgba(65,75,59,.08);
}
.req-card-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-num { font-weight: 800; color: var(--olive); font-size: 1rem; letter-spacing: .3px; }
.req-tag-edit, .req-tag-new {
  font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 12px;
}
.req-tag-edit { background: #ede9fe; color: #7c3aed; }
.req-tag-new { background: #dbeafe; color: #1e40af; }

.req-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.req-card-line { display: flex; gap: 10px; font-size: .88rem; align-items: baseline; }
.req-card-label {
  flex-shrink: 0; width: 70px; color: var(--ink-soft); font-size: .8rem; font-weight: 700;
}
.req-card-line > span:last-child { flex: 1; }

.req-card-foot {
  padding: 10px 16px; border-top: 1px solid rgba(65,75,59,.08);
  cursor: pointer; text-align: center; background: var(--cream-warm);
}
.req-card-foot .req-expand { color: var(--olive); font-weight: 700; font-size: .88rem; }
.req-detail { padding: 16px; border-top: 2px solid var(--olive); background: rgba(65,75,59,.02); }

/* ===== شريط أدوات المدير في صفحة النص ===== */
.admin-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px;
  background: rgba(65,75,59,.06); border: 1px dashed var(--olive);
  border-radius: 10px;
}
.admin-bar-label { font-weight: 800; color: var(--olive); font-size: .85rem; }
