
/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:     #f5f3ee;
  --bg2:    #ffffff;
  --bg3:    #edeae3;
  --border: #d8d2c5;
  --border2:#c8c0b0;
  --text:   #1a1a2e;
  --text2:  #4a4a6a;
  --text3:  #8a8aaa;
  --gold-glow: rgba(212,175,55,0.06);
}

[data-theme="dark"] {

  
    --bg:          #0f1117;
  --bg2:         #161b25;
  --bg3:         #1e2535;
  --border:      #2a3347;
  --border2:     #334060;
  --gold:        #d4af37;
  --gold2:       #f0c842;
  --gold-dim:    rgba(212,175,55,0.15);
  --gold-glow:   rgba(212,175,55,0.08);
  --text:        #e8eaf0;
  --text2:       #9aa3b8;
  --text3:       #5a6480;
  --accent:      #1d6fa4;
  --accent2:     #3b9fd4;
  --green:       #10b981;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.5);
  --transition:  0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', 'Noto Kufi Arabic', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
background: #3e1d0ec2;
  padding: 9px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255,255,255,0.88);
  font-family: 'Cairo', sans-serif;
}
}

[data-theme="light"] .topbar {
  background: rgba(245,243,238,0.95);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text2);
  overflow: hidden;
}

.topbar-breadcrumb a {
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
}
.topbar-breadcrumb a:hover { color: var(--gold2); }
.topbar-breadcrumb .sep { color: var(--text3); font-size: 13px; }
.topbar-breadcrumb span:last-child {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.tb-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 5px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tb-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ===== HERO ===== */
.hero {
  position: relative;
  overflow: hidden;
  /**padding: 44px 24px 36px;**/
  text-align: center;
  background: linear-gradient(160deg,#1a0f05 0%,#3a1f0a 40%,#0f1a12 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(212,175,55,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero-ornament {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.85;
  display: block;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-dim);
  border: 1px solid rgba(212,175,55,0.3);
  color: var(--gold);
  font-size: 11.5px;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-family: 'Aref Ruqaa', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.35;
}

.hero-desc {
  color: var(--text2);
  font-size: 14px;
  max-width: 560px;
  margin: 0 auto 20px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}
.hero-stat .sn {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  font-family: 'Cairo', sans-serif;
}
.hero-stat .sl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

/* ===== CONTROLS ===== */
.controls {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.search-wrap svg {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 36px 8px 12px;
  border-radius: 10px;
  outline: none;
  transition: border-color var(--transition);
}
.search-wrap input::placeholder { color: var(--text3); }
.search-wrap input:focus { border-color: var(--gold); }

.ctrl-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-tab {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-tab:hover, .filter-tab.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

.results-label {
  color: var(--text3);
  font-size: 12.5px;
  white-space: nowrap;
}
.results-label strong { color: var(--gold); }

/* ===== TOPICS LIST ===== */
.topics-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.section-divider .sd-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.section-divider .sd-title {
  font-size: 13px;
  color: var(--text3);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* ===== TOPIC ROW (2-column grid) ===== */
.topic-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg2);
}

.topic-row {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}
/* إزالة البوردر اليسار من العمود الأيمن (كل عنصر فردي) */
.topic-row:nth-child(odd)  { border-left: none; }
/* آخر صفين بدون border-bottom */
.topic-row:nth-last-child(1),
.topic-row:nth-last-child(2) { border-bottom: none; }
.topic-row:hover { background: var(--bg3); }
.topic-row:hover .row-arrow { transform: translateX(-4px); color: var(--gold); }

/* اللون الجانبي */
.row-stripe {
  width: 4px;
  align-self: stretch;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--stripe-a, #1d6fa4), var(--stripe-b, #3b9fd4));
}

/* الأيقونة */
.row-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin: 12px 10px 12px 14px;
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* المحتوى */
.row-body {
  flex: 1;
  min-width: 0;
  padding: 12px 8px 12px 0;
}

.row-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition);
}
.topic-row:hover .row-title { color: var(--gold2); }

.row-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.row-meta span {
  font-size: 11.5px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
}

.type-badge {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.type-article { background: rgba(29,111,164,0.18); color: #64b5d9; border: 1px solid rgba(29,111,164,0.3); }
.type-audio   { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.25); }
.type-video   { background: rgba(220,38,38,0.15);  color: #fca5a5; border: 1px solid rgba(220,38,38,0.25); }
.type-fatwa   { background: rgba(212,175,55,0.15); color: #d4af37; border: 1px solid rgba(212,175,55,0.3); }

/* السهم */
.row-arrow {
  flex-shrink: 0;
  color: var(--text3);
  font-size: 18px;
  padding: 0 14px 0 8px;
  transition: all var(--transition);
}

/* رقم الموضوع */
.row-num {
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}

/* ===== EMPTY ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-state .ei { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text2); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 24px 0 8px;
  flex-wrap: wrap;
}

.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition);
}
.pg-btn:hover    { border-color: var(--gold); color: var(--gold); }
.pg-btn.active   { background: var(--gold); border-color: var(--gold); color: #0f1117; font-weight: 700; }
.pg-btn.disabled { opacity: 0.35; pointer-events: none; }
.pg-dots         { color: var(--text3); padding: 0 4px; }

/* ===== SCROLL TOP ===== */
.scroll-top {
  position: fixed;
  left: 20px;
  bottom: 24px;
  width: 42px;
  height: 42px;
  background: var(--gold);
  color: #0f1117;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212,175,55,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 50;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }
.scroll-top:hover   { transform: translateY(-3px); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 200;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .topic-list { grid-template-columns: 1fr; }
  .topic-row { border-left: none !important; }
  .topic-row:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  .topic-row:last-child { border-bottom: none; }
}

@media (max-width: 600px) {
  .topbar-breadcrumb span:last-child { max-width: 120px; }
  .hero { padding: 32px 16px 28px; }
  .row-num { display: none; }
  .row-meta .hide-mobile { display: none; }
  .topics-wrap { padding: 16px 12px 32px; }
  .controls { padding: 12px 12px 0; }
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpolygon points='40,5 75,25 75,55 40,75 5,55 5,25' fill='none' stroke='white' stroke-width='1.5'/%3E%3Ccircle cx='40' cy='40' r='15' fill='none' stroke='white' stroke-width='1'/%3E%3Ccircle cx='40' cy='40' r='3' fill='white'/%3E%3C/svg%3E");
  background-size: 80px 80px;
  animation: drift 20s linear infinite;
}

