/**
 * هیمونا — استایل پایه، هدر و فوتر
 * طراحی با الهام از فروشگاه‌های بزرگ ایرانی
 */

/* ===== توکن‌های طراحی ===== */
:root {
        /* رنگ اصلی — سرمه‌ای برند هیمونا (هماهنگ با لوگو) */
        --hm-primary: #144566;
        --hm-primary-dark: #0d3450;
        --hm-primary-soft: #e9f0f6;

        /* رنگ پیشنهاد ویژه / تخفیف */
        --hm-deal: #ee4d2d;
        --hm-deal-dark: #d13d20;
        --hm-deal-soft: #fdeee9;

        --hm-secondary: #1a9fb4;
        --hm-success: #00a049;
        --hm-warning: #f7d100;

        --hm-text: #23262b;
        --hm-text-2: #63666e;
        --hm-text-3: #9b9ea6;

        --hm-bg: #f6f7f8;
        --hm-surface: #ffffff;
        --hm-border: #ebedf0;
        --hm-border-2: #dfe2e6;

        --hm-radius: 12px;
        --hm-radius-sm: 8px;
        --hm-radius-lg: 16px;

        /* دکمه اصلی پرداخت — گرادیان سرمه‌ای به فیروزه‌ای */
        --hm-cta: linear-gradient(135deg, #0d3450 0%, #144566 48%, #1a9fb4 135%);
        --hm-cta-hover: linear-gradient(135deg, #0d3450 0%, #17557e 48%, #23b1c8 135%);
        --hm-cta-shadow: 0 6px 18px rgba(20, 69, 102, 0.28);
        --hm-cta-shadow-hover: 0 10px 26px rgba(20, 69, 102, 0.4);

        --hm-shadow: 0 2px 16px rgba(35, 38, 43, 0.06);
        --hm-shadow-lg: 0 8px 32px rgba(35, 38, 43, 0.12);

        --hm-font: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;

        --hm-header-h: 68px;
        --hm-nav-h: 48px;

        /* در RTL این مقادیر معکوس عمل می‌کنند */
        --hm-start: right;
        --hm-end: left;
}

/* ===== ریست پایه ===== */
*,
*::before,
*::after {
        box-sizing: border-box;
}

html {
        -webkit-text-size-adjust: 100%;
        scroll-behavior: smooth;
}

body {
        margin: 0;
        font-family: var(--hm-font);
        font-size: 14px;
        line-height: 1.8;
        color: var(--hm-text);
        background: var(--hm-bg);
        direction: rtl;
        text-align: right;
        -webkit-font-smoothing: antialiased;
}

img {
        max-width: 100%;
        height: auto;
        display: block;
}

a {
        color: inherit;
        text-decoration: none;
        transition: color 0.15s ease;
}

a:hover {
        color: var(--hm-primary);
}

h1, h2, h3, h4, h5, h6 {
        margin: 0 0 0.6em;
        font-weight: 700;
        line-height: 1.5;
        color: var(--hm-text);
}

p {
        margin: 0 0 1em;
}

ul, ol {
        margin: 0;
        padding: 0;
        list-style: none;
}

ins, del {
        text-decoration: none;
}

button {
        font-family: inherit;
        cursor: pointer;
        border: 0;
        background: none;
        padding: 0;
        color: inherit;
}

input, textarea, select {
        font-family: inherit;
        font-size: inherit;
}

hr {
        border: 0;
        border-top: 1px solid var(--hm-border);
        margin: 2em 0;
}

.screen-reader-text {
        border: 0;
        clip: rect(1px, 1px, 1px, 1px);
        clip-path: inset(50%);
        height: 1px;
        width: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        word-wrap: normal !important;
}

.hm-skip-link:focus {
        clip: auto;
        clip-path: none;
        height: auto;
        width: auto;
        position: fixed;
        top: 8px;
        right: 8px;
        z-index: 100000;
        background: var(--hm-primary);
        color: #fff;
        padding: 10px 20px;
        border-radius: var(--hm-radius-sm);
}

:focus-visible {
        outline: 2px solid var(--hm-secondary);
        outline-offset: 2px;
}

/* ===== چیدمان ===== */
.hm-container {
        max-width: 1320px;
        margin-inline: auto;
        padding-inline: 16px;
}

.hm-site-main {
        min-height: 55vh;
}

/* ===== آیکون ===== */
.hm-icon {
        flex-shrink: 0;
        display: inline-block;
        vertical-align: middle;
}

/* ===== دکمه‌ها ===== */
.hm-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        height: 44px;
        padding-inline: 18px;
        border-radius: var(--hm-radius-sm);
        font-size: 14px;
        font-weight: 500;
        white-space: nowrap;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.hm-btn--primary:hover {
        background: var(--hm-primary-dark);
        color: #fff;
        box-shadow: 0 4px 14px rgba(20, 69, 102, 0.35);
}

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

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

.hm-btn--account {
        background: var(--hm-bg);
        border: 1px solid var(--hm-border);
        color: var(--hm-text);
        height: 44px;
}

.hm-btn--account:hover {
        border-color: var(--hm-primary);
        color: var(--hm-primary);
        background: var(--hm-primary-soft);
}

.hm-icon-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--hm-radius-sm);
        color: var(--hm-text);
        transition: background 0.15s ease, color 0.15s ease;
}

.hm-icon-btn:hover {
        background: var(--hm-bg);
        color: var(--hm-primary);
}

/* ===== هدر ===== */
.hm-header {
        position: sticky;
        top: 0;
        z-index: 900;
        background: var(--hm-surface);
        border-bottom: 1px solid var(--hm-border);
        transition: box-shadow 0.2s ease;
}

.hm-header.is-scrolled {
        box-shadow: var(--hm-shadow);
}

/* هنگام اسکرول، نوار ناوبری جمع می‌شود */
.hm-header.is-scrolled .hm-header__nav {
        display: none;
}

.hm-header__top {
        display: flex;
        align-items: center;
        gap: 20px;
        height: var(--hm-header-h);
}

.hm-header__brand {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
}

.hm-logo a {
        display: inline-flex;
        align-items: center;
}

.hm-logo img {
        max-height: 52px;
        width: auto;
}

.hm-logo--footer img {
        max-height: 120px;
}

/* لوگوی پیش‌فرض باندل‌شده قالب */
.hm-logo__img {
        display: block;
        height: 52px;
        width: auto;
}

.hm-logo--footer .hm-logo__img {
        height: 108px;
}

/* جستجو */
.hm-header__search {
        flex: 1;
        max-width: 560px;
        margin-inline: auto;
}

.hm-search {
        position: relative;
}

.hm-search__input {
        width: 100%;
        height: 48px;
        border: 1px solid transparent;
        background: var(--hm-bg);
        border-radius: 10px;
        padding-inline: 44px 16px;
        font-size: 13px;
        color: var(--hm-text);
        transition: background 0.15s ease, border-color 0.15s ease;
}

.hm-search__input::placeholder {
        color: var(--hm-text-3);
}

.hm-search__input:focus {
        outline: none;
        background: var(--hm-surface);
        border-color: var(--hm-primary);
}

.hm-search__btn {
        position: absolute;
        top: 4px;
        inset-inline-start: 4px;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        color: var(--hm-text-3);
}

.hm-search__btn:hover {
        color: var(--hm-primary);
}

/* ===== جستجوی زنده — پنل دسته‌بندی‌ها + پیشنهاد محصولات ===== */
.hm-live {
        position: relative;
}

.hm-ls {
        position: absolute;
        top: calc(100% + 10px);
        inset-inline: 0;
        z-index: 970;
        background: var(--hm-surface);
        border: 1px solid var(--hm-border);
        border-radius: var(--hm-radius);
        box-shadow: var(--hm-shadow-lg);
        overflow: hidden;
        max-height: min(480px, 72vh);
        overflow-y: auto;
        animation: hm-ls-in 0.16s ease;
}

@keyframes hm-ls-in {
        from {
                opacity: 0;
                transform: translateY(6px);
        }
        to {
                opacity: 1;
                transform: translateY(0);
        }
}

.hm-ls__grid {
        display: grid;
        grid-template-columns: 210px minmax(0, 1fr);
        direction: rtl;
}

/* ستون دسته‌بندی‌ها (سمت راست) */
.hm-ls__cats {
        border-inline-end: 1px solid var(--hm-border);
        background: #fafbfc;
        padding: 8px;
}

.hm-ls__title {
        font-size: 11px;
        font-weight: 700;
        color: var(--hm-text-3);
        padding: 6px 10px;
        letter-spacing: 0.02em;
}

.hm-ls__cat {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 9px 10px;
        border-radius: 8px;
        font-size: 12.5px;
        color: var(--hm-text);
        transition: background 0.12s ease, color 0.12s ease;
}

.hm-ls__cat:hover {
        background: var(--hm-primary-soft);
        color: var(--hm-primary);
}

.hm-ls__cat-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
}

.hm-ls__cat-count {
        flex-shrink: 0;
        font-size: 10.5px;
        color: var(--hm-text-3);
        background: var(--hm-bg);
        border: 1px solid var(--hm-border);
        border-radius: 20px;
        padding: 1px 8px;
}

/* ستون محصولات (سمت چپ) */
.hm-ls__prods {
        padding: 8px;
}

.hm-ls__prod {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 7px 10px;
        border-radius: 10px;
        transition: background 0.12s ease;
}

.hm-ls__prod:hover {
        background: var(--hm-bg);
}

.hm-ls__prod-img {
        width: 56px;
        height: 56px;
        border-radius: 10px;
        object-fit: cover;
        flex-shrink: 0;
        border: 1px solid var(--hm-border);
}

.hm-ls__prod-img--empty {
        display: inline-block;
        background: var(--hm-bg);
}

.hm-ls__prod-body {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
}

.hm-ls__prod-name {
        font-size: 12.5px;
        color: var(--hm-text);
        line-height: 1.7;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
}

.hm-ls__prod-price {
        font-size: 12px;
        display: flex;
        align-items: baseline;
        gap: 6px;
}

.hm-ls__prod-price del {
        color: var(--hm-text-3);
        font-size: 10.5px;
}

.hm-ls__prod-price ins {
        color: var(--hm-text);
        font-weight: 700;
}

/* حالت خالی */
.hm-ls__empty {
        padding: 26px 16px;
        text-align: center;
        font-size: 12.5px;
        color: var(--hm-text-3);
}

/* لینک جستجوی کامل (پاورقی) */
.hm-ls__all {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        border-top: 1px solid var(--hm-border);
        font-size: 12.5px;
        font-weight: 700;
        color: var(--hm-primary);
        background: #fafbfc;
        transition: background 0.12s ease;
}

.hm-ls__all:hover {
        background: var(--hm-primary-soft);
}

/* نشانگر کیبورد */
.hm-ls a.is-cursor {
        background: var(--hm-primary-soft);
        color: var(--hm-primary);
}

/* موبایل: تک‌ستونه + دسته‌ها به‌صورت چیپ افقی */
@media (max-width: 640px) {
        .hm-ls {
                max-height: 64vh;
        }

        .hm-ls__grid {
                grid-template-columns: 1fr;
        }

        .hm-ls__cats {
                display: flex;
                align-items: center;
                gap: 6px;
                overflow-x: auto;
                border-inline-end: 0;
                border-bottom: 1px solid var(--hm-border);
                padding: 10px;
                scrollbar-width: none;
        }

        .hm-ls__cats::-webkit-scrollbar {
                display: none;
        }

        .hm-ls__title {
                display: none;
        }

        .hm-ls__cat {
                flex: 0 0 auto;
                background: var(--hm-bg);
                border: 1px solid var(--hm-border);
                border-radius: 20px;
                padding: 6px 12px;
                font-size: 12px;
        }

        .hm-ls__cat-count {
                display: none;
        }
}

/* اکشن‌های هدر */
.hm-header__actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
}

.hm-cart__count {
        position: absolute;
        top: 2px;
        inset-inline-end: 0;
        min-width: 18px;
        height: 18px;
        padding-inline: 4px;
        background: var(--hm-primary);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 18px;
        text-align: center;
        border-radius: 9px;
}

/* نوار ناوبری */
.hm-header__nav {
        border-top: 1px solid var(--hm-border);
}

.hm-header__nav-inner {
        display: flex;
        align-items: center;
        gap: 24px;
        height: var(--hm-nav-h);
}

.hm-cats {
        position: relative;
}

.hm-cats__toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        height: var(--hm-nav-h);
        font-size: 13px;
        font-weight: 500;
        color: var(--hm-text);
}

.hm-cats__toggle .hm-icon--chevron {
        color: var(--hm-text-3);
        transition: transform 0.2s ease;
}

.hm-cats__toggle:hover {
        color: var(--hm-primary);
}

.hm-cats.is-open .hm-cats__toggle .hm-icon--chevron {
        transform: rotate(180deg);
}

.hm-cats__panel {
        position: absolute;
        top: 100%;
        inset-inline-start: 0;
        z-index: 950;
        min-width: 270px;
        background: var(--hm-surface);
        border: 1px solid var(--hm-border);
        border-radius: var(--hm-radius);
        box-shadow: var(--hm-shadow-lg);
        padding: 10px 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.hm-cats.is-open .hm-cats__panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
}

.hm-cats__list > li {
        position: relative;
}

.hm-cats__link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 9px 18px;
        font-size: 13px;
        color: var(--hm-text);
}

.hm-cats__link::after {
        content: '';
        width: 5px;
        height: 5px;
        background: var(--hm-text-3);
        border-radius: 50%;
        opacity: 0;
        margin-inline-start: auto;
}

.hm-cats__list > li:hover > .hm-cats__link {
        background: var(--hm-bg);
        color: var(--hm-primary);
}

/* پنل زیرشاخه‌ها */
.hm-cats__sub {
        position: absolute;
        top: -11px;
        right: 100%;
        z-index: 1;
        width: min(560px, 70vw);
        background: var(--hm-surface);
        border: 1px solid var(--hm-border);
        border-radius: var(--hm-radius);
        box-shadow: var(--hm-shadow-lg);
        padding: 18px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px 14px;
        opacity: 0;
        visibility: hidden;
        transform: translateX(8px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.hm-cats__list > li:hover > .hm-cats__sub {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
}

.hm-cats__sub a {
        font-size: 12.5px;
        color: var(--hm-text-2);
        padding: 5px 8px;
        border-radius: 6px;
}

.hm-cats__sub a:hover {
        color: var(--hm-primary);
        background: var(--hm-bg);
}

.hm-cats__all {
        grid-column: 1 / -1;
        font-weight: 700;
        color: var(--hm-primary) !important;
        border-bottom: 1px solid var(--hm-border);
        border-radius: 0 !important;
        margin-bottom: 6px;
}

.hm-cats__empty-note {
        padding: 14px 18px;
        font-size: 12px;
        color: var(--hm-text-3);
        max-width: 300px;
}

/* منوی اصلی */
.hm-menu {
        display: flex;
        align-items: center;
        gap: 22px;
}

.hm-menu > li {
        position: relative;
}

.hm-menu > li > a {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 13px;
        font-weight: 500;
        color: var(--hm-text-2);
        padding-block: 6px;
}

.hm-menu > li > a:hover {
        color: var(--hm-primary);
}

/* زیرمنو */
.hm-menu .sub-menu {
        position: absolute;
        top: 100%;
        inset-inline-start: 0;
        z-index: 940;
        min-width: 210px;
        background: var(--hm-surface);
        border: 1px solid var(--hm-border);
        border-radius: var(--hm-radius);
        box-shadow: var(--hm-shadow-lg);
        padding: 8px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.hm-menu li:hover > .sub-menu,
.hm-menu li:focus-within > .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
}

.hm-menu .sub-menu a {
        display: block;
        padding: 7px 12px;
        font-size: 12.5px;
        color: var(--hm-text-2);
        border-radius: 6px;
}

.hm-menu .sub-menu a:hover {
        background: var(--hm-bg);
        color: var(--hm-primary);
}

/* قفل اسکرول صفحه (شیت موبایل) */
body.hm-no-scroll {
        overflow: hidden;
}

/* ===== فوتر ===== */
.hm-footer {
        background: var(--hm-surface);
        border-top: 1px solid var(--hm-border);
        margin-top: 48px;
}

/* نوار خدمات */
.hm-footer__services {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
        padding-block: 26px;
        border-bottom: 1px solid var(--hm-border);
}

.hm-service {
        display: flex;
        align-items: center;
        gap: 12px;
}

.hm-service .hm-icon {
        width: 58px;
        height: 58px;
        padding: 12px;
        border-radius: 50%;
        color: var(--hm-primary);
        background: var(--hm-primary-soft);
}

.hm-service:nth-child(2) .hm-icon {
        color: var(--hm-secondary);
        background: #e4f8fa;
}

.hm-service:nth-child(3) .hm-icon {
        color: var(--hm-success);
        background: #e6f6ee;
}

.hm-service:nth-child(4) .hm-icon {
        color: #f5a623;
        background: #fdf3e3;
}

.hm-service span {
        font-size: 12.5px;
        font-weight: 500;
        color: var(--hm-text-2);
}

/* بدنه فوتر */
.hm-footer__main {
        display: grid;
        grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
        gap: 34px;
        padding-block: 34px;
}

.hm-footer__heading {
        font-size: 14px;
        font-weight: 700;
        margin-bottom: 14px;
}

.hm-footer__desc {
        font-size: 12.5px;
        color: var(--hm-text-2);
        line-height: 2;
        margin-bottom: 18px;
}

.hm-footer__social {
        display: flex;
        gap: 10px;
}

.hm-footer__social a {
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--hm-bg);
        border: 1px solid var(--hm-border);
        color: var(--hm-text-2);
}

.hm-footer__social a:hover {
        background: var(--hm-primary);
        border-color: var(--hm-primary);
        color: #fff;
}

.hm-footer__links li + li {
        margin-top: 10px;
}

.hm-footer__links a {
        font-size: 12.5px;
        color: var(--hm-text-2);
}

.hm-footer__links a:hover {
        color: var(--hm-primary);
}

.hm-footer__newsletter p {
        font-size: 12px;
        color: var(--hm-text-2);
        margin-bottom: 12px;
}

.hm-newsletter {
        display: flex;
        gap: 8px;
}

.hm-newsletter input {
        flex: 1;
        height: 44px;
        border: 1px solid var(--hm-border-2);
        border-radius: var(--hm-radius-sm);
        padding-inline: 14px;
        font-size: 12.5px;
        background: var(--hm-bg);
}

.hm-newsletter input:focus {
        outline: none;
        border-color: var(--hm-primary);
        background: var(--hm-surface);
}

.hm-newsletter .hm-btn {
        height: 44px;
        padding-inline: 22px;
}

.hm-footer__trust {
        display: flex;
        gap: 10px;
        margin-top: 18px;
}

.hm-trust-badge {
        width: 74px;
        height: 74px;
        border: 1px solid var(--hm-border);
        border-radius: var(--hm-radius-sm);
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 9.5px;
        color: var(--hm-text-3);
        padding: 6px;
        background: var(--hm-bg);
}

/* نوار پایانی */
.hm-footer__bottom {
        border-top: 1px solid var(--hm-border);
        padding-block: 16px;
}

.hm-footer__bottom-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
}

.hm-footer__copy {
        font-size: 12px;
        color: var(--hm-text-3);
}

.hm-footer__site {
        font-size: 12px;
        font-weight: 700;
        color: var(--hm-text-2);
        direction: ltr;
}

/* ===== دکمه بازگشت به بالا ===== */
.hm-backtop {
        position: fixed;
        bottom: 24px;
        left: 24px;
        z-index: 800;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--hm-surface);
        border: 1px solid var(--hm-border);
        box-shadow: var(--hm-shadow-lg);
        color: var(--hm-text-2);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.hm-backtop.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
}

.hm-backtop:hover {
        color: var(--hm-primary);
        border-color: var(--hm-primary);
}
