/* ==========================================================================
   قالب نیک صفا (نسخهٔ ۱.۱) — فروشگاه موبایل، چیدمان تمیز و حرفه‌ای
   رنگ‌ها از پالت فعال می‌آیند؛ برای پالت شب استایل مخصوص دارد.
   ========================================================================== */

.theme-niksafa {
    --container: 1360px;
    --ns-line: var(--border);
    --ns-soft: color-mix(in srgb, var(--bg) 60%, var(--surface));
    --ns-hover: color-mix(in srgb, var(--primary) 8%, transparent);
    --ns-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    --ns-shadow-lg: 0 8px 24px rgba(0, 0, 0, .08);
    font-size: 14px;
    line-height: 1.75;
    background: var(--bg);
    color: var(--text);
}

.theme-niksafa img { max-width: 100%; }
.theme-niksafa h1, .theme-niksafa h2, .theme-niksafa h3, .theme-niksafa h4 { margin: 0; line-height: 1.6; font-weight: 800; }
.theme-niksafa a { color: var(--text); text-decoration: none; }
.theme-niksafa a:hover { color: var(--primary); }

/* ---------- نوار بالای سایت ---------- */
.ns-topbar { background: var(--ns-soft); border-bottom: 1px solid var(--ns-line); color: var(--muted); font-size: 11.5px; }
.ns-topbar-in { display: flex; align-items: center; gap: 18px; height: 32px; }
.ns-topbar-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-spacer { flex: 1; }
.ns-topbar-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.ns-topbar-link .icon { width: 14px; height: 14px; color: var(--primary); }
.ns-topbar-link:hover { color: var(--primary); }
.ns-topbar-sep { width: 1px; height: 14px; background: var(--ns-line); }

/* ---------- هدر ---------- */
.ns-header { position: sticky; top: 0; z-index: 40; background: var(--header-bg); border-bottom: 1px solid var(--ns-line); }
.ns-header-main { display: flex; align-items: center; gap: 24px; height: 72px; }
.ns-brand { display: flex; align-items: center; gap: 9px; flex: none; }
.ns-brand .ns-mark { width: 36px; height: 36px; border-radius: 9px; }
.ns-brand img:not(.ns-mark) { max-height: 46px; width: auto; }
.ns-brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.ns-brand-text b { font-size: 15.5px; font-weight: 800; color: var(--header-text); }
.ns-brand-text small { font-size: 10.5px; color: var(--muted); font-weight: 500; }

.ns-search { position: relative; display: flex; align-items: center; flex: 1; max-width: 620px; height: 42px;
    background: var(--ns-soft); border: 1px solid transparent; border-radius: 8px; transition: background .15s, border-color .15s; }
.ns-search:focus-within { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 45%, var(--ns-line)); }
.ns-search-cat { position: relative; display: flex; align-items: center; flex: none; height: 100%; border-inline-end: 1px solid var(--ns-line); }
.ns-search-cat select { appearance: none; border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--muted);
    height: 100%; max-width: 160px; padding: 0 14px 0 8px; cursor: pointer; width: auto; outline: none; }
.ns-search-cat::after { content: ""; width: 7px; height: 7px; border-inline-end: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg); margin-inline-start: -14px; margin-inline-end: 8px; pointer-events: none; }
.ns-search-q { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 13px;
    padding: 0 12px; color: var(--text); outline: none; }
.ns-search-q::placeholder { color: var(--muted); }
.ns-search button { flex: none; width: 42px; height: 100%; border: 0; background: none; color: var(--muted); cursor: pointer;
    display: grid; place-items: center; padding: 0; }
.ns-search button .icon { width: 19px; height: 19px; }
.ns-search button:hover { color: var(--primary); }

.ns-actions { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; flex: none; }
.ns-action { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px; border-radius: 8px;
    border: 1px solid var(--ns-line); background: var(--surface); color: var(--header-text); font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap; }
.ns-action:hover { background: var(--ns-hover); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, var(--ns-line)); }
.ns-action .icon { width: 19px; height: 19px; }
.ns-action .count { position: absolute; top: -5px; inset-inline-start: -5px; min-width: 17px; height: 17px; border-radius: 99px;
    background: var(--primary); color: var(--primary-text); font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.ns-action-label { display: inline-block; }
.theme-niksafa .menu-toggle { display: none; }

/* ---------- منو ---------- */
.ns-nav-wrap { background: var(--surface); border-bottom: 1px solid var(--ns-line); }
.ns-nav-row { display: flex; align-items: center; height: 44px; gap: 8px; }
.ns-nav { display: flex; align-items: stretch; height: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ns-nav::-webkit-scrollbar { display: none; }
.ns-nav a { display: flex; align-items: center; padding: 0 12px; font-size: 12.5px; font-weight: 600; color: var(--header-text);
    border-bottom: 2px solid transparent; white-space: nowrap; }
.ns-nav a:hover { color: var(--primary); }
.ns-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.ns-nav-extra { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--muted); }
.ns-nav-extra .icon { width: 16px; height: 16px; color: var(--primary); }
.ns-nav-extra b { color: var(--header-text); font-weight: 700; }

/* ---------- ناحیهٔ بنر ---------- */
.ns-hero-zone { display: grid; grid-template-columns: minmax(0, 1fr) 322px; gap: 12px; margin-top: 16px; }
.ns-hero-main { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center;
    min-height: 340px; border: 1px solid var(--ns-line); border-radius: var(--radius); overflow: hidden;
    background:
        radial-gradient(120% 120% at 88% 12%, color-mix(in srgb, var(--primary) 14%, var(--surface)) 0%, transparent 58%),
        linear-gradient(120deg, color-mix(in srgb, var(--primary) 5%, var(--surface)), var(--surface)); }
.ns-hero-copy { padding: 36px 36px 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ns-hero-eyebrow { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.ns-hero-copy h1 { font-size: clamp(19px, 2vw, 25px); font-weight: 800; line-height: 1.65; color: var(--text); max-width: 24em; }
.ns-hero-copy p { margin: 0; font-size: 12.5px; line-height: 1.9; color: var(--muted); max-width: 34em; }
.ns-hero-points { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 4px; padding: 0; list-style: none;
    font-size: 11.5px; color: var(--muted); }
.ns-hero-points li { display: inline-flex; align-items: center; gap: 5px; }
.ns-hero-points .icon { width: 14px; height: 14px; color: var(--primary); }
.ns-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 22px;
    border-radius: 8px; border: 1px solid transparent; font: inherit; font-size: 12.5px; font-weight: 700;
    background: var(--primary); color: var(--primary-text) !important; cursor: pointer; }
.ns-btn:hover { filter: brightness(1.06); }
.ns-btn .icon { width: 16px; height: 16px; }
.ns-hero-showcase { position: relative; height: 100%; min-height: 260px; display: grid; place-items: center; padding: 26px; }
.ns-hero-showcase img { max-height: 264px; width: auto; max-width: 100%; object-fit: contain;
    filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .12)); }
.ns-hero-price { position: absolute; inset-inline-start: 22px; bottom: 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--ns-line); border-radius: 8px; padding: 6px 12px; font-size: 11.5px; color: var(--muted); }
.ns-hero-price b { color: var(--text); font-size: 12.5px; }

.ns-hero-side { display: grid; grid-template-rows: 1fr 1fr; gap: 12px; }
.ns-side-card { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 12px;
    padding: 12px; background: var(--surface); border: 1px solid var(--ns-line); border-radius: var(--radius);
    overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.ns-side-card:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--ns-line)); box-shadow: var(--ns-shadow); }
.ns-side-thumb { width: 100%; aspect-ratio: 1; border-radius: 6px; background: var(--ns-soft); display: grid; place-items: center; padding: 6px; }
.ns-side-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ns-side-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ns-side-kicker { font-size: 10px; color: var(--muted); font-weight: 600; }
.ns-side-title { font-size: 12px; font-weight: 700; line-height: 1.8; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ns-side-price { font-size: 12px; font-weight: 800; color: var(--primary); }

/* ---------- نوار خدمات ---------- */
.ns-usp { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px; background: var(--surface);
    border: 1px solid var(--ns-line); border-radius: var(--radius); overflow: hidden; }
.ns-usp-item { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.ns-usp-item + .ns-usp-item { border-inline-start: 1px solid var(--ns-line); }
.ns-usp-icon { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); }
.ns-usp-icon .icon { width: 19px; height: 19px; }
.ns-usp-text { min-width: 0; }
.ns-usp-text b { display: block; font-size: 12px; font-weight: 700; color: var(--text); }
.ns-usp-text small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.7; }

/* ---------- بخش‌ها ---------- */
.ns-section { margin-top: 24px; }
.ns-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ns-section-head h2 { font-size: 17px; font-weight: 800; color: var(--text); }
.ns-section-head small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.ns-section-head .ns-more { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: var(--muted); }
.ns-more .icon { width: 14px; height: 14px; }
.ns-section-head .ns-more:hover { color: var(--primary); }

/* ---------- دسته‌بندی‌ها ---------- */
.ns-cats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.ns-cat { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 8px 12px;
    background: var(--surface); border: 1px solid var(--ns-line); border-radius: var(--radius); text-align: center;
    transition: border-color .15s, box-shadow .15s, transform .15s; }
.ns-cat:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--ns-line)); box-shadow: var(--ns-shadow); transform: translateY(-1px); }
.ns-cat-img { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
    background: var(--ns-soft); }
.ns-cat-img img { width: 100%; height: 100%; object-fit: cover; }
.ns-cat-fallback { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.ns-cat b { font-size: 11.5px; font-weight: 700; color: var(--text); line-height: 1.5; }
.ns-cat small { font-size: 10.5px; color: var(--muted); }

/* ---------- کارت محصول ---------- */
.ns-products .products { --cols: 5; }
.ns-card { position: relative; background: var(--surface); border: 1px solid var(--ns-line); border-radius: var(--radius);
    padding: 12px; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.ns-card:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--ns-line)); box-shadow: var(--ns-shadow); transform: none; }
.ns-card .thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
    background: var(--surface); padding: 4px; }
.ns-card .thumb img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.ns-card:hover .thumb img { transform: scale(1.03); }
.ns-quick { position: absolute; inset-inline: 6px; bottom: 6px; text-align: center; padding: 6px 0; border-radius: 6px;
    background: color-mix(in srgb, var(--text) 82%, transparent); color: #fff; font-size: 11px; font-weight: 600;
    opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.ns-card:hover .ns-quick { opacity: 1; transform: none; }
.ns-card .ribbon { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2; background: var(--sale); color: #fff;
    font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 2px 6px; }
.ns-card .body { display: flex; flex-direction: column; gap: 4px; padding: 8px 2px 0; flex: 1; text-align: right; }
.ns-card-cat { font-size: 10.5px; color: var(--muted) !important; font-weight: 500; }
.ns-card .title { font-size: 12.5px; font-weight: 600; line-height: 1.9; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.6em; }
.ns-card .title:hover { color: var(--primary); }
.ns-card .foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--ns-line); display: flex;
    align-items: center; justify-content: space-between; gap: 8px; }
.ns-card .price { font-size: 13px; font-weight: 800; color: var(--text); }
.ns-card .price .cur { font-size: 10px; font-weight: 500; color: var(--muted); margin-inline-start: 2px; }
.ns-card .price del { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.ns-card .add { width: 30px; height: 30px; padding: 0; border-radius: 50%; flex: none; background: transparent;
    border: 1px solid var(--ns-line); color: var(--primary); display: grid; place-items: center; }
.ns-card .add .icon { width: 15px; height: 15px; }
.ns-card .add:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.ns-card .out { font-size: 11.5px; color: var(--sale); font-weight: 700; }

/* ---------- فوتر ---------- */
.site-footer.ns-footer { margin-top: 36px; padding-top: 30px; background: var(--footer-bg); border-top: 1px solid var(--ns-line); }
.ns-footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.1fr; gap: 28px; padding-bottom: 24px; }
.ns-footer h4 { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.ns-footer ul { list-style: none; margin: 0; padding: 0; }
.ns-footer li { padding: 3px 0; font-size: 11.5px; }
.ns-footer a { color: var(--footer-text); }
.ns-footer a:hover { color: var(--primary); }
.ns-footer-brand { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ns-footer-brand b { font-size: 15px; font-weight: 800; color: var(--text); }
.ns-footer-about p { color: var(--footer-text); font-size: 11.5px; line-height: 2; max-width: 32em; margin: 0; }
.ns-social { gap: 7px; margin-top: 12px; }
.ns-social a { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px;
    border: 1px solid var(--ns-line); color: var(--footer-text); }
.ns-social a:hover { background: var(--ns-hover); border-color: color-mix(in srgb, var(--primary) 35%, var(--ns-line)); color: var(--primary); }
.ns-social .icon { width: 16px; height: 16px; }
.ns-contact li { display: flex; align-items: flex-start; gap: 8px; color: var(--footer-text); }
.ns-contact .icon { width: 15px; height: 15px; color: var(--primary); margin-top: 3px; flex: none; }
.ns-footer-bottom { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px;
    border-top: 1px solid var(--ns-line); }
.theme-niksafa .copyright { border: 0; margin: 0; padding: 0; text-align: start; font-size: 11px; opacity: 1;
    color: var(--footer-text); margin-inline-start: auto; }
.theme-niksafa .badges img { max-height: 58px; }

/* ---------- اصلاح پایه‌های مشترک ---------- */
.theme-niksafa .btn { border-radius: 8px; }
.theme-niksafa .btn.accent, .theme-niksafa .btn-accent { background: var(--accent); color: #1b1b1b; }
.theme-niksafa .page { padding-top: 22px; }
.theme-niksafa .breadcrumb { font-size: 11.5px; margin-bottom: 14px; }
.theme-niksafa .card { box-shadow: none; }
.theme-niksafa .shop-layout { grid-template-columns: 240px 1fr; gap: 20px; }
.theme-niksafa .sidebar .card { border-radius: 8px; }
.theme-niksafa .pager a, .theme-niksafa .pager span { border-radius: 8px; min-width: 36px; height: 36px; font-size: 12px; }
.theme-niksafa .product-card { border-radius: 8px; }
.theme-niksafa .tab, .theme-niksafa .tabs a { font-size: 12.5px; }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 1200px) {
    .ns-hero-zone { grid-template-columns: minmax(0, 1fr) 290px; }
    .ns-products .products { --cols: 4; }
    .ns-cats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .ns-nav-extra { display: none; }
}
@media (max-width: 1024px) {
    .ns-hero-zone { grid-template-columns: 1fr; }
    .ns-hero-main { min-height: 300px; }
    .ns-hero-showcase img { max-height: 220px; }
    .ns-hero-side { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
    .ns-usp { grid-template-columns: 1fr 1fr; }
    .ns-usp-item:nth-child(3) { border-inline-start: 0; }
    .ns-usp-item:nth-child(n+3) { border-top: 1px solid var(--ns-line); }
    .ns-footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .ns-topbar-in { height: 30px; gap: 12px; }
    .ns-header-main { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
    .ns-brand-text small { display: none; }
    .ns-search { order: 3; flex-basis: 100%; max-width: none; height: 40px; }
    .ns-search-cat { display: none; }
    .ns-action { height: 38px; padding: 0 9px; }
    .ns-action-label { display: none; }
    .theme-niksafa .menu-toggle { display: inline-flex; }
    .ns-nav-wrap { display: none; }
    .ns-nav-wrap.open { display: block; }
    .ns-nav { flex-direction: column; height: auto; padding: 6px 0; }
    .ns-nav a { padding: 9px 16px; border-bottom: 0; border-inline-end: 2px solid transparent; }
    .ns-nav a.active { border-inline-end-color: var(--primary); }
    .ns-hero-main { grid-template-columns: 1fr; min-height: 0; }
    .ns-hero-copy { padding: 20px 18px 6px; gap: 8px; }
    .ns-hero-copy h1 { font-size: 18px; }
    .ns-hero-showcase { min-height: 180px; padding: 0 18px 18px; }
    .ns-hero-showcase img { max-height: 180px; }
    .ns-hero-price { inset-inline-start: 18px; bottom: 14px; }
    .ns-hero-side { grid-template-columns: 1fr; }
    .ns-usp { grid-template-columns: 1fr; }
    .ns-usp-item + .ns-usp-item { border-inline-start: 0; border-top: 1px solid var(--ns-line); }
    .ns-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ns-products .products { --cols: 2; gap: 10px; }
    .ns-card { padding: 8px; }
    .ns-card .title { font-size: 12px; }
    .ns-section-head h2 { font-size: 15px; }
    .ns-footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .ns-footer-bottom { flex-direction: column; align-items: flex-start; }
    .theme-niksafa .copyright { margin-inline-start: 0; }
}

/* ---------- پالت شب ---------- */
body[data-palette="night"] .ns-hero-main {
    background: radial-gradient(120% 120% at 88% 12%, color-mix(in srgb, var(--primary) 16%, var(--surface)) 0%, transparent 55%),
                linear-gradient(120deg, color-mix(in srgb, var(--primary) 6%, var(--surface)), var(--surface)); }
body[data-palette="night"] .ns-hero-showcase img { filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5)); }
body[data-palette="night"] .ns-search { background: #1d2129; }
body[data-palette="night"] .ns-search:focus-within { background: #22262f; }
body[data-palette="night"] .ns-topbar-link { color: var(--muted); }
body[data-palette="night"] .site-footer .badges img { background: #fff; }

/* ---------- پالت مشکی: فوتر تیره ---------- */
body[data-palette="black"] .ns-footer,
body[data-palette="black"] .ns-footer-about p,
body[data-palette="black"] .ns-contact li,
body[data-palette="black"] .ns-footer a { color: var(--footer-text); }
body[data-palette="black"] .ns-footer h4,
body[data-palette="black"] .ns-footer-brand b { color: #fff; }
body[data-palette="black"] .ns-footer-bottom { border-top-color: rgba(255, 255, 255, .12); }
