/**
 * اَبوبابا — پل هماهنگ‌سازی قالب با کل اکوسیستم
 * هر قالب فقط متغیرهای :root را تنظیم می‌کند؛ این فایل آن‌ها را به
 * هدر، فوتر، مگامنو، کارت محصول، سبد کشویی، سوشال و فرم‌ها می‌رساند.
 */
:root {
  /* نام‌های استاندارد (قالب‌ها override می‌کنند) */
  --brand: var(--brand, var(--ab-red, #ef4050));
  --brand-dark: var(--brand-dark, var(--ab-red-dark, #c41830));
  --brand-light: var(--brand-light, var(--ab-red-light, #ff6b7a));
  --brand-soft: var(--theme-soft, #fff5f6);
  --surface: var(--white, #ffffff);
  --surface-muted: var(--paper-alt, #f0f0f1);
  --page-bg: var(--paper, #f5f5f5);
  --text: var(--ink, #0c0c0c);
  --text-muted: var(--ink-soft, #424750);
  --text-faint: var(--muted, #81858b);
  --border: var(--line, #e0e0e2);
  --border-soft: var(--line-soft, #f0f0f1);
  --topbar-bg: var(--brand);
  --topbar-fg: #ffffff;
  --header-bg: var(--surface);
  --footer-bg: #1f2937;
  --footer-fg: #e5e7eb;
  --mega-bg: var(--surface);
  --mega-parent-hover: var(--brand-soft);
  --drawer-bg: var(--surface);
  --drawer-fg: var(--text);
  --success: var(--green, #00a049);
  --warning: var(--warning, var(--ab-orange, #f9a825));
  --radius-sm: 6px;
  --radius: var(--radius, 8px);
  --radius-lg: var(--radius-lg, 12px);
  --shadow-sm: var(--shadow, 0 1px 6px rgba(0,0,0,.08));
  --shadow-md: var(--shadow-hover, 0 4px 16px rgba(0,0,0,.12));
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
}

/* —— بدنه و سطوح —— */
body {
  background: var(--page-bg);
  color: var(--text);
}
.bg-paper-alt { background: var(--surface-muted) !important; }

/* —— برند —— */
.btn-brand,
.btn-brand:focus {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
.btn-brand:hover {
  background: var(--brand-dark) !important;
  border-color: var(--brand-dark) !important;
  color: #fff !important;
}
.btn-outline-brand {
  color: var(--brand) !important;
  border-color: var(--brand) !important;
}
.btn-outline-brand:hover {
  background: var(--brand) !important;
  color: #fff !important;
}
.text-brand,
.navbar-brand {
  color: var(--brand) !important;
}
.price-final {
  color: var(--brand) !important;
}
.badge-discount,
.badge-discount-inline {
  background: var(--brand) !important;
}
a:hover {
  color: var(--brand);
}

/* —— نوار اعلان / تاپ‌بار —— */
.dk-topbar,
.rdl-announce,
.announcement-bar {
  background: var(--topbar-bg) !important;
  color: var(--topbar-fg) !important;
}

/* —— هدر —— */
.navbar.sticky-top,
header.site-header,
.dk-header {
  background: var(--header-bg) !important;
}
.navbar .nav-link {
  color: var(--text-muted) !important;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--brand) !important;
}

/* —— مگامنو —— */
.dk-mega-panel,
.dk-mega-body,
.dk-mega-parents {
  background: var(--mega-bg) !important;
  color: var(--text);
}
.dk-mega-parent:hover,
.dk-mega-parent.is-active {
  background: var(--mega-parent-hover) !important;
  color: var(--brand) !important;
}
.dk-mega-parent .dk-mega-ico,
.dk-mega-ico-img {
  color: var(--brand);
}
.dk-mega-col-title {
  color: var(--text-muted);
}
.dk-mega-col a:hover {
  color: var(--brand) !important;
}

/* —— کارت محصول —— */
.card-product {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-product:hover {
  box-shadow: var(--shadow-md);
}
.card-product .product-title {
  color: var(--text);
}
.product-img-wrap {
  background: var(--surface-muted);
}

/* —— سبد کشویی —— */
.rdl-cart-drawer {
  background: var(--drawer-bg) !important;
  color: var(--drawer-fg) !important;
}
.rdl-cart-drawer-hd {
  border-bottom-color: var(--border) !important;
}
.rdl-cart-drawer .btn-brand {
  background: var(--brand) !important;
}

/* —— فوتر —— */
footer.site-footer,
.dk-footer,
footer.bg-dark {
  background: var(--footer-bg) !important;
  color: var(--footer-fg) !important;
}
footer a {
  color: inherit;
  opacity: .9;
}
footer a:hover {
  color: var(--brand-light) !important;
  opacity: 1;
}

/* —— فرم‌ها و فوکوس —— */
.form-control:focus,
.form-select:focus {
  border-color: var(--brand) !important;
  box-shadow: var(--focus-ring) !important;
}
.form-check-input:checked {
  background-color: var(--brand) !important;
  border-color: var(--brand) !important;
}

/* —— سوشال / چت / FAB —— */
.rdl-chat-fab,
.social-fab,
.dk-chat-launcher {
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 40%, transparent);
}
.story-ring,
.rdl-story-ring {
  background: linear-gradient(135deg, var(--brand), var(--brand-light), var(--warning));
}

/* —— اسلایدر / ویژوال بیلدر خروجی —— */
.rs-btn-layer,
.vb-cta-btn {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

/* —— بج‌ها —— */
.badge.bg-brand {
  background: var(--brand) !important;
}
.text-success { color: var(--success) !important; }

/* —— صفحه‌بندی —— */
.pagination .page-item.active .page-link {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}
.pagination .page-link {
  color: var(--brand);
}

/* —— مقایسه / علاقه‌مندی —— */
.dk-action-ico:hover,
.btn-wishlist.active {
  color: var(--brand) !important;
}

/* —— حالت تاریک کاربر (cookie) در کنار قالب —— */
[data-theme="dark"] {
  --page-bg: #0b1220;
  --surface: #111827;
  --surface-muted: #1f2937;
  --text: #f3f4f6;
  --text-muted: #cbd5e1;
  --text-faint: #94a3b8;
  --border: #334155;
  --border-soft: #1e293b;
  --header-bg: #0f172a;
  --mega-bg: #111827;
  --drawer-bg: #111827;
  --drawer-fg: #f3f4f6;
}

/* ========== FIX: دکمه‌های افزودن به سبد — خوانایی کامل (کلاسیک + همه تم‌ها) ========== */
.btn-brand,
.btn-brand:visited,
.btn-brand:focus,
.btn-brand:focus-visible,
.btn-brand:active,
.btn-brand.active,
.btn-brand:hover,
.btn.btn-brand,
a.btn-brand {
  background: var(--brand, var(--ab-red, #ef4050)) !important;
  background-image: none !important;
  border: 1px solid var(--brand-dark, var(--ab-red-dark, #c41830)) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: none !important;
  -webkit-text-fill-color: #ffffff !important;
}
.btn-brand:hover,
.btn-brand:focus,
.btn-brand:focus-visible,
.btn-brand:active,
.btn-brand.active {
  background: var(--brand-dark, var(--ab-red-dark, #c41830)) !important;
  background-image: none !important;
  border-color: var(--brand-dark, var(--ab-red-dark, #c41830)) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  filter: none !important;
  opacity: 1 !important;
}
.btn-brand:disabled,
.btn-brand.disabled {
  background: #9ca3af !important;
  border-color: #9ca3af !important;
  color: #ffffff !important;
  opacity: 0.7 !important;
}

/* آیکن داخل دکمه برند */
.btn-brand .dk-ico,
.btn-brand svg,
.btn-brand svg path,
.btn-brand svg stroke,
button.btn-brand svg {
  color: #ffffff !important;
  fill: currentColor;
  stroke: currentColor;
  opacity: 1 !important;
}

/* دکمه سبد در صفحه محصول و لیست */
.dk-cart-btn,
button[data-ajax-action="cart"].btn-brand,
button[data-ajax-action="cart"].btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: var(--brand, #ef4050) !important;
  border-color: var(--brand-dark, #c41830) !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  min-height: 42px;
}
.dk-cart-btn:hover,
.dk-cart-btn:focus,
.dk-cart-btn:active,
button[data-ajax-action="cart"].btn-brand:hover,
button[data-ajax-action="cart"].btn-brand:focus,
button[data-ajax-action="cart"].btn-brand:active,
button[data-ajax-action="cart"].btn:hover,
button[data-ajax-action="cart"].btn:focus,
button[data-ajax-action="cart"].btn:active {
  background: var(--brand-dark, #c41830) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  filter: none !important;
}

/* بخش فروشندگان این کالا */
.dk-other-sellers .dk-seller-action .btn-brand,
.dk-seller-row .dk-seller-action .btn-brand,
.dk-seller-action button[data-ajax-action="cart"] {
  background: var(--brand, #ef4050) !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border: 1px solid var(--brand-dark, #c41830) !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  padding: 0.5rem 0.75rem !important;
  min-height: 40px;
  box-shadow: 0 2px 8px rgba(196, 24, 48, 0.2);
}
.dk-other-sellers .dk-seller-action .btn-brand:hover,
.dk-other-sellers .dk-seller-action .btn-brand:focus,
.dk-other-sellers .dk-seller-action .btn-brand:active,
.dk-seller-row .dk-seller-action .btn-brand:hover,
.dk-seller-row .dk-seller-action .btn-brand:focus,
.dk-seller-row .dk-seller-action .btn-brand:active,
.dk-seller-action button[data-ajax-action="cart"]:hover,
.dk-seller-action button[data-ajax-action="cart"]:focus,
.dk-seller-action button[data-ajax-action="cart"]:active {
  background: var(--brand-dark, #c41830) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(196, 24, 48, 0.28);
  transform: translateY(-1px);
}

/* جلوگیری از خاکستری شدن متن در کارت محصول */
.product-grid .card-product .border-top .btn-brand,
.product-grid .card-product .border-top .btn-brand:hover,
.card-product .btn-brand,
.card-product .btn-brand:hover,
.card-product .btn-brand:active,
.card-product .btn-brand:focus {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: var(--brand, #ef4050) !important;
}
.product-grid .card-product .border-top .btn-brand:hover,
.card-product .btn-brand:hover {
  background: var(--brand-dark, #c41830) !important;
}

/* outline brand — متن روی hover سفید */
.btn-outline-brand:hover,
.btn-outline-brand:focus,
.btn-outline-brand:active {
  background: var(--brand, #ef4050) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: var(--brand, #ef4050) !important;
}

