﻿/* ============================================
   HEADER STYLES
   ============================================ */

/* ── GLOBALLY DARK HEADER ────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0D0B09;
  border-bottom: none;
  box-shadow: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0; height: 1px;
  background: rgba(255,252,242,0.06);
  pointer-events: none;
}

.site-header.scrolled {
  box-shadow: 0 2px 24px rgba(0,0,0,0.35);
}

.site-header.hidden {
  transform: translateY(-100%);
}

/* dark header — nav, logo, buttons */
.site-header .nav-list li a,
.site-header .nav-list > a  { color: rgba(255,252,242,0.72); }
.site-header .nav-list li a:hover,
.site-header .nav-list .current-menu-item > a {
  color: var(--accent); background: rgba(235,94,40,0.1);
}
.site-header .pa-logo-name { color: #FFFCF2 !important; }
.site-header .pa-logo-desc { color: rgba(255,252,242,0.42) !important; }
.site-header .icon-btn { border-color: rgba(255,252,242,0.14); color: rgba(255,252,242,0.65); background: transparent; }
.site-header .icon-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(235,94,40,0.1); }
.site-header .header-search-bar { background: #141210; border-top: 1px solid rgba(255,252,242,0.07); }
.site-header .search-input { background: rgba(255,252,242,0.06); border-color: rgba(255,252,242,0.12); color: #FFFCF2; }
.site-header .search-input::placeholder { color: rgba(255,252,242,0.35); }
.site-header .sub-menu, .site-header .nav-list li.has-submenu > ul {
  background: #1a1714; border-color: rgba(255,252,242,0.1);
}
.site-header .sub-menu li a, .site-header .nav-list li.has-submenu > ul li a {
  color: rgba(255,252,242,0.7);
}
.site-header .sub-menu li a:hover { color: var(--accent); background: rgba(235,94,40,0.08); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}

/* LOGO */
.header-logo { flex-shrink: 0; }
.header-logo a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.header-logo .logo-img { height: 40px; width: auto; }

.logo-text-link { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}

.logo-label { display: flex; flex-direction: column; line-height: 1.2; }
.logo-label strong { font-size: 14px; font-weight: 800; color: var(--text); }
.logo-label small { font-size: 11px; color: var(--muted); }

/* NAV */
.header-nav { flex: 1; display: flex; justify-content: center; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0; padding: 0;
}

.nav-list li a {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-list li a:hover,
.nav-list li.current-menu-item > a {
  color: var(--accent);
  background: rgba(235,94,40,0.08);
}

/* ══ DROPDOWN MENU ══ */
.nav-list li { position: relative; }

/* WordPress generates menu-item-has-children + sub-menu */
.nav-list .menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-inline-start: 6px;
  vertical-align: middle;
  opacity: 0.6;
  transition: transform .2s;
}
.nav-list .menu-item-has-children:hover > a::after {
  transform: rotate(-135deg);
  opacity: 1;
}

.nav-list .sub-menu,
.nav-list li.has-submenu > ul {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  min-width: 210px;
  list-style: none;
  padding: 6px 0;
  z-index: 500;
  animation: ddFadeIn .18s ease;
}
[dir="ltr"] .nav-list .sub-menu,
[dir="ltr"] .nav-list li.has-submenu > ul { right: auto; left: 0; }

@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-list .menu-item-has-children:hover > .sub-menu,
.nav-list li.has-submenu:hover > ul { display: block; }

.nav-list .sub-menu li a,
.nav-list li.has-submenu > ul li a {
  padding: 9px 18px;
  font-size: 13px;
  border-radius: 0;
  display: block;
  color: var(--text);
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: all .15s;
}
.nav-list .sub-menu li a:hover,
.nav-list li.has-submenu > ul li a:hover {
  color: var(--accent);
  background: rgba(235,94,40,0.07);
  border-inline-start-color: var(--accent);
  padding-inline-start: 22px;
}

/* Mobile: dropdown به صورت indent */
.mobile-nav-list .sub-menu {
  display: block;
  padding-inline-start: 16px;
  list-style: none;
}
.mobile-nav-list .sub-menu li { border-bottom: none; }
.mobile-nav-list .sub-menu li a { font-size: 14px; padding: 10px 0; color: var(--muted); }

/* ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.icon-btn:hover { background: var(--bg); color: var(--accent); border-color: var(--accent); }

.icon-btn svg { width: 18px; height: 18px; }

/* Dark Mode Toggle */
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: block; }

/* Language Switch */
.lang-switch { position: relative; }

.lang-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 120px;
  z-index: 200;
}

.lang-dropdown a, .lang-dropdown li a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
  list-style: none;
}

.lang-dropdown a:hover { background: var(--bg); color: var(--accent); }

.lang-static { font-size: 13px; font-weight: 700; color: var(--muted); }
.lang-static.active { color: var(--accent); }
.lang-sep { color: var(--border); }

/* Search Bar */
.header-search-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 0;
  display: none;
}

.header-search-bar.open { display: block; animation: slideDown 0.2s ease; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-form { display: flex; gap: 8px; align-items: center; }
.search-input { flex: 1; }
.search-submit { padding: 10px 16px; }
.search-close { width: 36px; height: 36px; font-size: 16px; }

/* Auth Drawer Toggle — visible on all screen sizes */
.mobile-menu-toggle { display: flex; }

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.mobile-nav-overlay.open { display: flex; justify-content: flex-end; }

.mobile-nav {
  width: min(320px, 85vw);
  height: 100%;
  background: #111009;
  padding: 20px;
  overflow-y: auto;
  animation: slideInRight 0.3s ease;
}

/* ── Auth Drawer ─────────────────────────────────────── */
.mobile-nav-overlay.open { justify-content: flex-start; }
[dir="rtl"] .mobile-nav-overlay.open { justify-content: flex-end; }

.pa-auth-drawer .mobile-nav-close {
  background: rgba(255,252,242,0.06); border-color: rgba(255,252,242,0.1);
  color: rgba(255,252,242,0.6);
}

.pa-drawer-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 20px; border-bottom: 1px solid rgba(255,252,242,0.08);
  margin-bottom: 16px;
}
.pa-drawer-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.pa-drawer-name { font-size: 15px; font-weight: 700; color: #FFFCF2; }
.pa-drawer-role { font-size: 11px; color: rgba(255,252,242,0.42); margin-top: 2px; }

.pa-drawer-guest { padding-top: 12px; }
.pa-drawer-icon { font-size: 40px; text-align: center; margin-bottom: 10px; }
.pa-drawer-welcome { text-align: center; padding: 12px 0 20px; }
.pa-drawer-welcome p { font-size: 13px; color: rgba(255,252,242,0.55); line-height: 1.6; }

.pa-drawer-links { display: flex; flex-direction: column; gap: 8px; }

.pa-drawer-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 700;
  text-decoration: none; transition: all 0.2s; font-family: inherit; cursor: pointer; border: none;
}
.pa-drawer-btn-primary { background: var(--accent); color: #fff; }
.pa-drawer-btn-primary:hover { background: #c94d22; }
.pa-drawer-btn-outline { background: transparent; color: rgba(255,252,242,0.8); border: 1px solid rgba(255,252,242,0.2); }
.pa-drawer-btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.pa-drawer-link {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: rgba(255,252,242,0.72); text-decoration: none; transition: all 0.2s;
  border: 1px solid transparent;
}
.pa-drawer-link:hover { color: var(--accent); background: rgba(235,94,40,0.08); border-color: rgba(235,94,40,0.2); }
.pa-drawer-link-danger { color: rgba(255,100,100,0.7); }
.pa-drawer-link-danger:hover { color: #ff6464; background: rgba(255,100,100,0.08); border-color: rgba(255,100,100,0.2); }

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

[dir="rtl"] .mobile-nav { animation-name: slideInLeft; }

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.mobile-nav-close {
  display: flex; margin-left: auto; margin-bottom: 20px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 18px; cursor: pointer; color: var(--text);
  font-family: inherit;
}

.mobile-nav-list { list-style: none; }
.mobile-nav-list li { border-bottom: 1px solid var(--border); }
.mobile-nav-list li a { display: block; padding: 14px 0; font-size: 16px; font-weight: 600; color: var(--text); transition: color 0.2s; }
.mobile-nav-list li a:hover { color: var(--accent); }

/* HOME LAYOUT */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  padding: 32px 0;
  align-items: start;
}

.main-column { min-width: 0; }
.sidebar-column { min-width: 0; position: sticky; top: 88px; max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }

/* HERO */
.hero-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }

.hero-card {
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  text-decoration: none;
}

.hero-img-wrap { width: 100%; height: 100%; }
.hero-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.hero-card:hover .hero-img { transform: scale(1.04); }

.hero-placeholder {
  background: linear-gradient(135deg, var(--primary), #2d3f54);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 24px; font-weight: 800;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  gap: 10px;
}

.hero-featured-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(235,94,40,0.2);
  border: 1px solid rgba(235,94,40,0.4);
  padding: 4px 10px;
  border-radius: 20px;
  width: fit-content;
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-excerpt {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta { font-size: 13px; color: rgba(255,255,255,0.6); display: flex; gap: 8px; flex-wrap: wrap; }
.hero-btn { width: fit-content; font-size: 13px; padding: 8px 18px; }

.hero-side { display: flex; flex-direction: column; gap: 16px; }
.hero-side-card { display: flex; flex-direction: column; text-decoration: none; }
.hero-side-img { width: 100%; height: 140px; object-fit: cover; }

/* ARTICLES GRID */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .home-layout { grid-template-columns: 1fr 300px; }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr 260px; }
}

@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr; }
  .sidebar-column { position: static; max-height: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { display: grid; grid-template-columns: 1fr 1fr; }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-nav { display: none; }
  .btn-donate { display: none; }
  .mobile-menu-toggle { display: flex; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { display: grid; grid-template-columns: 1fr 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-side { grid-template-columns: 1fr; }
  .header-actions { gap: 6px; }
}

/* ══ CATEGORIES DROPDOWN ══ */
.pa-cats-nav {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.pa-cats-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border: none; background: none;
    color: var(--muted); font-size: 13px; font-weight: 600;
    cursor: pointer; border-radius: 8px;
    transition: color .2s, background .2s; white-space: nowrap;
    font-family: inherit;
}
.pa-cats-btn:hover,
.pa-cats-nav:hover .pa-cats-btn { color: var(--accent); background: rgba(235,94,40,0.08); }
.pa-cats-chevron { transition: transform .25s; }
.pa-cats-nav:hover .pa-cats-chevron { transform: rotate(180deg); }

.pa-cats-panel {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    min-width: 240px; max-width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.16);
    padding: 6px;
    z-index: 1100;
    display: none;
    max-height: 70vh;
    overflow-y: auto;
}
.pa-cats-nav:hover .pa-cats-panel { display: block; }

.pa-cats-item { margin-bottom: 1px; }
.pa-cats-item-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
    transition: background .15s, color .15s;
}
.pa-cats-item-link:hover { background: rgba(235,94,40,0.1); color: var(--accent); }
.pa-cats-name { flex: 1; }
.pa-cats-count {
    background: rgba(235,94,40,0.14); color: var(--accent);
    font-size: 11px; font-weight: 700;
    padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.pa-cats-subs {
    margin: 1px 0 3px 20px;
    border-inline-start: 2px solid var(--border);
}
[dir="rtl"] .pa-cats-subs { margin-left: 0; margin-right: 20px; }
.pa-cats-sub-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 10px; border-radius: 6px;
    color: var(--muted); text-decoration: none; font-size: 12px;
    transition: color .15s, background .15s;
}
.pa-cats-sub-link:hover { color: var(--accent); background: rgba(235,94,40,0.07); }

@media (max-width: 768px) { .pa-cats-nav { display: none; } }
