/* ═══════════════════════════════════════════════════════════
   فونت ایران‌سن‌س (IRANSans) — بارگذاری محلی
   ═══════════════════════════════════════════════════════════ */
@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 200;
    src: url('../fonts/iran-sans/IRANSansWeb_UltraLight.woff2') format('woff2'),
         url('../fonts/iran-sans/IRANSansWeb_UltraLight.woff') format('woff'),
         url('../fonts/iran-sans/IRANSansWeb_UltraLight.ttf') format('truetype');
}

@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 300;
    src: url('../fonts/iran-sans/IRANSansWeb_Light.woff2') format('woff2'),
         url('../fonts/iran-sans/IRANSansWeb_Light.woff') format('woff'),
         url('../fonts/iran-sans/IRANSansWeb_Light.ttf') format('truetype');
}

@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/iran-sans/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/iran-sans/IRANSansWeb.woff') format('woff'),
         url('../fonts/iran-sans/IRANSansWeb.ttf') format('truetype');
}

@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 500;
    src: url('../fonts/iran-sans/IRANSansWeb_Medium.woff2') format('woff2'),
         url('../fonts/iran-sans/IRANSansWeb_Medium.woff') format('woff'),
         url('../fonts/iran-sans/IRANSansWeb_Medium.ttf') format('truetype');
}

@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/iran-sans/IRANSansWeb_Bold.woff2') format('woff2'),
         url('../fonts/iran-sans/IRANSansWeb_Bold.woff') format('woff'),
         url('../fonts/iran-sans/IRANSansWeb_Bold.ttf') format('truetype');
}

/* ═══════════════════════════════════════════════════════════
   متغیرهای استاندارد تم (پایه — تم روشن پیش‌فرض)
   ═══════════════════════════════════════════════════════════ */
:root {
    --primary-color: #2563eb;   /* آبی الکترونیک */
    --primary-hover: #1d4ed8;
    --accent: #f97316;          /* نارنجی انرژی‌بخش */
    --accent-hover: #ea580c;
    --bg-color: #f9fafb;
    --surface-color: #ffffff;
    --text-color: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 12px;

    /* فیلدهای ورودی و جدول‌ها (تم‌پذیر) */
    --input-bg: #ffffff;
    --input-text: #1f2937;
    --border-color: #e5e7eb;
    --table-text: #1f2937;
    --table-header-bg: #f1f5f9;
    --table-border: #e5e7eb;
    --table-hover-bg: #f8fafc;

    /* نام‌های قدیمی (سازگاری با کد موجود) */
    --primary: var(--primary-color);
    --primary-dark: var(--primary-hover);
    --bg: var(--bg-color);
    --card-bg: var(--surface-color);
    --text: var(--text-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'IRANSans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- هدر ---------- */

.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 16px;
}

.logo {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--accent, var(--primary));
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.search-box {
    flex: 1;
    display: flex;
}

.search-box input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border-color, var(--border));
    /* در RTL ورودی سمت راست است → گوشه‌های راست گرد */
    border-radius: 0 var(--radius) var(--radius) 0;
    font: inherit;
    outline: none;
    background: var(--input-bg, #fff);
    color: var(--input-text, var(--text));
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box button {
    padding: 9px 18px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius) 0 0 var(--radius);
    cursor: pointer;
    font: inherit;
}

.search-box button:hover {
    background: var(--primary-dark);
}

/* ---------- جستجوی زنده ---------- */

.search-box {
    position: relative;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    z-index: 100;
    display: none;
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}

.search-results.open {
    display: block;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.search-item:hover {
    background: #f1f5f9;
}

.search-item img,
.search-ph {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #cbd5e1;
}

.search-name {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.5;
}

.search-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

.search-discount {
    background: var(--danger);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.search-empty {
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
}

/* ---------- ناوبری ---------- */

.site-nav {
    background: var(--primary);
}

.site-nav .container {
    display: flex;
    gap: 24px;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    padding: 12px 0;
    display: inline-block;
    opacity: 0.9;
}

.site-nav a:hover {
    opacity: 1;
}

/* ---------- محتوا ---------- */

main.container {
    padding-top: 24px;
    padding-bottom: 48px;
    min-height: 60vh;
}

.page-head {
    margin-bottom: 16px;
}

.hero {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    border-radius: var(--radius);
    padding: 40px 28px;
    margin-bottom: 28px;
}

.hero h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

/* ═══════════ اسلایدر صفحه اصلی ═══════════ */

.home-slider {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    background: var(--card-bg);
}

.home-slider-track {
    position: relative;
    height: 380px;
}

.home-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
}

.home-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.home-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-slide-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.05) 60%);
    color: #fff;
}

.home-slide-content h2 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.home-slide-content p {
    font-size: 1rem;
    color: #f1f5f9;
    max-width: 560px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

/* دکمه‌های ناوبری */
.home-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #1e293b;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.home-slider:hover .home-slider-nav {
    opacity: 1;
}

.home-slider-prev {
    right: 12px;
}

.home-slider-next {
    left: 12px;
}

.home-slider-dots {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
}

.home-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.home-slider-dot.active {
    background: #fff;
    transform: scale(1.25);
}

/* ── انیمیشن‌های تعویض اسلاید ── */
.home-slider[data-animation="slide"] .home-slide:not(.active) {
    transform: translateX(100%);
}

.home-slider[data-animation="zoom"] .home-slide:not(.active) {
    transform: scale(0.85);
}

.home-slider[data-animation="cube"] {
    perspective: 1200px;
}

.home-slider[data-animation="cube"] .home-slide {
    transform-origin: right center;
}

.home-slider[data-animation="cube"] .home-slide:not(.active) {
    transform: rotateY(85deg);
    opacity: 0.4;
}

.home-slider[data-animation="flip"] {
    perspective: 1200px;
}

.home-slider[data-animation="flip"] .home-slide {
    backface-visibility: hidden;
}

.home-slider[data-animation="flip"] .home-slide:not(.active) {
    transform: rotateY(180deg);
}

/* ── ریسپانسیو اسلایدر ── */
@media (min-width: 768px) and (max-width: 1024px) {
    .home-slider-track {
        height: 280px;
    }
}

@media (max-width: 767px) {
    .home-slider-track {
        height: 200px;
    }
    .home-slide-content {
        padding: 14px;
    }
    .home-slide-content h2 {
        font-size: 1.05rem;
    }
    .home-slide-content p {
        font-size: 0.82rem;
    }
    .home-slider-nav {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
        opacity: 0.85;
    }
    .home-slider-dot {
        width: 8px;
        height: 8px;
    }
}

/* ---------- کارت محصول ---------- */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}

.product-card h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.product-card a {
    color: var(--text);
    text-decoration: none;
}

.product-card a:hover {
    color: var(--primary);
}

.product-category {
    color: var(--muted);
    font-size: 0.85rem;
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f1f5f9;
    display: block;
}

.product-image-lg {
    height: 260px;
}

.product-image-ph {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: #cbd5e1;
}

.table-thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    background: #f1f5f9;
}

.image-preview {
    margin-top: 10px;
}

.image-preview img {
    max-width: 180px;
    max-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
    margin-bottom: 6px;
}

.product-price {
    color: var(--primary);
    font-weight: 700;
    margin-top: 8px;
}

/* قیمت ۰ (تعیین از طریق گزینه‌ها/استعلام) — «۰ تومان» نمایش داده نمی‌شود */
.product-price-placeholder {
    color: var(--muted, #64748b);
    font-weight: 500;
    font-size: 1.05rem;
}

/* برچسب «سفارشی» برای محصولات بدون موجودی ثابت */
.product-stock-custom {
    color: var(--warning, #d97706);
    font-weight: 700;
}

.product-lead-time {
    color: var(--muted, #64748b);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* نشان «سفارشی» در کارت محصولات و جستجو */
.badge-custom {
    display: inline-block;
    background: var(--warning, #d97706);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    vertical-align: middle;
}

/* ویدیوی embed (سایت‌های دیگر) در استیج گالری */
.gallery-embed {
    border: 0;
    display: block;
    background: #000;
}

/* ---------- بخش‌های صفحه محصولات ---------- */

.products-section {
    margin-bottom: 36px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text);
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.product-card-head {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    min-height: 24px;
}

.discount-badge {
    display: inline-block;
    background: var(--accent, var(--danger));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

.new-badge {
    display: inline-block;
    background: var(--success);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

.product-old-price {
    color: var(--muted);
    font-size: 0.82rem;
    text-decoration: line-through;
}

/* ---------- فیلتر ---------- */

.filter-bar {
    margin-bottom: 20px;
}

/* ---------- نمای درختی محصولات (ادمین) ---------- */

.prod-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pt-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    overflow: hidden;
}

.pt-group .pt-group {
    margin: 8px 12px;
}

.pt-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card-bg);
    color: var(--text);
    border: 0;
    border-bottom: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: right;
    transition: background 0.2s ease;
}

.pt-head:hover {
    background: var(--hover-bg, rgba(127, 127, 127, 0.08));
}

.pt-group.pt-open > .pt-head {
    border-bottom-color: var(--border);
}

.pt-caret {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    color: var(--text-muted, #777);
}

.pt-group.pt-open > .pt-head .pt-caret {
    transform: rotate(90deg);
}

.pt-count {
    color: var(--text-muted, #777);
    font-weight: 400;
    font-size: 0.85rem;
}

.pt-body {
    display: none;
}

.pt-group.pt-open > .pt-body {
    display: block;
    animation: ptExpand 0.25s ease;
}

@keyframes ptExpand {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pt-table {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--card-bg);
}

/* ---------- جزئیات محصول ---------- */

.product-detail {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    /* بدون محدودیت عرض — هم‌عرض با بقیهٔ کارت‌های صفحه محصول */
}

/* ── چیدمان دوستونهٔ صفحه محصول: گالری | اطلاعات + خرید ── */
@media (min-width: 900px) {
    .product-detail {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
        grid-template-areas:
            "gallery info"
            "desc    buy";
        gap: 26px 30px;
    }
    .product-gallery-col { grid-area: gallery; min-width: 0; }
    .product-info        { grid-area: info;    min-width: 0; }
    .product-buy         { grid-area: buy;     min-width: 0; }
    .product-description { grid-area: desc;    min-width: 0; }
}

.product-info h1 {
    margin-bottom: 8px;
}

.product-description {
    margin: 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text);
    line-height: 1.9;
}

.product-stock {
    color: var(--success);
    font-size: 0.9rem;
}

.product-stock.out {
    color: var(--danger);
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    margin-top: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font: inherit;
    transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.btn:hover {
    background: var(--primary-dark);
}

/* ---------- فوتر ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    padding: 18px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.social-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--color-background, #f9fafb);
    transform: translateY(-2px);
}

.social-link svg {
    display: block;
}

.empty {
    color: var(--muted);
    padding: 40px 0;
    text-align: center;
}

/* ---------- ناحیه کاربری هدر ---------- */

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.user-link {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}

.user-link:hover {
    color: var(--primary);
}

.user-greeting {
    color: var(--muted);
    font-size: 0.9rem;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 14px;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.inline {
    display: inline;
}

/* ── زنگوله اعلان‌های مدیریت ── */

.notif-bell {
    position: relative;
}

.notif-bell-btn {
    position: relative;
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.notif-bell-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.notif-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--danger, #dc2626);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 10px;
    padding: 0 4px;
    text-align: center;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: none;
    z-index: 120;
    overflow: hidden;
}

.notif-dropdown.open {
    display: block;
    animation: modalBackdropIn 0.2s ease;
}

.notif-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--table-header-bg, #f8fafc);
}

.notif-dropdown-head strong {
    font-size: 0.9rem;
}

.notif-mark-all {
    background: none;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.notif-item.unread {
    background: var(--table-header-bg, #f8fafc);
}

.notif-item.unread::before {
    content: "•";
    color: var(--primary);
    margin-inline-end: 6px;
    font-weight: 700;
}

.notif-item-text {
    font-size: 0.83rem;
    line-height: 1.5;
}

.notif-item-meta {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 4px;
}

.notif-empty {
    padding: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.notif-dropdown-foot {
    display: block;
    text-align: center;
    padding: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--primary);
    text-decoration: none;
    background: var(--card-bg);
}

.notif-dropdown-foot:hover {
    text-decoration: underline;
}

/* ---------- دکمه‌ها ---------- */

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    border: none;
    cursor: pointer;
    font: inherit;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.82rem;
    margin-top: 0;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------- فرم‌ها ---------- */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius);
    font: inherit;
    background: var(--input-bg, #fff);
    color: var(--input-text, var(--text));
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    cursor: pointer;
}

.search-inline {
    width: auto;
    min-width: 240px;
    display: inline-block;
}

/* ---------- پیام‌ها ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* ---------- جدول‌ها ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--table-border, var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--table-border, var(--border));
    color: var(--table-text, var(--text));
}

.table th {
    background: var(--table-header-bg, #f8fafc);
    font-weight: 700;
}

.table tbody tr:hover {
    background: var(--table-hover-bg, #fafbfc);
}

.table tfoot th {
    background: var(--table-header-bg, #f8fafc);
}

.table a {
    color: var(--primary);
    text-decoration: none;
}

/* دکمه‌های لینکی داخل جدول: متن سفید (جلوگیری از override رنگ لینک جدول) */
.table a.btn {
    color: #fff;
}

.actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.actions .btn {
    margin-top: 0;
}

/* ---------- نشان (بج) وضعیت ---------- */

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    background: #f1f5f9;
    color: var(--muted);
}

.badge-pending {
    background: #fef3c7;
    color: #b45309;
}

.badge-paid {
    background: #dcfce7;
    color: #15803d;
}

.badge-shipped {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-delivered {
    background: #ccfbf1;
    color: #0f766e;
}

.badge-canceled {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

/* ردیف اعلان خوانده‌نشده */
.notif-unread {
    background: var(--table-header-bg, #f8fafc);
}

.notif-unread td:first-child {
    border-inline-start: 3px solid var(--primary);
}

/* ---------- صفحه ورود/ثبت‌نام ---------- */

.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    margin-bottom: 6px;
    font-size: 1.3rem;
}

.auth-sub {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.auth-alt {
    margin-top: 18px;
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
}

.auth-alt a {
    color: var(--primary);
}

/* ---------- چیدمان پنل (سایدبار + محتوا) ---------- */

.panel-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    padding-top: 24px;
    padding-bottom: 48px;
    align-items: start;
}

.panel-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    position: sticky;
    top: 16px;
}

.panel-sidebar nav {
    display: flex;
    flex-direction: column;
}

.panel-sidebar a {
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.92rem;
}

.panel-sidebar a:hover {
    background: #f1f5f9;
}

.panel-sidebar a.active {
    background: var(--primary);
    color: #fff;
}

.panel-sidebar .nav-group + .nav-group {
    margin-top: 18px;
}

.panel-sidebar .nav-group {
    display: flex;
    flex-direction: column;
    padding-top: 14px;
}

.panel-sidebar .nav-group-title {
    display: block;
    padding: 0 8px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.4;
}

.panel-sidebar .nav-group > a {
    font-size: 0.9rem;
}

.panel-sidebar .nav-group + .nav-group {
    border-top: 1px solid var(--border);
}

.panel-sidebar .nav-group:first-of-type {
    border-top: 0;
    padding-top: 4px;
}

.panel-sidebar .nav-group:first-of-type {
    margin-top: 6px;
}

.panel-sidebar .nav-group-title:first-child {
    padding-top: 0;
}

.panel-sidebar .nav-group + .nav-group .nav-group-title {
    padding-top: 0;
}

.panel-content {
    min-width: 0;
}

.panel-content h2 {
    font-size: 1.1rem;
    margin: 24px 0 12px;
}

.panel-intro {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    font-size: 0.92rem;
}

/* ---------- داشبورد مدیر ---------- */

.page-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-head-row h1 {
    margin-bottom: 0;
}

.page-head-row .btn {
    margin-top: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card.stat-warn {
    border-color: #fca5a5;
    background: #fef2f2;
}

.stat-card.stat-good .stat-value {
    color: var(--success);
}

.stat-card.stat-bad {
    border-color: #fca5a5;
    background: #fef2f2;
}

.stat-card.stat-bad .stat-value {
    color: var(--danger);
}

.text-profit {
    color: var(--success);
    font-weight: 700;
}

.text-loss {
    color: var(--danger);
    font-weight: 700;
}

/* ---------- تب‌های زیر صفحه ---------- */

.sub-tabs {
    display: flex;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
}

.sub-tab {
    padding: 6px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.9rem;
}

.sub-tab:hover {
    color: var(--primary);
}

.sub-tab.active {
    background: var(--primary);
    color: #fff;
}

.filter-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    margin-inline-end: 8px;
}

.price-range {
    margin-top: 12px;
}

.price-range .filter-label {
    display: block;
    margin: 0 0 6px;
}

.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-range-inputs .form-control {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.85rem;
}

.price-range-sep {
    color: var(--muted);
    font-size: 0.8rem;
}

.form-hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--primary);
}

.stat-label {
    color: var(--muted);
    font-size: 0.82rem;
}

.admin-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ---------- منوی همبرگری و درخت محصولات ---------- */

.nav-inner {
    position: relative;
    display: flex;
    align-items: center;
}

/* ── کشوی منوی موبایل (Off-canvas Drawer) ── */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 190;
}

.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--card-bg);
    border-inline-start: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.drawer.open {
    transform: translateX(0);
}

body.drawer-locked {
    overflow: hidden;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--table-header-bg, #f8fafc);
    position: sticky;
    top: 0;
    z-index: 2;
}

.drawer-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
}

.drawer-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.drawer-close:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.drawer-nav {
    padding: 10px 0 30px;
}

.drawer-link {
    display: block;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease, color 0.2s ease;
}

.drawer-link:hover {
    background: var(--table-header-bg, #f8fafc);
    color: var(--primary);
}

.drawer-sub {
    padding-inline-start: 28px;
    font-size: 0.85rem;
    border-bottom: 0;
}

/* آکاردئون گروه‌ها در کشو */
.drawer-group {
    border-bottom: 1px solid var(--border);
}

.drawer-acc-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: 0;
    padding: 12px 16px;
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s ease;
}

.drawer-acc-head:hover {
    background: var(--table-header-bg, #f8fafc);
}

.drawer-caret {
    transition: transform 0.25s ease;
    color: var(--muted);
    font-size: 0.75rem;
}

.drawer-acc-head.open .drawer-caret {
    transform: rotate(180deg);
}

.drawer-acc-body {
    display: none;
}

.drawer-acc-body.open {
    display: block;
    animation: ptExpand 0.25s ease;
}

/* درخت دسته‌بندی داخل کشو — آکاردئونی */
.drawer details.tree-branch {
    border-bottom: 1px solid var(--border);
}

.drawer details.tree-branch summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 16px;
    font-size: 0.85rem;
}

.drawer details.tree-branch summary::-webkit-details-marker {
    display: none;
}

.drawer details.tree-branch summary::before {
    content: "▸";
    display: inline-block;
    margin-inline-end: 8px;
    transition: transform 0.25s ease;
    color: var(--muted);
}

.drawer details.tree-branch[open] summary::before {
    transform: rotate(90deg);
}

.drawer details.tree-branch summary a {
    color: var(--text);
    text-decoration: none;
}

.drawer .tree-count {
    color: var(--muted);
    font-size: 0.75rem;
}

.drawer .tree-children {
    padding-inline-start: 20px;
}

.drawer .tree-children > a {
    display: block;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    border-top: 1px dashed var(--border);
}

.drawer .tree-children > a:hover {
    color: var(--primary);
    background: var(--table-header-bg, #f8fafc);
}

.drawer .tree-separator {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* همبرگر موبایل */

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 0;
    margin-inline-end: 12px;
}

.nav-toggle-bar {
    width: 24px;
    height: 2px;
    background: var(--text, #1f2937);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* همبرگر روی نوار ناوبری (پس‌زمینه primary تیره) → میله‌ها روشن */
.site-nav .nav-toggle-bar {
    background: #fff;
}

[data-theme="dark"] .site-nav .nav-toggle-bar {
    background: #fff;
}

.nav-toggle.open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: #fff;
    font: inherit;
    padding: 12px 0;
    cursor: pointer;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dropdown-toggle:hover {
    opacity: 1;
}

.caret {
    font-size: 0.8rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    min-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 8px;
    z-index: 60;
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    color: var(--text);
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 1;
}

.dropdown-menu a:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.tree-all {
    font-weight: 700;
    color: var(--primary) !important;
}

.tree-branch summary {
    list-style: none;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 6px;
}

.tree-branch summary::-webkit-details-marker {
    display: none;
}

.tree-branch summary::before {
    content: "▸";
    margin-inline-end: 8px;
    color: var(--muted);
    transition: transform 0.15s;
}

.tree-branch[open] summary::before {
    transform: rotate(90deg);
}

.tree-branch summary a {
    flex: 1;
    padding: 6px 2px;
}

.tree-count {
    color: var(--muted);
    font-size: 0.8rem;
}

.tree-children {
    margin-inline-start: 18px;
    padding-inline-start: 8px;
    border-inline-start: 1px dashed var(--border);
}

/* ---------- کارت‌ها و صفحات عمومی ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.about-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.about-list {
    padding-inline-start: 20px;
    color: var(--text);
}

.about-list li {
    margin-bottom: 8px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ---------- پیام‌های تیکت ---------- */

.ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 12px;
}

.ticket-message {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    max-width: 85%;
}

.ticket-message.ticket-user {
    align-self: flex-start;
    border-inline-start: 4px solid var(--primary);
}

.ticket-message.ticket-admin {
    align-self: flex-end;
    border-inline-start: 4px solid var(--success);
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.ticket-msg-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.ticket-message p {
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .panel-layout {
        grid-template-columns: 1fr;
    }

    .panel-sidebar {
        position: static;
    }

    .admin-cols,
    .form-row,
    .about-cols,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    /* موبایل: منوی افقی دسکتاپ پنهان می‌شود و کشوی Off-canvas جای آن می‌آید */
    .nav-toggle {
        display: flex;
    }

    #navLinksDesktop {
        display: none;
    }

    .ticket-message {
        max-width: 100%;
    }
}

/* ---------- نرخ تتر و قیمت پویا ---------- */

.price-dynamic-note {
    font-size: 0.78rem;
    color: #888;
    margin: 2px 0 0;
}

.product-price + .price-dynamic-note {
    margin-top: -2px;
}

.input-with-btn {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-btn .form-control {
    flex: 1;
}

.input-with-btn .btn {
    white-space: nowrap;
}

.rate-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.rate-current {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rate-label {
    font-size: 0.85rem;
    color: #888;
}

.rate-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #16a34a;
}

.rate-value small {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

.rate-source {
    font-size: 0.8rem;
    color: #999;
}

.rate-actions .btn {
    font-size: 0.95rem;
    padding: 10px 18px;
}

.rate-manual {
    width: 100%;
    max-width: 480px;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 12px 14px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.9rem;
    line-height: 1.8;
}

.alert-info ul {
    margin: 6px 0 0;
    padding-inline-start: 20px;
}

.alert-info code {
    background: rgba(30, 64, 175, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    direction: ltr;
    display: inline-block;
    unicode-bidi: embed;
}

/* ---------- کلید فعال/غیرفعال (Toggle Switch) ---------- */

.toggle-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.toggle-desc {
    font-size: 0.85rem;
    color: var(--muted);
}

.text-success {
    color: var(--success);
    font-weight: 600;
}

.text-muted {
    color: var(--muted);
}

.toggle-btn {
    position: relative;
    width: 56px;
    height: 30px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    transition: background 0.25s;
    flex-shrink: 0;
}

.toggle-btn.toggle-on {
    background: var(--success);
}

.toggle-btn.toggle-off {
    background: #d1d5db;
}

.toggle-btn.toggle-on:hover {
    background: #15803d;
}

.toggle-btn.toggle-off:hover {
    background: #9ca3af;
}

.toggle-knob {
    position: absolute;
    top: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s;
}

.toggle-btn.toggle-on .toggle-knob {
    transform: translateX(27px);
}

.toggle-btn.toggle-off .toggle-knob {
    transform: translateX(-3px);
}

/* ---------- مودال (Modal) ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: modalBackdropIn 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--surface-color, #fff);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    padding: 28px 24px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.25s ease;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.modal-body {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.8;
}

.modal-hint {
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-actions .btn {
    margin-top: 0;
    font-size: 0.88rem;
    padding: 10px 16px;
}

/* ---------- Quick Summary ---------- */

.quick-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.95rem;
    color: #15803d;
    font-weight: 500;
    line-height: 1.8;
}

/* ---------- Table Specs ---------- */

.specs-card {
    margin-top: 24px;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.specs-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.spec-key {
    font-weight: 700;
    color: var(--text);
    width: 160px;
    background: #f8fafc;
    /* dir="auto" جهت متن را تشخیص می‌دهد؛ موقعیت سلول همیشه سمت راست می‌ماند */
    text-align: right;
}

.spec-value {
    color: var(--text);
    /* dir="auto" ترکیب فارسی/انگلیسی را درست رندر می‌کند؛ تراز متن همیشه راست */
    text-align: right;
}

/* ---------- FAQ Accordion ---------- */

.faq-card {
    margin-top: 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.faq-item summary {
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    background: #f8fafc;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::before {
    content: "▸";
    font-size: 1.1rem;
    color: var(--primary);
    transition: transform 0.2s;
}

.faq-item[open] summary::before {
    transform: rotate(90deg);
}

.faq-item p {
    padding: 12px 16px;
    margin: 0;
    line-height: 1.8;
}

/* ---------- Reviews ---------- */

.reviews-card {
    margin-top: 24px;
}

.review-summary {
    margin-bottom: 16px;
}

.avg-rating {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
}

.avg-rating small {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 400;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.review-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.review-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.review-stars {
    font-size: 0.85rem;
}

.review-date {
    color: var(--muted);
    font-size: 0.78rem;
    margin-inline-start: auto;
}

.review-body {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.7;
}

.review-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.review-form h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.star-rating {
    display: flex;
    gap: 4px;
}

.star-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0 2px;
    transition: transform 0.15s;
    opacity: 1;
}

.star-btn:hover {
    transform: scale(1.2);
}

/* ---------- Admin FAQ Row ---------- */

.faq-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    position: relative;
}

.faq-row .btn {
    margin-top: 0;
}

/* ══════════════════════ Theme Switcher (Dropdown) ══════════════════════ */

.theme-switcher {
    position: relative;
    flex-shrink: 0;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    transition: background 0.2s, border-color 0.2s, transform 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.theme-toggle:active {
    transform: scale(0.92);
}

/* آیکون مربوط به تم فعلی نمایش داده می‌شود */
.theme-icon-dark,
.theme-icon-emerald,
.theme-icon-indigo {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

[data-theme="emerald"] .theme-icon-emerald {
    display: inline;
}

[data-theme="indigo"] .theme-icon-indigo {
    display: inline;
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    padding: 6px;
    z-index: 200;
    display: none;
    animation: dropdownIn 0.18s ease;
}

.theme-dropdown.open {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: right;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: background 0.15s ease;
}

.theme-option:hover {
    background: rgba(37, 99, 235, 0.08);
}

.theme-option.active {
    background: var(--primary);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════
   تم‌های پیش‌فرض (CSS Variables)
   ═══════════════════════════════════════════════════════════ */

/* ── تم تاریک: پس‌زمینه دارک، متن روشن، هایلایت فیروزه‌ای/آبی ── */
[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --accent:        #fbbf24;
    --accent-hover:  #f59e0b;
    --highlight:     #22d3ee;
    --bg-color:      #0f172a;
    --surface-color: #1e293b;
    --text-color:    #e5e7eb;
    --muted:         #9ca3af;
    --border:        #334155;
    --success:       #15803d;  /* تیره‌تر برای کنتراست AA متن سفید روی بج/دکمه سبز (۵:1) */
    --danger:        #ef4444;

    --input-bg:        #0f172a;
    --input-text:      #e5e7eb;
    --border-color:    #334155;
    --table-text:      #e5e7eb;
    --table-header-bg: #263348;
    --table-border:    #334155;
    --table-hover-bg:  #263348;

    --primary:      var(--primary-color);
    --primary-dark: var(--primary-hover);
    --bg:           var(--bg-color);
    --card-bg:      var(--surface-color);
    --text:         var(--text-color);
}

/* ── تم زمردی (Emerald): ترکیب زمردی و خاکستری روشن ── */
[data-theme="emerald"] {
    --primary-color: #059669;
    --primary-hover: #047857;
    --accent:        #10b981;
    --accent-hover:  #0d9668;
    --bg-color:      #f0fdf4;
    --surface-color: #ffffff;
    --text-color:    #1f2937;
    --muted:         #64748b;
    --border:        #d1fae5;
    --success:       #16a34a;
    --danger:        #dc2626;

    --input-bg:        #ffffff;
    --input-text:      #1f2937;
    --border-color:    #d1fae5;
    --table-text:      #1f2937;
    --table-header-bg: #ecfdf5;
    --table-border:    #d1fae5;
    --table-hover-bg:  #f0fdf4;

    --primary:      var(--primary-color);
    --primary-dark: var(--primary-hover);
    --bg:           var(--bg-color);
    --card-bg:      var(--surface-color);
    --text:         var(--text-color);
}

/* ── تم نیلی (Tech Indigo): لهجه‌های نیلی و بنفش مدرن ── */
[data-theme="indigo"] {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent:        #8b5cf6;
    --accent-hover:  #7c3aed;
    --bg-color:      #eef2ff;
    --surface-color: #ffffff;
    --text-color:    #1e1b4b;
    --muted:         #6d7280;
    --border:        #e0e7ff;
    --success:       #16a34a;
    --danger:        #dc2626;

    --input-bg:        #ffffff;
    --input-text:      #1e1b4b;
    --border-color:    #e0e7ff;
    --table-text:      #1e1b4b;
    --table-header-bg: #eef2ff;
    --table-border:    #e0e7ff;
    --table-hover-bg:  #f5f7ff;

    --primary:      var(--primary-color);
    --primary-dark: var(--primary-hover);
    --bg:           var(--bg-color);
    --card-bg:      var(--surface-color);
    --text:         var(--text-color);
}

/* ── overrides for hardcoded light values ── */
[data-theme="dark"] body {
    background: var(--bg);
    color: var(--text);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] .site-footer {
    background: #1a2332;
    border-color: var(--border);
}

[data-theme="dark"] .site-nav {
    background: #1e3a5f;
}

[data-theme="dark"] .product-card,
[data-theme="dark"] .product-detail,
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .rate-card,
[data-theme="dark"] .panel-sidebar,
[data-theme="dark"] .panel-intro,
[data-theme="dark"] .modal-box {
    background: var(--card-bg);
    border-color: var(--border);
}

[data-theme="dark"] .table,
[data-theme="dark"] .table td {
    background: var(--card-bg);
    border-color: var(--table-border, var(--border));
}

/* هدر جدول در تم تاریک — از متغیر اختصاصی تا از ردیف‌ها متمایز بماند */
[data-theme="dark"] .table th {
    background: var(--table-header-bg, #263348);
    border-color: var(--table-border, var(--border));
    color: var(--table-text, var(--text));
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--card-bg);
    border-color: var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-menu a,
[data-theme="dark"] .product-card a,
[data-theme="dark"] .ticket-message p,
[data-theme="dark"] .search-item {
    color: var(--text);
}

[data-theme="dark"] .dropdown-menu a:hover,
[data-theme="dark"] .search-item:hover,
[data-theme="dark"] .panel-sidebar a:hover {
    background: #263348;
}

[data-theme="dark"] .tree-children {
    border-left-color: var(--border);
}

[data-theme="dark"] .search-results {
    background: var(--card-bg);
    border-color: var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .alert {
    color: var(--text);
}

[data-theme="dark"] .alert-success {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.3);
    color: var(--success);
}

[data-theme="dark"] .alert-error {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--danger);
}

[data-theme="dark"] .alert-warning {
    background: rgba(217, 119, 6, 0.12);
    border-color: rgba(217, 119, 6, 0.3);
    color: #fbbf24;
}

[data-theme="dark"] .alert-info {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .alert-info code {
    background: rgba(96, 165, 250, 0.12);
}

[data-theme="dark"] .quick-summary {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.25);
    color: var(--success);
}

[data-theme="dark"] .spec-key {
    background: #263348;
    color: var(--text);
}

[data-theme="dark"] .faq-item summary {
    background: #263348;
}

[data-theme="dark"] .rate-value,
[data-theme="dark"] .rate-label,
[data-theme="dark"] .rate-source {
    color: var(--text);
}

[data-theme="dark"] .rate-value {
    color: var(--success);
}

[data-theme="dark"] .rate-value small {
    color: var(--muted);
}

[data-theme="dark"] .ticket-message.ticket-admin {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}

[data-theme="dark"] .star-btn {
    filter: brightness(1.2);
}

[data-theme="dark"] .badge {
    background: #334155;
    color: var(--text);
}

[data-theme="dark"] .badge-pending {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

[data-theme="dark"] .badge-paid {
    background: rgba(22, 163, 74, 0.18);
    color: #4ade80;
}

[data-theme="dark"] .badge-shipped {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

[data-theme="dark"] .badge-delivered {
    background: rgba(20, 184, 166, 0.18);
    color: #5eead4;
}

[data-theme="dark"] .badge-canceled {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

[data-theme="dark"] .badge-info {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

[data-theme="dark"] .btn-ghost {
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .user-link,
[data-theme="dark"] .user-greeting,
[data-theme="dark"] .product-category,
[data-theme="dark"] .price-dynamic-note,
[data-theme="dark"] .review-date,
[data-theme="dark"] .avg-rating small,
[data-theme="dark"] .form-hint,
[data-theme="dark"] .panel-intro,
[data-theme="dark"] .empty {
    color: var(--muted);
}

[data-theme="dark"] .product-image-ph,
[data-theme="dark"] .table-thumb,
[data-theme="dark"] .image-preview img {
    background: #263348;
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #1e3a5f, #5b21b6);
}

[data-theme="dark"] .stat-card.stat-bad,
[data-theme="dark"] .stat-card.stat-warn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .sub-tabs {
    background: var(--card-bg);
    border-color: var(--border);
}

[data-theme="dark"] .sub-tab {
    color: var(--muted);
}

[data-theme="dark"] .auth-card,
[data-theme="dark"] .panel-intro {
    background: var(--card-bg);
}

[data-theme="dark"] .divider {
    border-color: var(--border);
}

[data-theme="dark"] .toggle-btn.toggle-off {
    background: #475569;
}

[data-theme="dark"] .toggle-btn.toggle-off:hover {
    background: #64748b;
}

/* mobile menu in dark */
@media (max-width: 900px) {
    [data-theme="dark"] .dropdown-menu {
        background: rgba(255, 255, 255, 0.08);
    }
}

/* ═══════════════════ Responsive Admin Panel ═══════════════════ */

/* همبرگر سایدبار ادمین — فقط در موبایل/تبلت دیده می‌شود */
.admin-nav-toggle {
    display: none;
    flex-shrink: 0;
}

.admin-nav-toggle .nav-toggle-bar {
    background: var(--text, #1f2937);
}

@media (max-width: 900px) {
    .admin-nav-toggle {
        display: flex;
    }

    /* سایدبار به کشوی مخفی تبدیل می‌شود */
    .panel-sidebar {
        display: none;
        max-height: 70vh;
        overflow-y: auto;
        margin-bottom: 12px;
    }

    .panel-sidebar.open {
        display: block;
        animation: ptExpand 0.25s ease;
    }

    .admin-header .header-inner {
        gap: 12px;
        flex-wrap: wrap;
    }

    /* زنگوله و دراپ‌داون در موبایل */
    .notif-dropdown {
        left: auto;
        right: 0;
        position: fixed;
        top: 60px;
        width: min(360px, 92vw);
    }
}

/* هدر سایت در موبایل: جستجو به ردیف کامل می‌رود */
@media (max-width: 768px) {
    .site-header .header-inner {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box {
        order: 10;
        flex-basis: 100%;
    }

    .header-user {
        margin-inline-start: auto;
    }
}

/* اسکرول افقی جداول در موبایل (جداول ادمین و فاکتورها) */
@media (max-width: 768px) {
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .table thead,
    .table tbody,
    .table tr {
        display: table;
        width: 100%;
        table-layout: auto;
    }

    .table tr {
        width: max-content;
        min-width: 100%;
    }

    .panel-content {
        padding: 0 4px;
    }

    .page-head-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .actions .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* تبلت: گرید محصولات ۲–۳ ستونه */
@media (min-width: 768px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
}

/* ═══════════════════ Custom Options (فرم‌ساز سفارشی‌سازی) ═══════════════════ */

.product-buy {
    display: flex;
    flex-direction: column;
}

.custom-options-card {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
}

.custom-options-card h2 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.custom-options-intro {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.custom-option-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.custom-option-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.custom-option-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.custom-required {
    color: var(--danger);
    font-weight: 900;
    font-size: 1.1rem;
}

.custom-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
}

.custom-checkbox-item:has(input:checked) {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-color: var(--primary);
}

[data-theme="dark"] .custom-checkbox-item:has(input:checked) {
    background: color-mix(in srgb, var(--primary) 24%, transparent);
}

.custom-checkbox-item:hover {
    background: #f1f5f9;
}

[data-theme="dark"] .custom-checkbox-item:hover {
    background: #263348;
}

.custom-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.custom-price-impact {
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 600;
    margin-inline-start: auto;
    white-space: nowrap;
}

.custom-select {
    max-width: 400px;
}

.custom-number-input {
    max-width: 260px;
}

.custom-number-input .input-with-btn {
    align-items: center;
}

.custom-number-label {
    padding: 0 8px;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Total Box ── */

.custom-total {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 2px solid var(--primary);
}

.custom-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
}

.extras-head {
    color: var(--muted);
}

.custom-total-final {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 1.1rem;
    color: var(--primary);
}

/* ── Admin: Custom Option Block ── */

.custom-option-block {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafbfc;
}

[data-theme="dark"] .custom-option-block {
    background: #1a2332;
}

.opt-values-table {
    margin-bottom: 8px;
}

.opt-values-table td,
.opt-values-table th {
    padding: 6px 10px;
}

/* ── Cart Icon (header) ── */

.cart-link {
    position: relative;
    text-decoration: none;
    font-size: 1.4rem;
    color: var(--text);
    transition: transform 0.15s;
}

.cart-link:hover {
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Cart Page ── */

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item {
    display: flex;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.cart-item-image img,
.cart-item-ph {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #cbd5e1;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-item-name {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: 1.05rem;
}

.cart-item-name:hover {
    color: var(--primary);
}

.cart-item-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cart-option-tag {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 0.78rem;
    color: var(--muted);
}

[data-theme="dark"] .cart-option-tag {
    background: #1e293b;
}

.cart-item-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 4px 0;
}

.cart-custom-badge {
    display: inline-block;
    background: var(--warning, #d97706);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.cart-custom-lead {
    font-size: 0.8rem;
    color: var(--muted, #64748b);
}

.review-custom-badge {
    margin-left: 6px;
}

.review-lead-time {
    display: block;
    font-size: 0.78rem;
    color: var(--muted, #64748b);
    margin-top: 2px;
}

/* زمان تحویل تخمینی زیر نام محصول در صفحات سفارش */
.order-item-lead {
    font-size: 0.78rem;
    color: var(--warning, #d97706);
    margin-top: 2px;
}

.cart-price-breakdown {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--muted);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
}

.cart-qty-form {
    display: flex;
    align-items: center;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.cart-qty-btn:first-child {
    border-radius: 0 6px 6px 0;
}

.cart-qty-btn:last-child {
    border-radius: 6px 0 0 6px;
}

.cart-qty-input {
    width: 50px;
    height: 32px;
    border: 1px solid var(--border);
    border-left: none;
    border-right: none;
    text-align: center;
    font: inherit;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
    white-space: nowrap;
}

.cart-remove-form {
    margin-right: auto;
}

/* ── Cart Summary (sidebar) ── */

.cart-summary {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: sticky;
    top: 16px;
}

.cart-summary h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.cart-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
}

.cart-summary-name small {
    color: var(--muted);
    font-size: 0.7rem;
}

.cart-summary-price {
    white-space: nowrap;
    font-weight: 500;
}

.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 2px solid var(--primary);
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.cart-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-clear-form {
    margin-top: 12px;
}

/* ── Add to Cart on Product Page ── */

.add-to-cart-form {
    margin-top: 16px;
}

.product-buy .add-to-cart-form {
    margin-top: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.add-to-cart-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.add-to-cart-btn {
    flex: 1;
    font-size: 1.05rem;
}

.add-to-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-selector {
    display: flex;
    align-items: center;
}

.quantity-selector .cart-qty-btn:first-child {
    border-radius: 0 8px 8px 0;
}

.quantity-selector .cart-qty-btn:last-child {
    border-radius: 8px 0 0 8px;
}

.quantity-selector .cart-qty-input {
    width: 60px;
    height: 40px;
}

.required-mark {
    color: var(--danger);
}

/* ── Checkout Page ── */

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
}

.radio-item:hover {
    border-color: var(--primary);
}

.radio-active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.radio-item.disabled-item {
    opacity: 0.55;
    cursor: not-allowed;
}

.radio-item.disabled-item:hover {
    border-color: var(--border);
}

.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.radio-label {
    display: flex;
    flex-direction: column;
}

.radio-label small {
    color: var(--muted);
    font-size: 0.78rem;
}

/* ── Order Invoice / Success ── */

.order-success-message {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

[data-theme="dark"] .order-success-message {
    background: #064e3b;
    border-color: #065f46;
}

.order-success-message p {
    margin: 4px 0;
}

.info-table td:first-child {
    font-weight: 500;
    color: var(--muted);
    width: 140px;
    vertical-align: top;
}

.info-table td:last-child {
    font-weight: 500;
}

.item-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .cart-layout,
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        flex-direction: column;
    }

    .cart-item-image img {
        width: 100%;
        height: auto;
        max-height: 180px;
    }

    .cart-item-actions {
        flex-wrap: wrap;
    }

    .add-to-cart-row {
        flex-direction: column;
    }

    .quantity-selector {
        width: 100%;
        justify-content: center;
    }
}

/* ── Clickable product card (overlay link) ── */

.product-card {
    position: relative;
}

.product-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-decoration: none !important;
    color: transparent !important;
}

.product-card-link:hover {
    color: transparent !important;
}

/* Add-to-cart button on card (sits above overlay link) */
.product-card-cart {
    position: relative;
    z-index: 2;
    margin-top: 10px;
}

.card-cart-btn {
    width: 100%;
    font-size: 0.85rem;
}

.card-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Checkout Stepper ── */

.checkout-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.checkout-stepper .step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

.checkout-stepper .step.active {
    color: var(--success);
    font-weight: 500;
}

.checkout-stepper .step.current {
    color: var(--primary);
    font-weight: 700;
}

.step-num {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.checkout-stepper .step.active .step-num {
    background: var(--success);
    color: #fff;
}

.checkout-stepper .step.current .step-num {
    background: var(--primary);
    color: #fff;
}

.step-sep {
    width: 28px;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .checkout-stepper { font-size: 0.7rem; }
    .step-sep { width: 12px; }
    .checkout-stepper .step { gap: 3px; }
    .step-num { width: 22px; height: 22px; font-size: 0.65rem; }
}

/* ── Checkout forms ── */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 500px) {
    .form-row { grid-template-columns: 1fr; }
}

.checkout-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.shipping-cost {
    display: block;
    margin-top: 4px;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
}

.checkout-guest-notice {
    background: #fffbeb;
    border-color: #fcd34d;
    font-size: 0.9rem;
}

[data-theme="dark"] .checkout-guest-notice {
    background: #3b2e00;
    border-color: #92400e;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.05rem;
}

/* ── Fix: keep old single-page checkout working ── */
/* (the old /checkout redirects to /checkout/shipping now) */

/* ── Products page: sidebar + main ── */

.products-page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.products-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 16px;
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.sidebar-card h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ── Category tree sidebar ── */

.cat-tree {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cat-tree-children {
    list-style: none;
    padding-right: 16px;
    border-right: 1px dashed var(--border);
    margin-right: 8px;
}

.cat-tree-link {
    display: block;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    /* dir="auto" جهت متن را تشخیص می‌دهد؛ تراز متن همیشه سمت راست می‌ماند */
    text-align: right;
}

.cat-tree-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.cat-tree-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* ── Restored classes (dropped during the last style.css rewrite) ── */

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.products-main {
    min-width: 0;
}

.quick-add-btn {
    cursor: pointer;
}

[data-theme="dark"] .theme-icon-light,
[data-theme="emerald"] .theme-icon-light,
[data-theme="indigo"] .theme-icon-light {
    display: none;
}

/* ── Filter sidebar ── */

.filter-group {
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 3px 0;
    cursor: pointer;
}

.filter-checkbox small {
    color: var(--muted);
    margin-right: auto;
}

.filter-select {
    width: 100%;
    font-size: 0.85rem;
}

/* ── Responsive ── */

@media (max-width: 900px) {
    .products-page-layout {
        grid-template-columns: 1fr;
    }
    .products-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-card {
        flex: 1 1 220px;
    }
}

/* ═══════════════════════════════════════════════════════════
   صفحه اصلی: دسته‌بندی در ستون راست (RTL) کنار محصولات
   ═══════════════════════════════════════════════════════════ */

.home-page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;  /* در RTL ستون اول (راست) = دسته‌بندی */
    gap: 24px;
    align-items: start;
}

.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 16px;
}

.home-main {
    min-width: 0;
}

/* دکمه باز/بسته دسته‌بندی — فقط موبایل، در دسکتاپ/تبلت مخفی */
.home-cats-toggle {
    display: none;
}

.cat-tree-empty {
    color: var(--muted);
    font-size: 0.85rem;
}

/* تبلت (768–900px): عرض مفید کم است — دسته‌بندی به بالای لیست منتقل می‌شود
   (همان رفتار صفحه محصولات در ≤900px: ردیف افقی) */
@media (min-width: 768px) and (max-width: 900px) {
    .home-page-layout {
        grid-template-columns: 1fr;
    }
    .home-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .home-sidebar .sidebar-card {
        flex: 1 1 220px;
    }
}

/* موبایل (<768px): دکمه باز/بسته‌شونده در بالای لیست — دسته‌بندی فضای محصولات را نمی‌گیرد */
@media (max-width: 767px) {
    .home-page-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .home-cats-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 12px 16px;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        color: var(--text);
        font-size: 0.92rem;
        font-weight: 600;
        cursor: pointer;
        text-align: right;
    }
    .home-cats-toggle .home-cats-caret {
        transition: transform 0.25s ease;
        color: var(--muted);
    }
    .home-cats-toggle.open .home-cats-caret {
        transform: rotate(180deg);
    }
    .home-sidebar {
        display: none;
        position: static;
        gap: 12px;
    }
    .home-sidebar.open {
        display: flex;
    }
    .home-sidebar .sidebar-card {
        flex: none;
    }
}

/* ── Tree separator in nav ── */

.tree-separator {
    margin: 8px 0;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.25);
}

/* ═══════════════════════════════════════════════════════════
   Sort Bar & Quick Filters
   ═══════════════════════════════════════════════════════════ */

.sort-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sort-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-form label {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
}

.sort-select {
    width: auto;
    min-width: 160px;
}

.sort-info {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

/* ═══════════════════════════════════════════════════════════
   Wishlist Button (small - on cards)
   ═══════════════════════════════════════════════════════════ */

.wishlist-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .wishlist-btn {
    background: rgba(30, 30, 30, 0.9);
}

.wishlist-btn:hover {
    transform: scale(1.15);
}

.wishlist-btn.active {
    background: rgba(220, 50, 50, 0.1);
}

.product-card {
    position: relative;
}

/* ═══════════════════════════════════════════════════════════
   Wishlist Button (large - on product detail page)
   ═══════════════════════════════════════════════════════════ */

.wishlist-btn-lg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card, #fff);
    border: 2px solid var(--border, #ddd);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.25s;
    margin: 12px 0;
    color: var(--text, #333);
}

[data-theme="dark"] .wishlist-btn-lg {
    background: var(--bg-card, #1a1a1a);
    border-color: var(--border, #333);
}

.wishlist-btn-lg:hover {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.wishlist-btn-lg.active {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.wishlist-icon-lg {
    font-size: 1.2em;
}

/* ═══════════════════════════════════════════════════════════
   Stock Notification
   ═══════════════════════════════════════════════════════════ */

.stock-notification-area {
    margin: 12px 0;
}

.btn-notify {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.btn-notify:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.btn-notify-done {
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
    cursor: default !important;
    transform: none !important;
    box-shadow: none !important;
}

.notify-message {
    margin-top: 8px;
    font-size: 0.9rem;
}

.notify-error {
    color: #dc3545;
}

.notify-hint {
    color: var(--text-muted, #888);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════
   Modal (for stock notification)
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalBackdropIn 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-color, #fff);
    border-radius: 12px;
    padding: 28px;
    max-width: 440px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.25s ease;
}

/* حالت بسته‌شدن: انیمیشن معکوس (خروج نرم) */
.modal-overlay.closing {
    animation: modalBackdropOut 0.2s ease forwards;
}

.modal-overlay.closing .modal-content,
.modal-overlay.closing .modal-box {
    animation: modalOut 0.2s ease forwards;
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card, #1a1a1a);
}

.modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted, #888);
}

.modal-close:hover {
    color: var(--text, #333);
}

.modal-content h3 {
    margin: 0 0 12px;
}

.modal-content .form-group {
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════
   Cart Toast (افزودن به سبد خرید)
   ═══════════════════════════════════════════════════════════ */

.cart-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-140%);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 1200;
    max-width: min(92vw, 480px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.cart-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
    animation: cartToastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cart-toast-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-toast-icon {
    font-size: 1.2rem;
}

.cart-toast-msg {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
}

.cart-toast-action {
    margin-top: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

[data-theme="dark"] .cart-toast {
    background: var(--card-bg);
    border-color: var(--border);
}

/* ═══════════════════════════════════════════════════════════
   Quick-Add Modal (مدال افزودن سریع از کارت محصول)
   ═══════════════════════════════════════════════════════════ */

.quick-add-modal {
    text-align: center;
    max-width: 380px;
}

.quick-add-image,
.quick-add-image-ph {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: #cbd5e1;
    background: #f1f5f9;
    object-fit: cover;
}

[data-theme="dark"] .quick-add-image-ph {
    background: #263348;
}

.quick-add-modal h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.quick-add-modal .product-price {
    margin-top: 0;
}

.quick-add-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 14px 0;
}

.quick-add-label {
    font-size: 0.9rem;
    color: var(--muted);
}

.quick-add-submit {
    margin-top: 4px;
    border: none;
    cursor: pointer;
    font: inherit;
}

.quick-add-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   Wishlist Card in Panel
   ═══════════════════════════════════════════════════════════ */

.btn-remove-wishlist {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-remove-wishlist:hover {
    background: #dc3545;
    color: #fff;
}

.wishlist-added-date {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state .empty {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════
   Admin Tabs
   ═══════════════════════════════════════════════════════════ */

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-tabs .btn-active {
    background: var(--primary, #3b82f6);
    color: #fff;
    border-color: var(--primary, #3b82f6);
}

/* ═══════════════════════════════════════════════════════════
   Breadcrumb (مسیر راهنما)
   ═══════════════════════════════════════════════════════════ */

.breadcrumb {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border, #e9ecef);
    overflow-x: auto;
    white-space: nowrap;
}

[data-theme="dark"] .breadcrumb {
    background: var(--bg-card, #1a1a1a);
    border-color: var(--border, #333);
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--primary, #3b82f6);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
    color: var(--primary-hover, #2563eb);
}

.breadcrumb-item.active span {
    color: var(--text, #333);
    font-weight: 500;
}

[data-theme="dark"] .breadcrumb-item.active span {
    color: var(--text, #e0e0e0);
}

.breadcrumb-sep {
    display: inline-flex;
    align-items: center;
    margin: 0 6px;
    color: var(--text-muted, #aaa);
    font-size: 0.8rem;
    user-select: none;
}

@media (max-width: 600px) {
    .breadcrumb {
        padding: 8px 10px;
    }
    .breadcrumb-item {
        font-size: 0.78rem;
    }
    .breadcrumb-sep {
        margin: 0 4px;
    }
}

/* ═══════════════════════════════════════════════════════════
   Theme Customizer (Admin)
   ═══════════════════════════════════════════════════════════ */

.theme-customizer {
    max-width: 900px;
}

.customizer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.customizer-header h1 {
    margin: 0;
}

.customizer-actions-top {
    display: flex;
    gap: 8px;
}

.customizer-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border, #e5e7eb);
    padding-bottom: 0;
}

.customizer-tab {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--muted, #6b7280);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.customizer-tab:hover {
    color: var(--text, #1f2937);
}

.customizer-tab.active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
}

.customizer-panel {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

[data-theme="dark"] .customizer-panel {
    background: var(--card-bg, #1e293b);
    border-color: var(--border, #334155);
}

.panel-section h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}

.section-desc {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.color-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.color-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker {
    width: 44px;
    height: 36px;
    border: 2px solid var(--border, #ddd);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: transparent;
}

.color-preview {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.code-editor {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    direction: ltr;
    text-align: left;
    tab-size: 2;
    white-space: pre;
    resize: vertical;
}

.customizer-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border, #e5e7eb);
}

.btn-ghost.btn-danger {
    color: var(--danger, #dc2626);
    border-color: var(--danger, #dc2626);
}

.btn-ghost.btn-danger:hover {
    background: var(--danger, #dc2626);
    color: #fff;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary, #2563eb);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    margin-inline-start: 6px;
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
}

.logo-preview {
    display: block;
    max-height: 48px;
    margin-top: 8px;
    border-radius: 6px;
    border: 1px solid var(--border, #e5e7eb);
}

/* ── Announcement Bar (فروشگاه) ── */

.announcement-bar {
    background: var(--primary, #2563eb);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .customizer-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .color-grid {
        grid-template-columns: 1fr;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
   انیمیشن‌های عمومی UI (Keyframes + Spinner + Fade)
   ═══════════════════════════════════════════════════════════ */

/* ورود مدال: Fade & Scale */
@keyframes modalBackdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* خروج مدال: معکوس */
@keyframes modalBackdropOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes modalOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}

/* ورود منوی تم */
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ورود Toast از بالا (SlideInDown) */
@keyframes cartToastIn {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-30px); }
    60%  { transform: translateX(-50%) translateY(6px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* چرخش اسپینر */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* فید ورود محتوا هنگام لود صفحه */
@keyframes pageFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

main {
    animation: pageFadeIn 0.45s ease;
}

/* ── کارت‌های فشرده محصول در موبایل ── */
@media (max-width: 767px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        padding: 10px;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
    }

    /* تصویر مربع (1:1) و کوتاه‌تر */
    .product-card .product-image,
    .product-card .product-image-ph {
        aspect-ratio: 1 / 1;
        width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 8px;
        margin-bottom: 8px;
    }

    .product-card-head {
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 3;
    }

    .product-card .discount-badge,
    .product-card .new-badge {
        font-size: 0.65rem;
        padding: 2px 7px;
    }

    /* عنوان: کوچک، حداکثر ۲ سطر */
    .product-card h3 {
        font-size: 0.8rem;
        line-height: 1.4;
        min-height: 2.24em;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 4px;
    }

    /* حذف بخش‌های غیرضروری در موبایل */
    .product-card .product-category,
    .product-card .price-dynamic-note {
        display: none;
    }

    .product-card .product-old-price {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .product-card .product-price {
        font-size: 0.85rem;
        font-weight: 800;
        margin-bottom: 8px;
    }

    /* دکمه سبد: فشرده */
    .product-card .product-card-cart {
        margin-top: auto;
    }

    .product-card .card-cart-btn {
        font-size: 0.72rem;
        padding: 7px 6px;
        border-radius: 8px;
    }

    /* دکمه علاقه‌مندی: کوچک و گوشه کارت */
    .product-card .wishlist-btn {
        top: 12px;
        left: 12px;
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
}

/* ── عناصر مخصوص موبایل: به‌صورت پیش‌فرض مخفی (در دسکتاپ هیچ اثری ندارند) ── */
.mobile-filter-trigger-bar,
.filter-backdrop,
.mobile-drawer-close,
.review-item-thumb {
    display: none;
}

/* ==========================================
   MOBILE FILTER DRAWER (ONLY FOR < 768px)
   ========================================== */
@media screen and (max-width: 767px) {

    /* ۱. سایدبار فیلتر در موبایل به کشوی جانبی تبدیل می‌شود (خارج از صفحه، با .active وارد می‌شود) */
    .products-sidebar {
        position: fixed;
        top: 0;
        right: -100%; /* مخفی خارج از صفحه */
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background-color: var(--card-bg, #ffffff);
        z-index: 1050;
        overflow-y: auto;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.15);
        padding: 20px 15px;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    /* کارت‌های داخل کشو: اندازه عادی (جلوگیری از flex-wrap تبلت) */
    .products-sidebar .sidebar-card {
        flex: none;
    }

    /* ۲. کلاس فعال شدن کشو */
    .products-sidebar.active {
        right: 0 !important;
    }

    /* دکمه بستن کشو (فقط موبایل) */
    .mobile-drawer-close {
        display: block;
        position: absolute;
        top: 10px;
        left: 10px;
        width: 32px;
        height: 32px;
        border: none;
        border-radius: 8px;
        background: var(--bg, #f1f5f9);
        color: var(--text, #0f172a);
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
        z-index: 2;
    }

    /* ۳. لایه تاریک پشت کشو (Backdrop) */
    .filter-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 1040;
        display: none;
    }
    .filter-backdrop.active {
        display: block !important;
    }

    /* ۴. نوار دکمه فیلتر مخصوص موبایل در بالای لیست محصولات */
    .mobile-filter-trigger-bar {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }

    .mobile-sort-form {
        display: flex;
        align-items: center;
        flex: 1;
        margin-right: 8px;
    }
    .mobile-sort-form .mobile-sort-select {
        width: 100%;
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    /* نشانگر تعداد فیلترهای فعال روی دکمه */
    .filter-count-badge {
        display: inline-block;
        min-width: 20px;
        padding: 2px 6px;
        border-radius: 10px;
        background: #ef4444;
        color: #fff;
        font-size: 0.72rem;
        font-weight: 700;
        text-align: center;
        margin-right: 4px;
    }

    /* مخفی‌سازی نوار مرتب‌سازی دسکتاپ (جایگزین: سلکتور فشرده نوار موبایل) */
    .sort-bar {
        display: none;
    }

    /* قفل اسکرول صفحه هنگام باز بودن کشو */
    body.filter-drawer-locked {
        overflow: hidden;
    }
}

/* ==========================================
   DESKTOP OVERRIDE (ENSURE 100% UNTOUCHED)
   ========================================== */
@media screen and (min-width: 768px) {
    /* سایدبار: در دسکتاپ هرگز حالت کشو نمی‌گیرد */
    .products-sidebar {
        right: auto !important;
        width: auto !important;
        height: auto !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    .products-sidebar.active {
        right: auto !important;
    }
    .mobile-filter-trigger-bar,
    .filter-backdrop,
    .mobile-drawer-close {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   CHECKOUT REVIEW — MOBILE OPTIMIZATION (ONLY FOR < 768px)
   ═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 767px) {

    /* ── ۱) جدول اقلام سفارش → کارت‌های فشرده ── */
    .checkout-form .items-table thead {
        display: none;
    }
    .checkout-form .items-table tbody,
    .checkout-form .items-table tfoot {
        display: block;
    }
    .checkout-form .items-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--card-bg);
        padding: 12px;
        margin-bottom: 12px;
    }
    .checkout-form .items-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 5px 0;
        border: none;
        font-size: 0.85rem;
    }
    .checkout-form .items-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.78rem;
        flex-shrink: 0;
    }

    /* سلول محصول: تمام‌عرض در بالای کارت (تصویر + نام) */
    .checkout-form .items-table tbody td.item-product-cell {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 10px;
        padding-bottom: 10px;
        margin-bottom: 8px;
        border-bottom: 1px dashed var(--border);
    }
    .checkout-form .items-table tbody td.item-product-cell::before {
        content: none;
    }
    .review-item-thumb {
        display: inline-flex;
        flex-shrink: 0;
        width: 52px;
        height: 52px;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid var(--border);
        background: var(--bg);
    }
    .review-item-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .review-item-thumb-ph {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        font-size: 1.3rem;
    }
    .review-item-name {
        font-weight: 700;
        font-size: 0.88rem;
        line-height: 1.45;
    }

    /* جمع هر آیتم: پررنگ و شاخص */
    .checkout-form .items-table tbody td.item-total-cell {
        font-weight: 800;
        color: var(--primary);
    }
    .checkout-form .items-table tbody td.item-total-cell::before {
        color: var(--muted);
        font-weight: 400;
    }

    /* سطرهای جمع فاکتور */
    .checkout-form .items-table tfoot tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 7px 2px;
        border: none;
        font-size: 0.88rem;
    }
    .checkout-form .items-table tfoot tr th {
        display: block;
        border: none;
        padding: 0;
    }
    .checkout-form .items-table tfoot tr th:first-child {
        font-weight: 500;
        color: var(--muted);
    }
    .checkout-form .items-table tfoot tr th:last-child {
        font-weight: 700;
        white-space: nowrap;
    }
    .checkout-form .items-table tfoot tr.summary-total-row {
        border-top: 2px solid var(--primary);
        margin-top: 4px;
        padding-top: 12px;
    }
    .checkout-form .items-table tfoot tr.summary-total-row th {
        font-size: 1.05rem;
        color: var(--primary);
        font-weight: 800;
    }

    /* ── ۲) باکس کوپن تخفیف: عمودی و لمسی ── */
    .coupon-form-row {
        flex-direction: column !important;
        align-items: stretch;
        gap: 8px !important;
    }
    .coupon-form-row .form-control {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
    }
    .coupon-form-row .btn {
        width: 100%;
        min-height: 44px;
    }

    /* ── ۳) خلاصه فاکتور و اطلاعات ارسال ── */
    .cart-summary {
        padding: 16px;
    }
    .cart-summary-row {
        align-items: flex-start;
    }
    .cart-summary-name {
        text-align: right;
    }
    .cart-summary-price {
        margin-right: auto;
        font-weight: 700;
    }
    .cart-summary-total {
        font-size: 1.1rem;
    }
    .cart-summary-total strong:last-child {
        font-size: 1.25rem;
        color: var(--primary);
    }

    /* جدول اطلاعات تحویل: سطرهای خوانا با جداکننده */
    .info-table tr {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 7px 0;
        border-bottom: 1px dashed var(--border);
    }
    .info-table tr:last-child {
        border-bottom: none;
    }
    .info-table td {
        display: block;
        border: none !important;
        padding: 0 !important;
    }
    .info-table td:first-child {
        width: auto;
        flex-shrink: 0;
        font-size: 0.8rem;
    }
    .info-table td:last-child {
        text-align: left;
        margin-right: auto;
    }

    /* ── ۴) دکمه نهایی: sticky و تمام‌عرض ── */
    .checkout-form > form:last-child {
        position: sticky;
        bottom: 0;
        z-index: 60;
        background: var(--bg);
        padding: 12px 0 8px;
    }
    .checkout-form > form:last-child .btn {
        width: 100%;
        font-size: 1.05rem;
        padding: 16px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    }
}

/* احترام به تنظیم کاهش حرکت کاربر */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   دسته‌بندی‌های ادمین — مرتب‌سازی drag & drop
   ═══════════════════════════════════════════════════════════ */
.cat-sortable-wrap {
    max-width: 100%;
}

ul.cat-sortable {
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.cat-sortable ul.cat-sortable {
    margin: 6px 26px 0 0; /* تورفتگی زیرمجموعه‌ها (RTL) */
}

.cat-item {
    margin-bottom: 6px;
}

.cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.drag-handle {
    cursor: grab;
    color: var(--muted, #6b7280);
    font-size: 1.2rem;
    line-height: 1;
    user-select: none;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.cat-idx {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
    min-width: 28px;
    text-align: center;
}

.cat-name {
    flex: 1;
    font-weight: 600;
    color: var(--text, #1f2937);
}

.cat-slug {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
}

.cat-count {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
    white-space: nowrap;
}

.cat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.cat-sortable .sortable-ghost {
    opacity: 0.4;
}

.cat-sortable .sortable-chosen {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* ═══════════════════════════════════════════════════════════
   صفحه‌بندی (pagination)
   ═══════════════════════════════════════════════════════════ */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
    padding: 14px 0;
    border-top: 1px solid var(--border, #e5e7eb);
}

.per-page-form {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted, #6b7280);
}

.per-page-select {
    width: auto;
    min-width: 76px;
    padding: 6px 10px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--card-bg, #fff);
    color: var(--text, #1f2937);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.page-link:hover {
    border-color: var(--primary, #2563eb);
    color: var(--primary, #2563eb);
}

.page-link.active {
    background: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
    color: #fff;
    cursor: default;
}

.page-link.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   ویجت شناور چت (واتساپ / تلگرام)
   ═══════════════════════════════════════════════════════════ */
.chat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chat-widget-left  { left: 24px; }
.chat-widget-right { right: 24px; }

.chat-bubble {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--primary, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, background 0.15s ease;
    user-select: none;
}

.chat-bubble:hover {
    transform: scale(1.08);
    background: var(--primary-dark, #1d4ed8);
}

.chat-menu {
    display: none;
    flex-direction: column;
    min-width: 190px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: chatMenuIn 0.15s ease;
}

@keyframes chatMenuIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-menu-header {
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    color: var(--text, #1f2937);
}

.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text, #1f2937);
    font-weight: 600;
    transition: background 0.12s ease;
}

.chat-menu-item:hover {
    background: var(--color-background, #f9fafb);
}

.chat-menu-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.chat-menu-label {
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════
   سایدبار دسکتاپ (≥901px): اسکرول مستقل — رفع باگ «تأخیر اسکرول»
   ─────────────────────────────────────────────────────────────
   قبلاً وقتی محتوای سایدبار بلندتر از ارتفاع صفحه بود، کاربر اول
   به انتهای کل صفحه می‌رسید و بعد سایدبار جابه‌جا می‌شد. حالا سایدبار
   چسبان (sticky) می‌ماند و محتوایش در همان لحظه به‌صورت مستقل
   اسکرول می‌شود.
   موبایل/تبلت (≤900px: کشوی فیلتر و چیدمان wrap) دست‌نخورده می‌مانند.
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 901px) {
    .products-sidebar,
    .home-sidebar {
        max-height: calc(100vh - 32px);
        overflow-y: auto !important;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .products-sidebar::-webkit-scrollbar,
    .home-sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .products-sidebar::-webkit-scrollbar-thumb,
    .home-sidebar::-webkit-scrollbar-thumb {
        background: var(--border, #e5e7eb);
        border-radius: 3px;
    }
}

/* ═══════════════════════════════════════════════════════════
   سایدبار پنل‌ها (ادمین و کاربری) در دسکتاپ (≥901px):
   همان رفع «تأخیر اسکرول» + مخفی‌سازی بصری اسکرول‌بار
   ─────────────────────────────────────────────────────────────
   سایدبار چسبان می‌ماند و محتوایش مستقل اسکرول می‌شود؛ نوار اسکرول
   به‌صورت بصری دیده نمی‌شود ولی اسکرول (چرخ/درگ/صفحه‌نما) کاملاً
   کار می‌کند. در موبایل/تبلت (≤900px) کشوی سایدبار دست‌نخورده می‌ماند.
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 901px) {
    .panel-sidebar {
        max-height: calc(100vh - 32px);
        overflow-y: auto !important;
        overscroll-behavior: contain;
        /* مخفی‌سازی اسکرول‌بار — کراس‌براوزر */
        scrollbar-width: none;        /* Firefox */
        -ms-overflow-style: none;     /* Edge قدیمی / IE */
    }

    .panel-sidebar::-webkit-scrollbar {
        display: none;                /* Chrome / Safari / Edge */
    }
}

/* ═══════════════════════════════════════════════════════════
   گالری محصول (چند عکس + ویدیو) — صفحه محصول
   ═══════════════════════════════════════════════════════════ */

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-stage {
    position: relative;
    width: 100%;
    border-radius: var(--radius, 12px);
    overflow: hidden;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
}

.gallery-stage .gallery-main {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    display: block;
    margin: 0;
}

.gallery-stage video.gallery-main {
    max-height: 420px;
    background: #000;
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-thumb {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 2px solid var(--border, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--card-bg, #fff);
    transition: border-color 0.15s ease, transform 0.15s ease;
    position: relative;
    flex: none;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-thumb:hover {
    border-color: var(--primary, #2563eb);
    transform: translateY(-2px);
}

.gallery-thumb.active {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #2563eb) 25%, transparent);
}

.gallery-thumb-video span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
}

@media (max-width: 480px) {
    .gallery-thumb {
        width: 52px;
        height: 52px;
    }
    .gallery-stage .gallery-main {
        max-height: 300px;
    }
}

/* ═══════════════════════════════════════════════════════════
   مدیریت گالری در پنل ادمین (media-manager)
   ═══════════════════════════════════════════════════════════ */

.media-manager {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.media-item {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg, #fff);
    display: flex;
    flex-direction: column;
}

.media-item.is-main {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #2563eb) 30%, transparent);
}

.media-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb video {
    background: #000;
}

.media-embed-thumb {
    font-size: 2rem;
    line-height: 1;
    color: #fff;
}

.media-embed-url {
    position: absolute;
    bottom: 4px;
    right: 4px;
    left: 4px;
    font-size: 0.62rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    padding: 2px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: left;
}

.media-item.media-video .media-thumb {
    background: #1e293b;
}

.media-video-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    pointer-events: none;
}

.media-main-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.media-item:not(.is-main) .media-main-badge {
    display: none;
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
}

.media-actions .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* کد انبار (SKU) در صفحه محصول */
.product-sku {
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
    margin: 4px 0;
}

.product-sku span {
    color: var(--text, #1f2937);
    font-weight: 600;
    background: var(--bg, #f1f5f9);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    padding: 2px 8px;
    display: inline-block;
}

/* ═══════════ انتخابگر درختی دسته‌بندی (Explorer Modal) ═══════════ */

/* hidden باید بر display:flex مودال غلبه کند */
.modal-overlay[hidden] {
    display: none;
}

/* دکمهٔ ماشه (جایگزین dropdown) */
.cat-explorer-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: right;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.cat-explorer-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-explorer-trigger-caret {
    color: var(--muted);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.cat-explorer-box {
    max-width: 560px;
}

/* دستهٔ انتخاب‌شدهٔ فعلی (بالای پنجره) */
.cat-explorer-current {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 700;
    background: var(--table-header-bg, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* خرده‌نان مسیر (از ریشه تا سطح جاری) */
.cat-explorer-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 2px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.cat-crumb {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    padding: 3px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.cat-crumb:hover {
    color: var(--primary);
    background: var(--table-header-bg, #f8fafc);
}

.cat-crumb.current {
    color: var(--primary);
    font-weight: 700;
    cursor: default;
}

.cat-crumb-sep {
    color: var(--border);
    user-select: none;
}

/* فهرست سطح جاری */
.cat-explorer-list {
    max-height: 330px;
    overflow-y: auto;
    padding: 4px 2px;
}

.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    transition: background 0.15s ease;
}

.cat-row:hover {
    background: var(--table-header-bg, #f8fafc);
}

.cat-row.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.07);
}

.cat-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
}

.cat-folder {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.cat-check {
    color: var(--primary);
    font-weight: 900;
    flex-shrink: 0;
}

.cat-row-select {
    margin-top: 0;
    flex-shrink: 0;
}

.cat-empty {
    padding: 26px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ═══════ تراز راست برای متن‌های دارای جهت‌یابی خودکار (دوزبانه فارسی/انگلیسی) ═══════
   direction:auto فقط جهت/ترتیب کاراکترها را تشخیص می‌دهد؛ text-align:right
   موقعیت متن را ثابت در سمت راست نگه می‌دارد تا متن انگلیسی (نام محصول، دسته،
   آیتم منو و…) در سایدبار، منو، جدول، کارت یا فرم به سمت چپ نپرد.
   (استثنا: متن اسلایدر که به‌صورت عمدی وسط‌چین است.) */
[dir="auto"] {
    text-align: right;
}

.home-slide-content [dir="auto"] {
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════
   v2 — بازطراحی ظاهر + اجزای جدید (قوانین، کارت بانکی، بنرها، قیمت دلاری)
   گزینه‌های ظاهری از «سفارشی‌سازی تم» به شکل data-* روی <html> می‌آیند.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --secondary: #7c3aed;
    --hero-from: var(--primary);
    --hero-to: var(--secondary);
    --btn-radius: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, .08);
    --shadow-lg: 0 16px 36px rgba(15, 23, 42, .14);
    --img-bg: #ffffff;
}
[data-theme="dark"] {
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, .45);
    --img-bg: #f8fafc;
}

/* ── پس‌زمینه‌ی طرح‌دار ── */
html[data-bg-pattern="dots"] body {
    background-image: radial-gradient(color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 1px);
    background-size: 18px 18px;
}
html[data-bg-pattern="grid"] body {
    background-image:
        linear-gradient(color-mix(in srgb, var(--primary) 6%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--primary) 6%, transparent) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* ── دکمه‌ها ── */
.btn, .card-cart-btn, .search-box button { border-radius: var(--btn-radius); }
.btn:disabled, .btn.is-gated {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ── هدر و ناوبری ── */
html[data-header-shadow="1"] .site-header { box-shadow: var(--shadow-sm); position: relative; z-index: 20; }
.site-nav { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--secondary))); }
.site-nav a { transition: opacity .2s ease; }
.site-nav a:hover { opacity: 1; }

/* ── بنر معرفی (Hero) ── */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
    padding: 44px 32px;
    box-shadow: var(--shadow-md);
}
.hero::after {
    content: "";
    position: absolute;
    inset-inline-start: -60px;
    bottom: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    pointer-events: none;
}
.hero h1, .hero p { position: relative; z-index: 1; }
.hero h1 { font-size: 1.75rem; }
.hero p { opacity: .92; max-width: 640px; }
html[data-hero="soft"] .hero {
    background: color-mix(in srgb, var(--hero-from) 9%, var(--card-bg));
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--hero-from) 20%, var(--border));
    box-shadow: none;
}
html[data-hero="soft"] .hero h1 { color: var(--hero-from); }
html[data-hero="soft"] .hero::after { background: color-mix(in srgb, var(--hero-from) 8%, transparent); }
html[data-hero="circuit"] .hero {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23ffffff' stroke-opacity='.16' stroke-width='2'%3E%3Cpath d='M0 30h40l10 10h30M60 0v20l10 10v40M120 90H80l-10-10H40M20 120v-30l-10-10'/%3E%3Ccircle cx='80' cy='40' r='4'/%3E%3Ccircle cx='70' cy='70' r='4'/%3E%3Ccircle cx='40' cy='80' r='4'/%3E%3Ccircle cx='10' cy='80' r='4'/%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--hero-from), var(--hero-to));
}
html[data-hero="hidden"] .hero { display: none; }

/* ── عنوان بخش‌ها ── */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.section-head .section-title { margin-bottom: 0; flex: 1; }
.section-more {
    font-size: .88rem;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    transition: background .2s ease, color .2s ease;
}
.section-more:hover { background: var(--primary); color: #fff; }
.section-icon { margin-inline-end: 4px; }

html[data-section-title="bar"] .section-title {
    border-bottom: 0;
    padding: 0 12px 0 0;
    border-inline-start: 4px solid var(--primary);
    padding-inline-start: 12px;
    line-height: 1.5;
}
html[data-section-title="pill"] .section-title {
    border-bottom: 0;
    padding-bottom: 0;
    flex: 0 1 auto;
}
html[data-section-title="pill"] .section-head .section-title,
html[data-section-title="pill"] .products-section > .section-title {
    display: inline-block;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 999px;
}
html[data-section-title="plain"] .section-title { border-bottom: 0; padding-bottom: 0; }
.home-section-discount .section-title { --primary: var(--danger); }

/* ── شبکه‌ی محصولات ── */
@media (min-width: 1100px) {
    html[data-grid-cols]:not([data-grid-cols="auto"]) .products-grid {
        grid-template-columns: repeat(var(--grid-cols, 4), minmax(0, 1fr));
    }
}
.no-sidebar.home-page-layout { grid-template-columns: 1fr; }

/* ── کارت محصول ── */
.product-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.product-card .product-card-cart { margin-top: auto; padding-top: 10px; }
.product-card .product-image,
.product-card .product-image-ph {
    height: auto;
    aspect-ratio: 1 / 1;
    background: var(--img-bg);
    border-radius: calc(var(--radius) - 4px);
}
html[data-img-ratio="landscape"] .product-card .product-image,
html[data-img-ratio="landscape"] .product-card .product-image-ph { aspect-ratio: 4 / 3; }
html[data-img-ratio="portrait"] .product-card .product-image,
html[data-img-ratio="portrait"] .product-card .product-image-ph { aspect-ratio: 3 / 4; }
html[data-img-fit="contain"] .product-card .product-image { object-fit: contain; padding: 8px; }
.product-card .product-image { transition: transform .35s ease; }
.product-card:hover .product-image { transform: scale(1.04); }
.product-card h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
    line-height: 1.45;
}
.product-card .product-price { font-size: 1.08rem; }
.product-card .product-old-price { margin-top: 4px; }

html[data-card-style="shadow"] .product-card { border-color: transparent; box-shadow: var(--shadow-sm); }
html[data-card-style="shadow"] .product-card:hover { box-shadow: var(--shadow-lg); border-color: transparent; }
html[data-card-style="bordered"] .product-card:hover { box-shadow: none; transform: none; border-color: var(--primary); }
html[data-card-style="flat"] .product-card { border-color: transparent; background: transparent; box-shadow: none; padding: 8px; }
html[data-card-style="flat"] .product-card:hover { transform: none; box-shadow: none; }
html[data-card-style="elevated"] .product-card { border-color: transparent; box-shadow: var(--shadow-md); }
html[data-card-style="elevated"] .product-card:hover { transform: translateY(-6px); box-shadow: 0 22px 44px color-mix(in srgb, var(--primary) 22%, transparent); }

.discount-badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: .72rem; font-weight: 700; }

/* ── بنرهای صفحه اصلی ── */
.home-banners {
    display: grid;
    gap: 16px;
    margin: 0 0 32px;
}
.home-banners-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-banners-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-banner {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
    transition: transform .25s ease, box-shadow .25s ease;
}
a.home-banner:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.home-banner img { display: block; width: 100%; height: auto; }
@media (max-width: 700px) {
    .home-banners-2, .home-banners-3 { grid-template-columns: 1fr; }
}

/* ── فوتر ── */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    margin-bottom: 10px;
}
.footer-links a { color: var(--muted); text-decoration: none; font-size: .88rem; }
.footer-links a:hover { color: var(--primary); }

/* ── صفحه قوانین / حریم خصوصی ── */
.legal-page {
    max-width: 860px;
    margin: 0 auto 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px clamp(18px, 4vw, 44px);
    box-shadow: var(--shadow-sm);
}
.legal-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 18px; }
.legal-head h1 { font-size: 1.5rem; margin-bottom: 4px; }
.legal-meta { color: var(--muted); font-size: .85rem; }
.legal-meta a { color: var(--primary); }
.legal-body h2 {
    font-size: 1.12rem;
    margin: 26px 0 10px;
    padding-inline-start: 10px;
    border-inline-start: 3px solid var(--primary);
}
.legal-body h3 { font-size: 1rem; margin: 18px 0 8px; }
.legal-body p { margin-bottom: 12px; text-align: justify; }
.legal-body ul { margin: 0 0 14px; padding-inline-start: 22px; }
.legal-body li { margin-bottom: 7px; text-align: justify; }
.legal-editor { font-size: .92rem; line-height: 1.9; }

/* ── تیک قوانین و متن شرایط ارسال ── */
.terms-accept { display: flex; align-items: flex-start; gap: 8px; line-height: 1.8; font-size: .9rem; }
.terms-accept input { margin-top: 6px; flex-shrink: 0; width: 17px; height: 17px; accent-color: var(--primary); }
.terms-accept a { color: var(--primary); }
.checkout-gate { margin-top: 14px; }
.checkout-notice {
    display: flex;
    gap: 10px;
    background: color-mix(in srgb, var(--primary) 7%, var(--card-bg));
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: .86rem;
    line-height: 1.9;
}
.checkout-notice-icon { font-size: 1.3rem; line-height: 1.4; }
.checkout-gate .terms-accept { margin-bottom: 4px; }

/* ── کارت بانکی (کارت‌به‌کارت) ── */
.bank-cards { margin: 10px 0 4px; }
.bank-cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px;
}
.bank-cards-amount {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-bottom: 10px; font-size: .95rem;
}
.bank-cards-amount strong { color: var(--primary); font-size: 1.1rem; }
.bank-cards-note { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.bank-card {
    position: relative;
    aspect-ratio: 1.586 / 1;
    max-width: 400px;
    border-radius: 18px;
    padding: 20px 22px;
    color: #fff;
    background:
        radial-gradient(circle at 85% -10%, rgba(255, 255, 255, .28), transparent 45%),
        radial-gradient(circle at -10% 110%, rgba(255, 255, 255, .14), transparent 50%),
        linear-gradient(135deg, var(--bc-from, #1e3a8a), var(--bc-to, #2563eb));
    box-shadow: 0 14px 30px color-mix(in srgb, var(--bc-from, #1e3a8a) 40%, transparent);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    font-family: inherit;
}
.bank-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 9px);
    pointer-events: none;
}
.bank-card > * { position: relative; }
.bank-card-top { display: flex; justify-content: space-between; align-items: center; }
.bank-card-bank { font-weight: 700; font-size: 1.02rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.bank-card-chip {
    width: 44px; height: 33px; border-radius: 7px;
    background: linear-gradient(135deg, #f8e7a1, #d4a72c 55%, #f1d77a);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
    position: relative;
}
.bank-card-chip::after {
    content: ""; position: absolute; inset: 7px 10px;
    border: 1px solid rgba(0, 0, 0, .25); border-radius: 4px;
}
.bank-card-number {
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
    letter-spacing: .14em;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: 'IRANSans', ui-monospace, monospace;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    direction: ltr;
}
.bank-card-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.bank-card-bottom small { display: block; font-size: .7rem; opacity: .75; }
.bank-card-holder { font-weight: 700; font-size: .95rem; }
.bank-card-copy, .copy-btn {
    font: inherit;
    font-size: .78rem;
    cursor: pointer;
    border-radius: 999px;
    padding: 5px 12px;
    transition: background .2s ease, transform .1s ease;
}
.bank-card-copy {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .35);
    backdrop-filter: blur(4px);
}
.bank-card-copy:hover { background: rgba(255, 255, 255, .3); }
.copy-btn { background: var(--card-bg); color: var(--primary); border: 1px solid var(--border); }
.copy-btn:hover { border-color: var(--primary); }
.bank-card-copy:active, .copy-btn:active { transform: scale(.96); }
.bank-card-copy.copied, .copy-btn.copied { background: var(--success); color: #fff; border-color: var(--success); }
.bank-card-extra {
    display: flex; flex-direction: column; gap: 4px;
    font-size: .82rem; color: var(--muted);
    margin: -4px 4px 4px;
}
.bank-card-extra code { color: var(--text); font-size: .82rem; }
.receipt-pay-card { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
#receiptCards { margin: 4px 0 8px 28px; }
@media (max-width: 600px) { #receiptCards { margin-inline-start: 0; } }

/* ═══════════ پنل مدیریت ═══════════ */

.bank-admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) { .bank-admin-grid { grid-template-columns: 1fr; } }
.bank-preview-title { font-size: 1rem; margin-bottom: 10px; color: var(--muted); }
.bank-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-inline-end: 4px; }
.form-color { height: 42px; padding: 4px; cursor: pointer; }

/* پاک‌سازی داده‌ها */
.reset-groups { display: flex; flex-direction: column; gap: 8px; }
.reset-group {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}
.reset-group:has(input:checked) { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, transparent); }
.reset-group input { width: 18px; height: 18px; accent-color: var(--danger); flex-shrink: 0; }
.reset-group-body { flex: 1; display: flex; flex-direction: column; }
.reset-group-body small { color: var(--muted); }
.reset-group-count { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

/* چیدمان صفحه اصلی */
.section-order { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.section-order-item {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg);
}
.section-order-handle { color: var(--muted); cursor: default; }
.section-order-toggle { flex: 1; margin: 0; }
.section-order-limit { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.section-order-limit input { width: 80px; }
.section-order-moves { display: flex; gap: 4px; }
.section-order-moves .btn { margin-top: 0; }
.banner-admin-preview { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.banner-admin-list { display: flex; flex-direction: column; gap: 10px; }
.banner-admin-item {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg);
}
.banner-admin-item.is-off { opacity: .55; }
.banner-admin-item img { width: 180px; max-height: 70px; object-fit: cover; border-radius: 8px; }
.banner-admin-meta { flex: 1; display: flex; flex-direction: column; min-width: 160px; }
.banner-admin-meta small { color: var(--muted); }
.banner-admin-actions { display: flex; gap: 6px; align-items: center; }
.banner-admin-actions form { display: inline; }
.banner-admin-actions .btn { margin-top: 0; }

/* قیمت‌گذاری دلاری در فرم محصول */
.pricing-box {
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    background: color-mix(in srgb, var(--primary) 4%, var(--card-bg));
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 8px 0 18px;
}
.pricing-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.pricing-head h3 { margin: 0; font-size: 1.05rem; }
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.segmented label {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .86rem; color: var(--muted);
    transition: background .2s ease, color .2s ease;
}
.segmented label.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.pricing-rate { font-size: .88rem; margin: 10px 0 12px; color: var(--text); }
.pricing-rate small { color: var(--muted); }
.pricing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0 12px;
    align-items: start;
}
.pricing-swap { padding-top: 34px; color: var(--muted); font-size: 1.2rem; }
.price-words { color: var(--primary); font-weight: 600; }
.pricing-history {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    font-size: .85rem; padding: 10px 12px; border-radius: 10px;
    background: var(--card-bg); border: 1px dashed var(--border);
}
.pricing-mode-hint { margin: 10px 0 0; }
.rate-change { font-weight: 700; font-size: .8rem; padding: 1px 6px; border-radius: 6px; }
.rate-change.up { color: #b91c1c; background: rgba(220, 38, 38, .1); }
.rate-change.down { color: #15803d; background: rgba(22, 163, 74, .1); }
@media (max-width: 640px) {
    .pricing-grid { grid-template-columns: 1fr; }
    .pricing-swap { display: none; }
}

/* ═══════════ سفارشی‌سازی تم (پنل) — تنظیمات + پیش‌نمایش زنده ═══════════ */
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.tc-top h1 { font-size: 1.4rem; margin: 0; }
.tc-top-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tc-top-actions form { display: inline; }
.tc-top-actions .btn { margin-top: 0; }
.tc-layout {
    display: grid;
    grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.tc-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 0 70px;
    position: relative;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.tc-tabs {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 10px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--card-bg); z-index: 3;
}
.tc-tab {
    font: inherit; font-size: .82rem; cursor: pointer;
    border: 0; background: transparent; color: var(--muted);
    padding: 6px 10px; border-radius: 8px;
}
.tc-tab:hover { background: var(--bg); color: var(--text); }
.tc-tab.active { background: var(--primary); color: #fff; }
.tc-pane { padding: 6px 16px 10px; }
.tc-pane h2 { font-size: .95rem; margin: 16px 0 10px; color: var(--muted); font-weight: 700; }
.tc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.tc-color label { display: block; font-size: .8rem; margin-bottom: 4px; color: var(--text); }
.tc-color-row { display: flex; align-items: center; gap: 6px; }
.tc-color-picker { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--card-bg); cursor: pointer; flex-shrink: 0; }
.tc-color-picker[data-empty] { opacity: .45; }
.tc-color-text { font-size: .82rem; padding: 6px 8px; min-width: 0; }
.tc-clear { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .9rem; }
.tc-clear:hover { color: var(--danger); }
.tc-palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tc-palette {
    font: inherit; font-size: .8rem; cursor: pointer; text-align: start;
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
    border-radius: 10px; padding: 7px 9px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.tc-palette:hover, .tc-palette.active { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.tc-palette-swatch { display: flex; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.tc-palette-swatch i { width: 12px; height: 22px; display: block; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tc-chip span {
    display: inline-block; cursor: pointer; font-size: .8rem;
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--text);
    transition: all .15s ease;
}
.tc-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.tc-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.tc-range label { display: flex; justify-content: space-between; font-size: .85rem; }
.tc-range-out { color: var(--primary); font-weight: 700; direction: ltr; }
.tc-range input[type="range"] { width: 100%; accent-color: var(--primary); }
.tc-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 10px 0; font-size: .88rem; }
.tc-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tc-switch-ui { width: 40px; height: 22px; border-radius: 999px; background: var(--border); position: relative; transition: background .2s ease; flex-shrink: 0; }
.tc-switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start .2s ease; }
.tc-switch input:checked + .tc-switch-ui { background: var(--primary); }
.tc-switch input:checked + .tc-switch-ui::after { inset-inline-start: 21px; }
.tc-save {
    position: sticky; bottom: 0; z-index: 3;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: -70px;
    background: var(--card-bg); border-top: 1px solid var(--border);
}
.tc-save .btn { margin-top: 0; }
.tc-dirty { color: #d97706; font-size: .82rem; }
.tc-preview { position: sticky; top: 12px; }
.tc-preview-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tc-preview-bar select { max-width: 200px; padding: 6px 10px; }
.tc-preview-bar .btn { margin-top: 0; }
.tc-devices { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tc-devices button { border: 0; background: var(--card-bg); padding: 6px 10px; cursor: pointer; font-size: .9rem; }
.tc-devices button.active { background: var(--primary); }
.tc-frame-wrap {
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    background: repeating-conic-gradient(var(--bg) 0% 25%, var(--card-bg) 0% 50%) 50% / 20px 20px;
    height: calc(100vh - 170px); min-height: 520px;
    display: flex; justify-content: center;
}
.tc-frame-wrap iframe { flex-shrink: 0; border: 0; background: #fff; transform-origin: top center; }
.panel-layout:has(.tc) { max-width: 100%; }
@media (max-width: 1100px) {
    .tc-layout { grid-template-columns: 1fr; }
    .tc-panel { max-height: none; }
    .tc-preview { position: static; }
    .tc-frame-wrap { height: 70vh; }
}

/* ── متن معرفی دسته‌بندی (سئو) ── */
.category-intro {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 8px 0 32px;
    line-height: 2;
    color: var(--text);
}
.category-intro h2 { margin-top: 0; }

/* ── سوالات متداول ── */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 8px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; font-weight: 700; color: var(--primary); width: 16px; }
.faq-item[open] summary::before { content: "−"; }
.faq-item summary h2 { font-size: 1rem; margin: 0; border: 0; padding: 0; }
.faq-item p { padding: 0 16px 14px 40px; margin: 0; line-height: 2; color: var(--text); }

/* ── پنل سئو ── */
.seo-health { display: flex; flex-direction: column; gap: 14px; }
.seo-health-label { display: flex; justify-content: space-between; font-size: .9rem; }
.seo-health-label small { color: var(--muted); }
.seo-bar { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 4px 0; }
.seo-bar span { display: block; height: 100%; border-radius: 999px; }
.seo-bar .good { background: var(--success); }
.seo-bar .mid { background: #f59e0b; }
.seo-bar .bad { background: var(--danger); }
.seo-preview {
    display: flex; flex-direction: column; gap: 2px; max-width: 600px;
    padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg);
    font-family: Arial, Tahoma, sans-serif;
}
.seo-preview-url { font-size: .78rem; color: #188038; direction: ltr; text-align: right; }
.seo-preview-title { font-size: 1.1rem; color: #1a0dab; }
[data-theme="dark"] .seo-preview-title { color: #8ab4f8; }
.seo-preview-desc { font-size: .85rem; color: var(--muted); line-height: 1.7; }
.seo-links { padding-inline-start: 20px; line-height: 2.2; }
