/* ═══════════════ Theme: dark only ═══════════════ */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --brand: #4F5EE8;
  --brand-dark: #3b4dd4;
  --brand-soft: rgba(79, 94, 232, 0.15);
  --page-bg: #0f1117;
  --page-bg-alt: #13151e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-solid: #161925;
  --surface-elevated: #1a1f2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(51, 65, 85, 0.65);
  --text: #e2e8f0;
  --text-strong: #ffffff;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --nav-bg: rgba(15, 17, 23, 0.88);
  --drawer-bg: #12151e;
  --drawer-gradient: linear-gradient(165deg, #181b26 0%, #12151e 42%, #0f1117 100%);
  --hero-glow-1: rgba(79, 94, 232, 0.15);
  --hero-glow-2: rgba(99, 102, 241, 0.1);
  --input-bg: rgba(15, 23, 42, 0.72);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --backdrop: rgba(5, 7, 12, 0.78);
  --scrollbar-track: #1a1f2e;
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--page-bg);
  color: var(--text);
  transition: background-color 0.25s ease, color 0.2s ease;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 3px; }

.gradient-text {
  background: linear-gradient(135deg, #4F5EE8, #818cf8, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.glow { box-shadow: 0 0 30px rgba(79, 94, 232, 0.3); }

.nav-glass {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.hero-bg {
  background:
    radial-gradient(ellipse at 20% 50%, var(--hero-glow-1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, var(--hero-glow-2) 0%, transparent 50%),
    var(--page-bg);
}

.section-alt { background: var(--page-bg-alt); }

/* Nav drawer themed */
#nav-drawer {
  background-color: var(--drawer-bg);
  background-image: var(--drawer-gradient);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45), inset 1px 0 0 rgba(79, 94, 232, 0.15);
  transition: transform 0.28s ease, visibility 0.28s, background 0.25s ease;
}

#nav-backdrop { background: var(--backdrop); }

#nav-drawer .nav-drawer-head {
  border-bottom: 1px solid var(--border);
  background: transparent;
}

#nav-drawer .nav-drawer-section + .nav-drawer-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  color: var(--brand);
  border-color: rgba(79, 94, 232, 0.45);
  background: var(--brand-soft);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* —— Light-mode remaps for common Tailwind utilities used across templates —— */

/* Solid CTAs keep white text (override global .text-white remap) */

/* Soft amber / primary CTAs — readable on light */

/* Homepage light polish */

/* Success / emerald → primary in light theme */

/* Rose / dispute CTAs readable on light */

/* Agent avatar / icons in chat */
.chat-agent-avatar {
  background: rgba(51, 65, 85, 0.85);
  border: 1px solid rgba(71, 85, 105, 0.55);
}
.chat-agent-avatar svg {
  color: #818cf8;
}

/* Choices dropdown above listing cards */
.listings-filter {
  position: relative;
  z-index: 40;
  overflow: visible !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.listings-filter > * {
  overflow: visible !important;
  min-width: 0;
}
.listings-results {
  position: relative;
  z-index: 1;
}
.choices-open-parent {
  z-index: 50 !important;
  overflow: visible !important;
}
.q-choices {
  position: relative;
  z-index: 1;
  overflow: visible !important;
}
.q-choices.is-open {
  z-index: 9999 !important;
}
.q-choices .choices__list--dropdown,
.q-choices .choices__list[aria-expanded] {
  z-index: 9999 !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  min-width: 12rem;
  max-width: min(100vw - 2rem, 22rem);
  transform: none !important;
}
.q-choices.is-flipped .choices__list--dropdown,
.q-choices.is-flipped .choices__list[aria-expanded] {
  top: auto !important;
  bottom: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 4px !important;
}

.nav-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff !important;
  font-size: 0.65rem;
  line-height: 1.05rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

/* Selects + Choices — theme aware */
select,
.select-pretty {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--input-bg);
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%),
    linear-gradient(to left, rgba(79, 94, 232, 0.35), rgba(79, 94, 232, 0.35));
  background-position:
    left 0.9rem center,
    left 1.25rem center,
    left 2.4rem 50%;
  background-size: 6px 6px, 6px 6px, 1px 55%;
  background-repeat: no-repeat;
  border: 1px solid var(--border-strong);
  border-radius: 0.85rem;
  color: var(--text-strong);
  padding: 0.65rem 0.9rem 0.65rem 2.6rem;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 2.6rem;
  width: 100%;
  direction: rtl;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}
select:hover, .select-pretty:hover {
  border-color: rgba(129, 140, 248, 0.55);
}
select:focus, .select-pretty:focus {
  outline: none;
  border-color: #4F5EE8;
  box-shadow: 0 0 0 3px rgba(79, 94, 232, 0.22);
}
select option, .select-pretty option {
  background: var(--surface-elevated);
  color: var(--text-strong);
}

/* Chat bubbles stay vibrant */

.star-filled { color: #fbbf24; }
.star-empty { color: #cbd5e1; }
[data-theme="dark"] .star-empty { color: #374151; }

/* Homepage hero — readable in light theme */

/* Keep nested dark demo panels readable when page is light */
.q-keep-dark {
  color-scheme: dark;
}

/* AI assist drawer (manual listing) — theme aware */
#ai-assist-drawer {
  background: var(--drawer-bg);
  background-image: var(--drawer-gradient);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.25);
}

#ai-assist-drawer .ai-assist-head,
#ai-assist-drawer .ai-assist-hint,
#ai-assist-drawer .ai-assist-foot {
  border-color: var(--border);
}
#ai-assist-drawer .ai-assist-title { color: var(--text-strong); }
#ai-assist-drawer .ai-assist-muted { color: var(--text-faint); }
#ai-assist-drawer .ai-assist-close { color: var(--text-muted); }
#ai-assist-drawer .ai-assist-close:hover { color: var(--text-strong); }
#ai-assist-drawer textarea {
  background: var(--input-bg);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
#ai-assist-log .ai-assist-bubble {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Bigger handoff CTAs between AI ↔ manual */
.handoff-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.85rem 1.25rem;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.handoff-cta-amber {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}
.handoff-cta-amber:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fffbeb;
}

.handoff-cta-primary {
  background: rgba(79, 94, 232, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: #c7d2fe;
}
.handoff-cta-primary:hover {
  background: rgba(79, 94, 232, 0.28);
  color: #eef2ff;
}

.handoff-cta-block {
  display: flex;
  width: 100%;
}

/* Nav drawer icons */
.nav-drawer-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.nav-drawer-ico {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-drawer-link:hover .nav-drawer-ico { opacity: 1; }

/* Client projects filter: dropdown above cards */
.listings-filter.glass-card,
form.listings-filter {
  overflow: visible !important;
  z-index: 40;
  position: relative;
}
.listings-results {
  position: relative;
  z-index: 1;
}

/* Rose / dispute CTAs readable on light */

/* Agent avatar / icons in chat */
.chat-agent-avatar {
  background: rgba(51, 65, 85, 0.85);
  border: 1px solid rgba(71, 85, 105, 0.55);
}
.chat-agent-avatar svg { color: #818cf8; }

