:root {
  --bg: #f5f0e8;
  --gold: #b08d57;
  --gold-light: #d4af37;
  --brown: #5c4033;
  --green: #0f5132;
  --green-light: #198754;
  --amber: #92400e;
  --amber-light: #d97706;
  --text: #1a1209;
  --text-muted: #6b5c4e;
  --card-bg: #fffdf7;
  --border: rgba(176,141,87,0.2);
  --shadow: 0 4px 28px rgba(92,64,51,0.10);
}
[data-theme="dark"] {
  --bg: #0f1115;
  --gold: #d4af37;
  --gold-light: #f0c94d;
  --brown: #c8a96b;
  --green: #1f7a53;
  --green-light: #2aab72;
  --text: #f1f1f1;
  --text-muted: #a89880;
  --card-bg: #1a1d24;
  --border: rgba(212,175,55,0.15);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family:'Cairo',sans-serif;
  background:var(--bg);
  color:var(--text);
  transition:background .4s, color .4s;
  overflow-x:hidden;
}
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--gold); border-radius:3px; }

/* ===== TOPBAR ===== */
.topbar {
  background:#3e1d0ec2;
  padding:9px 28px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:13px;
  color:rgba(255,255,255,.85);
}
.topbar-breadcrumb { display:flex; align-items:center; gap:8px; }
.topbar-breadcrumb a { color:rgba(255,255,255,.7); text-decoration:none; transition:color .2s; }
.topbar-breadcrumb a:hover { color:#fde68a; }
.sep { opacity:.4; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.tb-btn {
  background:rgba(255,255,255,.15); border:none; color:#fff;
  padding:5px 14px; border-radius:20px;
  font-family:'Cairo',sans-serif; font-size:12px; font-weight:600;
  cursor:pointer; transition:background .2s; display:flex; align-items:center; gap:5px;
}
.tb-btn:hover { background:rgba(255,255,255,.25); }

/* ===== HERO ===== */
.cat-hero {
  position:relative;
  background: linear-gradient(160deg,#1a0f05 0%,#3a1f0a 40%,#0f1a12 100%);
  padding:48px 40px 40px;
  overflow:hidden;
}
.hero-ornament {
  position:absolute; top:0; right:0; bottom:0;
  width:320px; opacity:.06;
  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,4 76,22 76,58 40,76 4,58 4,22' fill='none' stroke='white' stroke-width='1.5'/%3E%3Ccircle cx='40' cy='40' r='16' fill='none' stroke='white' stroke-width='1'/%3E%3Ccircle cx='40' cy='40' r='4' fill='white'/%3E%3C/svg%3E");
  background-size:80px;
}
.hero-inner { position:relative; z-index:1; max-width:1100px; margin:0 auto; text-align:center; display:flex; flex-direction:column; align-items:center; }
.cat-badge {
  display:inline-flex; align-items:center; gap:8px;
  background:rgba(251,191,36,.15); border:1px solid rgba(251,191,36,.35);
  color:#fbbf24; padding:5px 16px; border-radius:20px;
  font-size:12px; font-weight:700; margin-bottom:18px; letter-spacing:.5px;
}
.cat-badge .badge-dot { width:7px; height:7px; background:#fbbf24; border-radius:50%; animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(1.3)} }
.cat-hero h1 {
  font-family:'Aref Ruqaa',serif;
  font-size:clamp(24px,3.5vw,42px);
  color:#fff; line-height:1.5; margin-bottom:14px;
}
.cat-hero p {
  color:rgba(255,255,255,.65); font-size:14px; line-height:1.8;
  max-width:620px; margin-bottom:22px; text-align:center;
}
.cat-stats { display:flex; gap:28px; flex-wrap:wrap; justify-content:center; }
.cat-stat { text-align:center; }
.cat-stat .sn { font-family:'Reem Kufi',sans-serif; font-size:26px; color:#fbbf24; }
.cat-stat .sl { font-size:11px; color:rgba(255,255,255,.5); }

/* Parent nav pills */
.parent-nav {
  display:flex; gap:10px; flex-wrap:wrap; margin-top:24px;
  padding-top:20px; border-top:1px solid rgba(255,255,255,.1);
}
.parent-pill {
  display:flex; align-items:center; gap:7px;
  padding:6px 16px; border-radius:20px;
  font-size:12px; font-weight:700;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  color:rgba(255,255,255,.6);
  cursor:pointer; text-decoration:none;
  transition:all .2s;
}
.parent-pill:hover { background:rgba(255,255,255,.15); color:#fff; }
.parent-pill.active {
  background:rgba(251,191,36,.18); border-color:rgba(251,191,36,.5);
  color:#fbbf24;
}

/* ===== CONTROLS BAR ===== */
.controls-bar {
  max-width:1180px; margin:0 auto;
  padding:18px 20px 0;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.controls-right { display:flex; align-items:center; gap:8px; margin-right:auto; }
.ctrl-label { font-size:12px; color:var(--text-muted); font-weight:700; white-space:nowrap; }
.ctrl-sep { width:1px; height:22px; background:var(--border); }

/* Sort select */
.ctrl-select {
  padding:6px 12px; border-radius:10px;
  border:1px solid var(--border); background:var(--card-bg);
  color:var(--text); font-family:'Cairo',sans-serif; font-size:12px; font-weight:600;
  cursor:pointer; outline:none;
}
.ctrl-select:focus { border-color:var(--amber-light); }

/* View toggle */
.view-toggle { display:flex; gap:4px; background:var(--card-bg); border:1px solid var(--border); border-radius:12px; padding:4px; }
.vt-btn {
  width:34px; height:34px; border-radius:8px; border:none;
  background:transparent; color:var(--text-muted);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all .2s;
}
.vt-btn:hover { color:var(--amber-light); }
.vt-btn.active { background:var(--amber-light); color:#fff; }
.vt-btn svg { pointer-events:none; }

/* Results count */
.results-count { font-size:12px; color:var(--text-muted); }
.results-count strong { color:var(--amber-light); }

/* Search filter */
.ctrl-search {
  display:flex; align-items:center; gap:8px;
  background:var(--card-bg); border:1px solid var(--border);
  border-radius:12px; padding:6px 14px;
  transition:border-color .2s;
}
.ctrl-search:focus-within { border-color:var(--amber-light); }
.ctrl-search input {
  border:none; background:transparent; outline:none;
  font-family:'Cairo',sans-serif; font-size:13px; color:var(--text);
  width:180px;
}
.ctrl-search input::placeholder { color:var(--text-muted); }
.ctrl-search svg { color:var(--text-muted); flex-shrink:0; }

/* ===== GRID WRAPPER ===== */
.grid-wrapper {
  max-width:1180px; margin:0 auto;
  padding:20px 20px 60px;
}

/* ===== GRID VIEW (افتراضي — عرض) ===== */
.subcat-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
  gap:20px;
  transition:all .3s;
}

/* ===== LIST VIEW (طول) ===== */
.subcat-grid.list-view {
  grid-template-columns:1fr 1fr;
  gap:12px;
}

/* ===== CARD BASE ===== */
.subcat-card {
  background:var(--card-bg);
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--shadow);
  cursor:pointer;
  text-decoration:none;
  color:inherit;
  display:flex;
  flex-direction:column;
  transition:transform .22s, box-shadow .22s, border-color .22s;
  position:relative;
}
.subcat-card:hover {
  transform:translateY(-4px);
  box-shadow:0 12px 40px rgba(92,64,51,.16);
  border-color:var(--gold);
}
[data-theme="dark"] .subcat-card:hover { box-shadow:0 12px 40px rgba(0,0,0,.5); }

/* Card top stripe */
.card-stripe {
  height:5px;
  background:linear-gradient(90deg, var(--stripe-a), var(--stripe-b));
}

/* GRID card inner */
.card-body {
  padding:20px 20px 16px;
  flex:1; display:flex; flex-direction:column;
}
.card-icon-row { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:14px; }
.card-icon {
  width:52px; height:52px;
  border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  font-size:26px;
  background:linear-gradient(135deg, var(--stripe-a), var(--stripe-b));
  box-shadow:0 4px 16px rgba(0,0,0,.12);
  flex-shrink:0;
}
.card-count-badge {
  background:rgba(176,141,87,.08); color:var(--text-muted);
  border:1px solid var(--border);
  padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700;
}
.card-title {
  /**font-family:'Reem Kufi',sans-serif;**/
  font-size:17px; color:var(--text);
  line-height:1.4; margin-bottom:8px;
}
.card-desc {
  font-size:12px; color:var(--text-muted);
  line-height:1.7; flex:1;
}
.card-footer {
  padding:12px 20px;
  border-top:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  background:rgba(176,141,87,.03);
}
[data-theme="dark"] .card-footer { background:rgba(212,175,55,.03); }
.card-meta { display:flex; align-items:center; gap:12px; }
.card-meta span { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }
.card-arrow {
  width:28px; height:28px; border-radius:8px;
  background:transparent; border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color:var(--text-muted); font-size:13px;
  transition:all .2s;
}
.subcat-card:hover .card-arrow {
  background:var(--amber-light); border-color:var(--amber-light); color:#fff;
}

/* ===== LIST CARD OVERRIDE ===== */
.list-view .subcat-card {
  flex-direction:row;
  align-items:stretch;
  border-radius:14px;
}
.list-view .card-stripe {
  width:5px; height:auto;
  background:linear-gradient(180deg, var(--stripe-a), var(--stripe-b));
}
.list-view .card-body {
  flex-direction:row;
  align-items:center;
  gap:16px;
  padding:16px 20px;
  flex:1;
}
.list-view .card-icon-row {
  margin-bottom:0;
  flex-direction:column;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}
.list-view .card-icon { width:46px; height:46px; font-size:22px; border-radius:12px; }
.list-view .card-count-badge { font-size:10px; padding:2px 8px; }
.list-view .card-content { flex:1; }
.list-view .card-title { font-size:16px; margin-bottom:4px; }
.list-view .card-desc { font-size:12px; }
.list-view .card-footer {
  border-top:none; border-right:1px solid var(--border);
  border-radius:0;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:16px 18px;
  background:transparent;
  width:120px; flex-shrink:0;
}
.list-view .card-meta { flex-direction:column; gap:6px; align-items:center; text-align:center; }
.list-view .card-meta span { font-size:10px; }
.list-view .card-arrow { width:32px; height:32px; }

/* Wrapper for list-view inner content */
.card-content { display:flex; flex-direction:column; }

/* ===== SECTION HEADER ===== */
.section-header {
  display:flex; align-items:center; gap:12px;
  margin-bottom:18px;
}
.sh-line { flex:1; height:1px; background:var(--border); }
.sh-title {
  /*font-family:'Reem Kufi',sans-serif;*/ font-size:20px;
  color:var(--text-muted); white-space:nowrap;
  padding:0 4px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align:center; padding:80px 20px;
  color:var(--text-muted);
}
.empty-state .ei { font-size:52px; margin-bottom:16px; }
.empty-state h3 { font-family:'Reem Kufi',sans-serif; font-size:20px; color:var(--text); margin-bottom:8px; }
.empty-state p { font-size:13px; }

/* ===== TOAST ===== */
.toast {
  position:fixed; bottom:28px; left:50%; transform:translateX(-50%) translateY(80px);
  background:#1a1209; color:#fff; padding:12px 24px; border-radius:30px;
  font-size:14px; font-weight:600; display:flex; align-items:center; gap:8px;
  z-index:9999; transition:transform .35s cubic-bezier(.25,.46,.45,.94);
  white-space:nowrap; box-shadow:0 8px 32px rgba(0,0,0,.35);
}
[data-theme="dark"] .toast { background:#2a2010; }
.toast.show { transform:translateX(-50%) translateY(0); }

/* ===== MOBILE ===== */
@media (max-width:700px) {
  .cat-hero { padding:32px 18px 28px; }
  .controls-bar { gap:8px; }
  .ctrl-search input { width:120px; }
  .subcat-grid { grid-template-columns:1fr 1fr; gap:12px; }
  .subcat-grid.list-view { grid-template-columns:1fr; }
  .list-view .card-footer { display:none; }
  .cat-stats { gap:18px; }
}
@media (max-width:480px) {
  .subcat-grid { grid-template-columns:1fr; }
}

.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;
}
