/* ========================================
   هدر
======================================== */

.header-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 82px;
    direction: ltr;
}

.header-search {
    grid-column: 1;
    justify-self: start;
}

.site-logo {
    grid-column: 2;
    font-size: 31px;
    font-weight: 700;
    white-space: nowrap;
}

    .site-logo,
    .site-logo:visited,
    .site-logo:hover {
        color: var(--text-black) !important;
        text-decoration: none !important;
    }

.header-user-actions {
    display: flex;
    grid-column: 3;
    justify-self: end;
    align-items: center;
    gap: 27px;
    direction: rtl;
}

.header-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    text-decoration: none;
}

    .header-icon,
    .header-icon:visited {
        color: var(--text-black) !important;
    }

        .header-icon svg {
            width: 100%;
            height: 100%;
            fill: none;
            stroke: currentColor;
            stroke-width: 1.6;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .header-icon:hover {
            color: var(--brand-green) !important;
            transform: translateY(-1px);
        }

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid var(--white);
    border-radius: 20px;
    background-color: var(--brand-green);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
}


/* این ابزارها فقط در موبایل دیده می‌شوند. */
.mobile-menu-toggle,
.mobile-header-actions {
    display: none;
}

/* دو ستون هم‌اندازه، لوگو را دقیقاً در مرکز نگه می‌دارند. */
@media (max-width: 768px) {
    .header-main {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        min-height: 68px;
        column-gap: 4px;
    }

    .header-main > .header-search,
    .header-main > .header-user-actions {
        display: none;
    }

    .header-main > .site-logo {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        font-size: clamp(20px, 5.2vw, 24px);
        line-height: 1.6;
        direction: rtl;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 44px;
        min-height: 44px;
        padding: 6px 2px;
        border: 0;
        border-radius: 4px;
        background: transparent;
        color: var(--text-black);
        font: inherit;
        font-size: 14px;
        font-weight: 500;
        direction: rtl;
        cursor: pointer;
    }

    .mobile-menu-toggle svg {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
    }

    .mobile-header-actions {
        display: flex;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        align-items: center;
        direction: ltr;
        gap: 0;
    }

    .mobile-header-actions .header-icon {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .mobile-header-actions .header-icon svg {
        width: 23px;
        height: 23px;
    }

    .mobile-header-actions .cart-count {
        top: 0;
        right: 0;
    }

    .mobile-menu-toggle:focus-visible,
    .mobile-header-actions a:focus-visible {
        outline: 2px solid var(--green-dark);
        outline-offset: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-icon:hover {
        transform: none;
    }
}
