/* ==========================================================
   منصة القوانين المصرية وأحكام النقض — Egyptian Laws & Cassation Rulings Platform
   التصميم: أزرق داكن (قضائي) + ذهبي — يدعم RTL/LTR
   ========================================================== */

:root {
  --navy-900: #0b1a33;
  --navy-800: #10234a;
  --navy-700: #1a3a6b;
  --navy-600: #24508f;
  --gold: #c9a227;
  --gold-light: #e3c45a;
  --gold-dark: #a8841a;
  --ink: #1c2436;
  --muted: #5c6779;
  --bg: #f6f4ee;
  --card: #ffffff;
  --line: #e3e0d6;
  --danger: #b3382c;
  --ok: #1e7a4c;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(11, 26, 51, 0.08);
  --shadow-lg: 0 16px 44px rgba(11, 26, 51, 0.16);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body[lang='en'] { font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif; }

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--gold-dark); }
img { max-width: 100%; }

/* ---------------- Header ---------------- */
.site-header {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff !important; }
.brand-icon {
  font-size: 30px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 12px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 20px; color: #fff; }
.brand-text small { color: var(--gold-light); font-size: 19px; letter-spacing: .02em; }

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.main-nav a {
  color: rgba(255,255,255,.82);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: .18s;
}
.main-nav a:hover, .main-nav a.active {
  background: rgba(201,162,39,.18);
  color: var(--gold-light);
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  font-size: 14px;
  transition: .18s;
}
.lang-toggle:hover { background: rgba(201,162,39,.25); border-color: var(--gold); }
.admin-link {
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 16px;
}

/* ---------------- Layout ---------------- */
.main-container { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 20px 60px; }
.main-container:focus { outline: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------------- Hero ---------------- */
.hero {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(201,162,39,.18), transparent 60%),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  border-radius: 22px;
  padding: 56px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: '⚖️';
  position: absolute;
  font-size: 240px;
  opacity: .07;
  left: -30px; top: -20px;
  transform: rotate(-14deg);
  pointer-events: none;
}
[dir='rtl'] .hero::after { left: auto; right: -30px; transform: rotate(14deg); }
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; line-height: 1.35; }
.hero h1 .accent { color: var(--gold-light); }
.hero p { color: rgba(255,255,255,.85); max-width: 680px; margin-top: 12px; font-size: 17px; }
.hero-search { margin-top: 26px; display: flex; gap: 10px; max-width: 640px; flex-wrap: wrap; }
.hero-search input {
  flex: 1;
  min-width: 220px;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
  background: var(--gold);
  color: #1a1404;
}
.btn:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold-light);
}
.btn-outline:hover { background: rgba(201,162,39,.15); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--navy-700); }
.btn-ghost:hover { border-color: var(--navy-600); background: rgba(36,80,143,.06); }
.btn-wa { background: #1eb65c; color: #fff; }
.btn-wa:hover { background: #178e49; color: #fff; transform: translateY(-1px); }

/* ---------------- الاستشارات ---------------- */
.consult-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(120deg, #0b1a33, #12305e);
  border: 1px solid rgba(201,162,39,.35);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 6px 0 26px;
  box-shadow: var(--shadow);
}
.consult-cta h3 { color: #fff; font-size: 19px; margin-bottom: 4px; }
.consult-cta .muted { color: rgba(255,255,255,.72); }
.steps { margin: 0; padding-inline-start: 20px; }
.steps li { margin-bottom: 8px; font-size: 14px; color: var(--navy-700); }

/* ---------------- Stats ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--gold);
}
.stat-card .num { font-size: 34px; font-weight: 800; color: var(--navy-800); }
.stat-card .lbl { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------------- Sections ---------------- */
.section { margin-top: 44px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-head h2 { font-size: 24px; color: var(--navy-800); }
.section-head .accent-bar { display: inline-block; width: 42px; height: 4px; background: var(--gold); border-radius: 4px; margin: 6px 0 0; }
.view-all { font-weight: 700; color: var(--navy-700); font-size: 14px; }

/* ---------------- Cards ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: .2s;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.card-title { font-size: 17px; font-weight: 800; color: var(--navy-800); line-height: 1.45; }
.card-sub { color: var(--muted); font-size: 13.5px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eef1f7;
  color: var(--navy-700);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 700;
}
.chip-gold { background: rgba(201,162,39,.16); color: var(--gold-dark); }
.chip-green { background: rgba(30,122,76,.12); color: var(--ok); }
.chip-red { background: rgba(179,56,44,.1); color: var(--danger); }
.chip-blue { background: rgba(36,80,143,.12); color: var(--navy-600); }
.chip-cat { background: rgba(201,162,39,.14); color: #7a620f; }

/* ---------------- List layout & filters ---------------- */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-bottom: 20px;
}
.toolbar input[type='search'] {
  flex: 1; min-width: 220px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: var(--card);
}
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 15px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: .15s;
}
.filter-btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.filter-btn.active {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: var(--gold-light);
}

.list { display: flex; flex-direction: column; gap: 14px; }
.list-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: .18s;
  display: flex; flex-direction: column; gap: 8px;
}
.list-item:hover { border-color: var(--gold); box-shadow: var(--shadow-lg); transform: translateX(3px); }
[dir='rtl'] .list-item:hover { transform: translateX(-3px); }
.list-item h3 { font-size: 16.5px; color: var(--navy-800); }
.list-item p { color: var(--muted); font-size: 14px; }
.list-item .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Detail pages ---------------- */
.detail-header {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  border-radius: 20px;
  padding: 34px 34px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}
.detail-header h1 { font-size: clamp(22px, 3.4vw, 34px); font-weight: 800; line-height: 1.4; }
.detail-header .en-title { color: var(--gold-light); font-size: 15px; margin-top: 6px; opacity: .95; }
.detail-header .meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.detail-header .chip { background: rgba(255,255,255,.12); color: #fff; }
.detail-header .chip-gold { background: rgba(201,162,39,.22); color: var(--gold-light); }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 16px;
  font-weight: 700; color: var(--navy-700);
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel h2 { font-size: 19px; color: var(--navy-800); margin-bottom: 12px; }
.panel h3 { font-size: 16px; color: var(--navy-800); margin: 14px 0 6px; }
.panel p { margin-bottom: 10px; }
.panel ul, .panel ol { padding-inline-start: 22px; margin-bottom: 10px; }

/* النماذج القانونية — نص الصيغة */
.template-content { line-height: 2.05; font-size: 15px; }
.template-content p { margin-bottom: 12px; text-align: justify; }
.template-content strong { color: var(--navy-800); }
.template-note { background: #fdf8ec; border-color: #ecd9a8; }
.template-note b { color: #7a620f; }

.article-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.article-block .art-no {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--navy-800); color: var(--gold-light);
  padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 8px;
}
.article-block p { margin: 0; font-size: 15px; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.side-box h3 { font-size: 15px; color: var(--navy-800); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.side-box .kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.side-box .kv:last-child { border-bottom: none; }
.side-box .kv b { color: var(--navy-800); }

/* ---------------- Search results ---------------- */
.search-summary { margin-bottom: 18px; font-weight: 700; color: var(--navy-800); }
.result-group { margin-bottom: 26px; }
.result-group > h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; color: var(--navy-800);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px; margin-bottom: 12px;
}
.result-group .list-item h3 { color: var(--navy-800); font-size: 15.5px; }

/* ---------------- Empty / states ---------------- */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-state .big { font-size: 48px; margin-bottom: 10px; }

.loading { text-align: center; padding: 50px; color: var(--muted); }
.spinner {
  width: 34px; height: 34px;
  border: 4px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Admin ---------------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-tabs { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.admin-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-700);
  cursor: pointer;
  text-align: start;
  transition: .15s;
}
.admin-tab:hover { background: #f0f2f7; }
.admin-tab.active { background: var(--navy-800); color: var(--gold-light); }
.admin-panel { min-width: 0; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-toolbar h2 { color: var(--navy-800); font-size: 21px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #f2f0e8; color: var(--navy-800); font-size: 13px; font-weight: 800; }
tr:hover td { background: #faf9f4; }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: .15s;
}
.icon-btn:hover { border-color: var(--gold); }
.icon-btn.danger:hover { border-color: var(--danger); background: rgba(179,56,44,.06); }

/* ---------------- Modal & forms ---------------- */
.modal-overlay[hidden] { display: none; }
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(8,16,32,.6);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 18px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { color: var(--navy-800); font-size: 19px; }
.modal-close { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; color: var(--navy-800); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  background: #fff;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.login-card {
  max-width: 420px;
  margin: 40px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card h2 { color: var(--navy-800); margin: 10px 0 6px; }
.login-card .form-grid { grid-template-columns: 1fr; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--navy-800);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  border-left: 4px solid var(--gold);
}
[dir='rtl'] .toast { border-left: none; border-right: 4px solid var(--gold); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--navy-900);
  color: rgba(255,255,255,.75);
  padding: 34px 20px 26px;
  margin-top: auto;
}
.footer-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.footer-brand { display: flex; gap: 10px; align-items: center; }
.footer-brand .brand-icon { width: 40px; height: 40px; font-size: 22px; }
.footer-brand strong { color: #fff; font-size: 17px; line-height: 1.4; }
.footer-brand span { display: block; font-size: 17px; color: var(--gold-light); }
.disclaimer { font-size: 12.5px; color: rgba(255,255,255,.55); max-width: 900px; padding-inline-start: 4px; }
.copyright { font-size: 13px; color: rgba(255,255,255,.4); }

/* ---------------- Favorites & print ---------------- */
.star-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #b8b1a0;
  padding: 2px 8px;
  transition: .15s;
  line-height: 1;
}
.star-btn:hover { color: var(--gold); transform: scale(1.2); }
.star-btn.active { color: var(--gold); }
.card-actions { display: flex; align-items: center; gap: 6px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.print-entity { display: inline-flex; align-items: center; gap: 6px; }

/* نافذة الطباعة */
@media print {
  body { background: #fff; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .header-inner { gap: 10px; }
  .main-nav { order: 3; width: 100%; justify-content: center; }
  .hero { padding: 36px 22px; }
  .section-head h2 { font-size: 20px; }
}

/* ---------------- الربح: النشرة + برو + الدفع ---------------- */
.footer-subscribe { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(212,175,55,.25); }
.footer-subscribe h4 { margin-bottom: 4px; }
.footer-subscribe p { margin-bottom: 10px; }
.news-form { display: flex; gap: 8px; max-width: 460px; }
.news-form input { flex: 1; }
@media (max-width: 520px) { .news-form { flex-direction: column; } }

.pro-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #f7e7a0, #d4af37);
  color: #3d2f00; font-weight: 700; font-size: 12.5px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(212,175,55,.45);
}

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.plan-card {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; text-align: center;
  background: #fff;
}
.plan-card-best { border-color: var(--gold); background: #fdfaf1; }
.plan-card h3 { margin-bottom: 6px; }
.plan-price { font-size: 26px; font-weight: 800; color: var(--gold); margin: 6px 0 12px; }
.plan-price small { font-size: 12px; color: var(--muted); font-weight: 500; }
.plan-btn { width: 100%; }
.plan-btn.active { outline: 3px solid rgba(212,175,55,.5); }
.plan-btn.disabled { opacity: .5; pointer-events: none; }
@media (max-width: 560px) { .plan-grid { grid-template-columns: 1fr; } }

.benefits { list-style: none; padding: 0; margin: 10px 0 0; }
.benefits li { padding: 7px 0; border-bottom: 1px dashed var(--line); }

.payment-box ol.steps { margin: 10px 0; }
.convert-box { border-color: var(--gold); background: #fdfaf1; }