/* ============================================================
   موسوعة الغذاء والتراث الصحي — النمط الرئيسي
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=Amiri:ital@0;1&display=swap');

/* ── متغيرات ─────────────────────────────────────────── */
:root {
  --c-primary:      #1B4F35;
  --c-primary-mid:  #2D6A4F;
  --c-primary-light:#40916C;
  --c-accent:       #B7E4C7;
  --c-gold:         #9A7215;
  --c-gold-bg:      #FDF6E3;
  --c-warning:      #C0392B;
  --c-caution:      #E67E22;
  --c-info:         #2471A3;
  --c-bg:           #F6F7F4;
  --c-surface:      #FFFFFF;
  --c-text:         #1C1C1C;
  --c-text-2:       #4A5568;
  --c-text-3:       #9CA3AF;
  --c-border:       #E2E8E0;
  --c-border-dark:  #C8D5C4;
  --radius-sm:      6px;
  --radius:         12px;
  --radius-lg:      18px;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.06);
  --shadow:         0 4px 16px rgba(0,0,0,.08);
  --shadow-md:      0 8px 32px rgba(0,0,0,.12);
  --font:           'Tajawal', sans-serif;
}

/* aliases للتوافق مع الكود القديم */
:root {
  --color-primary:    var(--c-primary-mid);
  --color-secondary:  var(--c-primary-light);
  --color-accent:     var(--c-accent);
  --color-gold:       var(--c-gold);
  --color-warning:    var(--c-warning);
  --color-info:       var(--c-info);
  --color-bg:         var(--c-bg);
  --color-text:       var(--c-text);
  --color-text-muted: var(--c-text-2);
  --color-border:     var(--c-border);
}

/* ── ريست ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { direction: rtl; scroll-behavior: smooth; font-size: 16px; }
body  { font-family: var(--font); background: var(--c-bg); color: var(--c-text); line-height: 1.8; -webkit-font-smoothing: antialiased; }
a     { color: inherit; }
img   { max-width: 100%; }

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
.site-header {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-mid) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.22);
}
.site-header .inner {
  max-width: 1280px;
  margin: auto;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 66px;
}
.site-header .logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.01em;
}
.site-header .logo .logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.site-header .logo .logo-text-main { color: #fff; }
.site-header .logo .logo-text-sub  { color: var(--c-accent); font-weight: 400; font-size: .95rem; }

/* search in header */
.search-bar { flex: 1; max-width: 460px; position: relative; }
.search-bar form { display: flex; }
.search-bar input {
  width: 100%;
  padding: .55rem 1.1rem .55rem 2.8rem;
  border-radius: 30px;
  border: 1.5px solid rgba(255,255,255,.2);
  font-size: .92rem;
  font-family: var(--font);
  background: rgba(255,255,255,.13);
  color: #fff;
  outline: none;
  transition: background .2s, border-color .2s;
}
.search-bar input::placeholder { color: rgba(255,255,255,.55); }
.search-bar input:focus { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.4); }
.search-bar .search-icon {
  position: absolute;
  left: .95rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: .65;
  font-size: 1rem;
  pointer-events: none;
}

/* nav links */
.nav-links { display: flex; gap: .25rem; margin-right: auto; }
.nav-links a {
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .42rem .85rem;
  border-radius: var(--radius-sm);
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.nav-links a:hover  { background: rgba(255,255,255,.15); color: #fff; }
.nav-links a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 700; }

/* ══════════════════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════════════════ */
.breadcrumb-wrap {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: .6rem 0;
}
.breadcrumb {
  max-width: 1280px;
  margin: auto;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .84rem;
  color: var(--c-text-2);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--c-primary-mid);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.breadcrumb a:hover { color: var(--c-primary); text-decoration: underline; }
.breadcrumb .sep {
  color: var(--c-text-3);
  font-size: .8rem;
  margin: 0 .15rem;
  user-select: none;
}
.breadcrumb .current {
  color: var(--c-text);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════ */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.75rem; }
main { min-height: 60vh; }

/* ══════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════ */
.card {
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #FAFCF9;
  color: var(--c-primary);
}
.card-body { padding: 1.25rem 1.5rem; }

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .58rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 600;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn-primary  { background: var(--c-primary-mid); color: #fff; }
.btn-primary:hover { background: var(--c-primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,106,79,.3); }
.btn-outline  { background: transparent; border: 1.5px solid var(--c-primary-mid); color: var(--c-primary-mid); }
.btn-outline:hover { background: #EEF7F1; }
.btn-sm       { padding: .38rem .85rem; font-size: .82rem; }
.btn-danger   { background: #C0392B; color: #fff; }
.btn-danger:hover { background: #A93226; }

/* ══════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: .18rem .65rem;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-quran    { background: #D4EDDA; color: #155724; }
.badge-hadith   { background: #CCE5FF; color: #004085; }
.badge-heritage { background: #FFF3CD; color: #856404; }
.badge-modern   { background: #E2D9F3; color: #432874; }
.badge-warning  { background: #F8D7DA; color: #721C24; }
.badge-popular  { background: #FFE5D0; color: #7D2E00; }

/* درجات الحديث */
.grade-sahih    { background: #D4EDDA; color: #155724; }
.grade-hasan    { background: #D1ECF1; color: #0C5460; }
.grade-daeef    { background: #FFF3CD; color: #856404; }
.grade-mawdoo   { background: #F8D7DA; color: #721C24; }
.grade-disputed { background: #D6D8F7; color: #2B2D80; }
.grade-review   { background: #E2E3E5; color: #383D41; }

/* قوة الدليل */
.evidence-strong    { background: #D4EDDA; color: #155724; }
.evidence-moderate  { background: #CCE5FF; color: #004085; }
.evidence-weak      { background: #FFF3CD; color: #856404; }
.evidence-conflict  { background: #F8D7DA; color: #721C24; }

/* ══════════════════════════════════════════════════════
   STATUS BOX (حالة المادة)
══════════════════════════════════════════════════════ */
.status-box {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 1rem 1.5rem 1.25rem;
}
.status-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .83rem;
  font-weight: 500;
  padding: .38rem .9rem;
  border-radius: 30px;
  border: 1.5px solid transparent;
}
.status-item.yes {
  background: #D4EDDA;
  border-color: #A8D5B5;
  color: #155724;
}
.status-item.no {
  background: #F0F0F0;
  border-color: #D8D8D8;
  color: var(--c-text-3);
}

/* ══════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════ */
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--c-border);
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: #FAFCF9;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: .82rem 1.25rem;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--c-text-2);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all .18s;
}
.tab-btn:hover  { color: var(--c-primary-mid); background: rgba(45,106,79,.04); }
.tab-btn.active { color: var(--c-primary); border-color: var(--c-primary-mid); font-weight: 700; }
.tab-pane         { display: none; padding: 1.5rem; }
.tab-pane.active  { display: block; }

/* ══════════════════════════════════════════════════════
   NOTICE BOXES
══════════════════════════════════════════════════════ */
.notice {
  padding: .85rem 1.15rem;
  border-radius: var(--radius-sm);
  border-right: 4px solid;
  margin: .75rem 0 1rem;
  font-size: .88rem;
  line-height: 1.7;
}
.notice-info    { background: #EBF5FB; border-color: var(--c-info); color: #1A4D6E; }
.notice-caution { background: #FEF5EC; border-color: var(--c-caution); color: #784212; }
.notice-warning { background: #FDEDEC; border-color: var(--c-warning); color: #641E16; }
.notice-method  { background: #EAFAF1; border-color: var(--c-primary-mid); color: #1E5631; }

/* ══════════════════════════════════════════════════════
   DISCLAIMER BANNER
══════════════════════════════════════════════════════ */
.disclaimer-banner {
  background: linear-gradient(135deg, #FFFDF0, #FFF8DC);
  border: 1px solid #EDD56A;
  border-radius: var(--radius);
  padding: .9rem 1.4rem;
  margin-bottom: 1.5rem;
  font-size: .87rem;
  color: #5D4037;
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  box-shadow: 0 1px 6px rgba(237,213,106,.25);
}
.disclaimer-banner .icon { font-size: 1.3rem; flex-shrink: 0; margin-top: .05rem; }

/* ══════════════════════════════════════════════════════
   MATERIAL GRID CARD
══════════════════════════════════════════════════════ */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 1.1rem;
}
.material-card {
  text-decoration: none;
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  overflow: hidden;
  background: var(--c-surface);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.material-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-dark);
}
.material-card .mc-head {
  padding: 1.15rem 1.25rem .65rem;
  border-bottom: 1px solid var(--c-border);
}
.material-card .mc-name { font-size: 1.2rem; font-weight: 700; color: var(--c-primary); line-height: 1.3; }
.material-card .mc-en   { font-size: .8rem; color: var(--c-text-3); direction: ltr; margin-top: .2rem; }
.material-card .mc-desc {
  padding: .75rem 1.25rem;
  font-size: .88rem;
  color: var(--c-text-2);
  flex: 1;
  line-height: 1.65;
}
.material-card .mc-foot {
  padding: .6rem 1.25rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  background: #FAFCF9;
}

/* ══════════════════════════════════════════════════════
   SEARCH RESULTS
══════════════════════════════════════════════════════ */
.search-result {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--c-border);
}
.search-result:last-child { border-bottom: none; }
.search-result a {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--c-primary);
  text-decoration: none;
}
.search-result a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: .4rem;
  font-size: .9rem;
  color: var(--c-text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .93rem;
  color: var(--c-text);
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px rgba(64,145,108,.12);
}
.form-group textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 190px; }

/* ══════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════ */
.alert {
  padding: .85rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.alert-success { background: #D4EDDA; color: #155724; border-right: 4px solid #28A745; }
.alert-error   { background: #F8D7DA; color: #721C24; border-right: 4px solid #DC3545; }
.alert-info    { background: #CCE5FF; color: #004085; border-right: 4px solid #007BFF; }

/* ══════════════════════════════════════════════════════
   DATA TABLE
══════════════════════════════════════════════════════ */
.data-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.data-table th {
  background: #F3F7F4;
  font-weight: 700;
  color: var(--c-primary);
  padding: .7rem 1rem;
  border-bottom: 2px solid var(--c-border-dark);
  text-align: right;
  white-space: nowrap;
}
.data-table td {
  padding: .72rem 1rem;
  border-bottom: 1px solid var(--c-border);
  text-align: right;
  vertical-align: middle;
}
.data-table tr:hover td { background: #F8FBF8; }
.data-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */
.site-footer {
  background: linear-gradient(135deg, #162820, #1B3A2A);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 2.5rem 1.75rem;
  margin-top: 5rem;
  font-size: .87rem;
}
.site-footer a { color: var(--c-accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   REPORT BUTTON & BACK-TO-TOP
══════════════════════════════════════════════════════ */
.report-btn {
  position: fixed;
  bottom: 1.75rem;
  left: 1.75rem;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: .65rem 1.2rem;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
  z-index: 50;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.report-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.28); }

.back-top {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  background: var(--c-primary-mid);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .2s;
  z-index: 50;
  font-size: 1.1rem;
}
.back-top.visible { opacity: 1; pointer-events: auto; }
.back-top:hover   { transform: translateY(-2px); }

/* ══════════════════════════════════════════════════════
   REPORT MODAL
══════════════════════════════════════════════════════ */
#report-modal .modal-inner {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: scale(.95) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
#report-modal h3 { margin-bottom: 1.25rem; color: var(--c-primary); font-size: 1.1rem; }

/* ══════════════════════════════════════════════════════
   ADMIN — LAYOUT
══════════════════════════════════════════════════════ */
.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  width: 256px;
  background: linear-gradient(180deg, #162820 0%, #1E3A2E 100%);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.admin-sidebar::-webkit-scrollbar       { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.admin-sidebar .logo {
  padding: 1.5rem 1.4rem 1.25rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.admin-sidebar .logo .logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}

.admin-nav { padding: .75rem 0; flex: 1; overflow-y: auto; }
.admin-nav .nav-group-title {
  padding: 1.1rem 1.4rem .35rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1.4rem;
  color: rgba(255,255,255,.68);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  transition: all .18s;
  border-right: 3px solid transparent;
  margin: 1px 0;
}
.admin-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.admin-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 700;
  border-right-color: var(--c-accent);
}

/* Main area */
.admin-main {
  flex: 1;
  padding: 2rem 2.25rem;
  background: #F1F4F0;
  min-width: 0;
}

/* Top bar inside admin-main */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.admin-page-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--c-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Stat cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #fff;
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow .18s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary-mid), var(--c-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-info { flex: 1; min-width: 0; }
.stat-card .stat-num   { font-size: 1.75rem; font-weight: 800; color: var(--c-primary); line-height: 1.1; }
.stat-card .stat-label { font-size: .82rem; color: var(--c-text-2); margin-top: .15rem; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .admin-wrapper { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: .75rem 1rem; }
  .admin-sidebar .logo { border-bottom: none; padding: .25rem .5rem; }
  .admin-nav { display: flex; flex-wrap: wrap; gap: .2rem; padding: 0; }
  .admin-nav .nav-group-title { display: none; }
  .admin-nav a { padding: .45rem .85rem; border-right: none; border-radius: var(--radius-sm); font-size: .82rem; }
  .admin-main { padding: 1.25rem 1rem; }
}
@media (max-width: 768px) {
  .site-header .nav-links { display: none; }
  .site-header .inner { gap: 1rem; }
  .materials-grid { grid-template-columns: 1fr 1fr; }
  .container { padding: 1.25rem 1rem; }
  .tabs-nav { padding: 0 .75rem; }
}
@media (max-width: 500px) {
  .materials-grid { grid-template-columns: 1fr; }
  .status-box { gap: .4rem; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .report-btn span { display: none; }
}

/* ============================================================
   ENTRY PAGE RESPONSIVE FIXES
   ============================================================ */
.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.5rem;
  margin-top: 1.5rem;
  align-items: start;
}
.entry-layout > div { min-width: 0; }
.entry-sidebar {
  position: sticky;
  top: 80px;
  min-width: 0;
}
.entry-layout blockquote,
.entry-layout p,
.entry-layout .notice,
.entry-layout .card-body,
.entry-layout .tab-pane {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.entry-layout [dir="ltr"] {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  .entry-layout {
    grid-template-columns: 1fr;
  }
  .entry-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  .entry-sidebar .card { margin-bottom: 0 !important; }
}

@media (max-width: 768px) {
  .site-header { position: relative; }
  .site-header .inner {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    padding: .75rem 1rem;
  }
  .site-header .logo { width: 100%; font-size: 1rem; }
  .search-bar { order: 3; width: 100%; max-width: none; }
  .breadcrumb { padding: 0 1rem; font-size: .78rem; }
  .disclaimer-banner {
    padding: .8rem 1rem;
    font-size: .82rem;
    gap: .6rem;
  }
  .entry-layout {
    padding-top: .75rem;
    gap: 1rem;
  }
  .card-header {
    padding: .85rem 1rem;
    font-size: .95rem !important;
    flex-wrap: wrap;
  }
  .card-body,
  .tab-pane {
    padding: 1rem;
  }
  .status-box {
    padding: .8rem 1rem 1rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-item {
    justify-content: center;
    font-size: .78rem;
    padding: .38rem .55rem;
  }
  .tabs-container { overflow: visible; }
  .tabs-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0 .5rem;
    gap: .25rem;
    border-bottom-width: 1px;
  }
  .tab-btn {
    padding: .75rem .9rem;
    font-size: .82rem;
  }
  .entry-sidebar {
    grid-template-columns: 1fr;
  }
  .report-btn {
    bottom: 1rem;
    left: 1rem;
  }
  .back-top {
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 430px) {
  html { font-size: 15px; }
  .container { padding-left: .85rem; padding-right: .85rem; }
  .status-box { grid-template-columns: 1fr; }
  .tab-btn { font-size: .8rem; padding-left: .75rem; padding-right: .75rem; }
  .notice { font-size: .82rem; padding: .75rem .85rem; }
}

/* =========================================================
   Patch 3: Source tabs on large screens
   السبب: في الشاشات الكبيرة كان شريط تبويبات المصادر يخرج خارج البطاقة
   مع إخفاء شريط التمرير، فلا تظهر بقية المصادر. هنا نجعل التبويبات
   تلتف على أكثر من سطر في الكمبيوتر، وتبقى قابلة للسحب في الجوال.
   ========================================================= */
@media (min-width: 769px) {
  .tabs-container {
    overflow: visible;
  }
  .tabs-nav {
    flex-wrap: wrap;
    overflow-x: visible;
    scrollbar-width: auto;
    row-gap: .35rem;
    column-gap: .35rem;
    padding-top: .65rem;
    padding-bottom: .65rem;
    align-items: center;
  }
  .tabs-nav::-webkit-scrollbar {
    display: initial;
  }
  .tab-btn {
    flex: 0 0 auto;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    margin-bottom: 0;
    background: #fff;
    padding: .55rem .95rem;
    line-height: 1.4;
  }
  .tab-btn.active {
    border-color: var(--c-primary-mid);
    background: rgba(45, 106, 79, .08);
  }
}

@media (max-width: 768px) {
  .tabs-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
