﻿/* ==========================================================================
   Header Layout Custom Styling (با حفظ کامل متغیرهای Var.css)
   ========================================================================== */

html, body {
    margin: 0;
    padding: 0;
    direction: rtl;
    background-color: #ffffff;
}

.header {
    width: 100%;
    background-color: var(--primery-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.header__navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
}

/* --- بخش‌های اصلی چیدمان ۳ تایی هدر --- */

.header__right {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    flex: 1;
}

.navigation__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.header__left {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    flex: 1;
}

.logo {
    scale: 1.6;
    width: 4rem;
    height: auto;
    aspect-ratio: 6 / 5;
    object-fit: contain;
}

/* آیکون‌ها */
.icon {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    flex-shrink: 0;
}

.navigation__home--icon a {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

/* مخفی کردن پیش‌فرض دکمه منوی موبایل در لپ‌تاپ */
.header__bars--phone {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
}

/* اینپوت سرچ */
.center--aling {
    display: flex;
    align-items: center;
    gap: .5rem;
}

#search--inp {
    width: 20rem;
    height: 2.8rem;
    padding: 0 1rem;
    border: var(--border);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-family: inherit;
    outline: none;
}

    #search--inp:focus {
        box-shadow: var(--box-shadow);
        border: var(--heavy--border);
    }

/* دکمه‌های ورود و سبد خرید سمت چپ */
.navigation__login--icon,
.navigation__basket--icon {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background-color: var(--secendry-BackGround-color);
    border: var(--border);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: #000000;
    transition: var(--transition);
    white-space: nowrap;
}

    .navigation__login--icon:hover,
    .navigation__basket--icon:hover {
        box-shadow: var(--box-shadow);
        transform: translateY(-2px);
        color: var(--word--hover--color);
    }

.login--icon--span,
.basket--icon--span {
    font-size: 0.9rem;
    font-weight: bold;
    color: inherit;
}

/* عدد سبد خرید */
.basket--icon__circle {
    min-width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background-color: var(--word--hover--color);
    color: #fff;
    font-size: .75rem;
    padding: 0 .3rem;
}

.text-danger {
    color: #fa5252 !important;
}

/* ==========================================================================
   استایل‌های ساجسشن، پاپ‌آپ و دراور (Drawer)
   ========================================================================== */

/* ساجسشن جستجوی دسکتاپ */
.search-suggestions-container {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    min-width: 300px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    direction: rtl;
}

#search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-suggestion-link {
    display: flex;
    align-items: center;
    padding: 12px;
    text-decoration: none;
    color: #343a40;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease;
}

    .search-suggestion-link.is-active {
        background-color: var(--secendry-BackGround-color);
    }

    .search-suggestion-link:hover {
        background-color: #f8f9fa;
        color: #d97706;
    }

.search-suggestion-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-left: 12px;
    border: 1px solid #e9ecef;
}

.search-suggestion-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.search-suggestion-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.search-suggestion-price {
    font-size: 0.85rem;
    color: #495057;
}

.search-suggestion-empty {
    padding: 16px;
    text-align: center;
    color: #868e96;
    font-size: 0.9rem;
}

/* ==========================================================================
   تنظیمات منوی کشویی موبایل (Mobile Drawer)
   ========================================================================== */

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background-color: #ffffff;
    box-shadow: -4px 0 25px rgba(0,0,0,0.15);
    z-index: 2000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* جلوگیری از اسکرول خود باکس اصلی */
}

    .mobile-drawer.active {
        right: 0;
    }

.mobile-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 0.75rem;
    flex-shrink: 0;
}

.mobile-drawer__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.mobile-drawer__close {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    color: #495057;
    transition: color 0.2s ease;
}

    .mobile-drawer__close:hover {
        color: var(--word--hover--color, #f5a3be);
    }

/* بخش محتوای قابل اسکرول منو */
.mobile-drawer__content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.25rem;
}

/* لینک‌های اصلی بالای کشو */
.drawer-main-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

    .drawer-main-links li {
        border-bottom: 1px solid #f1f5f9;
    }

    .drawer-main-links a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem 0.5rem;
        color: #334155;
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }

        .drawer-main-links a:hover {
            color: var(--brand-DEFAULT, #d97706);
        }

.drawer-link-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #64748b;
}

/* پاپ‌آپ جستجوی موبایل */
.search-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .search-popup.active {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        visibility: visible;
    }

.search-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #333;
}

.search-popup__close {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.search-popup input {
    width: 100%;
    height: 3rem;
    padding: 0 1rem;
    border: var(--heavy--border);
    border-radius: var(--border-radius);
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

.mobile-suggestions-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Modern Footer Styling
   ========================================================================== */

.site-footer {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding-top: 4rem;
    margin-top: 4rem;
    color: #334155;
}

.footer__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 640px) {
    .footer__container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer__container {
        grid-template-columns: 2fr 1fr 1fr 1.5fr;
        gap: 3rem;
    }
}

.footer__about {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer__logo {
    width: 90px;
    height: auto;
    margin-bottom: 1rem;
}

.footer__desc {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #475569;
    margin-bottom: 1.5rem;
    text-align: justify;
}

.footer__socials {
    display: flex;
    gap: 1rem;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    color: #64748b;
    transition: all 0.3s ease;
}

    .social-icon:hover {
        background-color: var(--brand-color, #f5a3be);
        border-color: var(--brand-color, #d97706);
        color: #ffffff;
        transform: translateY(-3px);
        box-shadow: 0 4px 10px rgba(217, 119, 6, 0.2);
    }

    .social-icon svg {
        width: 20px;
        height: 20px;
    }

.footer__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

    .footer__title::after {
        content: '';
        position: absolute;
        right: 0;
        bottom: 0;
        width: 40px;
        height: 3px;
        background-color: var(--brand-color, #d97706);
        border-radius: 2px;
    }

.footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

    .footer__links a {
        color: #475569;
        text-decoration: none;
        font-size: 0.95rem;
        transition: color 0.2s ease, transform 0.2s ease;
        display: inline-block;
    }

        .footer__links a:hover {
            color: var(--brand-color, #f5a3be);
            transform: translateX(-5px);
        }

.trust-symbols {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.enamad-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .enamad-img:hover {
        transform: scale(1.05);
        box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    }

.footer__bottom {
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    background-color: #f1f5f9;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

    .footer__bottom p {
        margin: 0;
        font-size: 0.85rem;
        color: #64748b;
    }

    .footer__bottom strong {
        color: #0f172a;
    }

/* ==========================================================================
   کدهای ریسپانسیو موبایل و آکاردئونی کشو
   ========================================================================== */
@media screen and (max-width: 48rem) {
    .header__navigation {
        padding: 0.5rem;
    }

    .navigation__home--icon {
        display: none;
    }

    .logo {
        scale: 1.5;
        width: 3.5rem;
    }

    .navigation__login--icon,
    .navigation__basket--icon {
        background: none;
        border: none;
        padding: 0;
        gap: unset;
    }

    .login--icon--span,
    .basket--icon--span {
        display: none;
    }

    .nav-link.text-danger {
        font-size: 0.8rem;
    }

    .header__bars--phone {
        display: block !important;
    }

    #search--inp {
        display: none;
    }

    .navigation__search--icon {
        display: block;
        cursor: pointer;
    }

    .categorys {
        display: none !important;
    }

    /* ساختار درخت دسته‌بندی‌ها در کشوی موبایل */
    .mobile-drawer .category-tree,
    .category-tree-nav ul {
        display: flex !important;
        flex-direction: column !important;
        width: 100%;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .mobile-drawer .category-item,
    .mobile-drawer .category-tree-nav li {
        display: block !important;
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }

    .mobile-drawer .category-item-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100%;
    }

    .mobile-drawer .catgorys__product {
        display: flex;
        align-items: center;
        padding: 0.65rem 0.5rem;
        font-size: 0.95rem;
        color: #1e293b;
        text-decoration: none;
        flex-grow: 1;
        transition: color 0.2s ease;
    }

        .mobile-drawer .catgorys__product:hover {
            color: var(--brand-DEFAULT, #d97706);
        }

    /* دکمه فلش آکاردئونی */
    .mobile-drawer .submenu-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        color: #64748b;
    }

    .mobile-drawer .chevron-icon {
        width: 1.1rem;
        height: 1.1rem;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* چرخش فلش هنگام باز شدن هر آکاردئون */
    .mobile-drawer .category-item.is-open > .category-item-header .chevron-icon,
    .mobile-drawer li.is-open > .category-item-header .chevron-icon {
        transform: rotate(180deg);
    }

    /* مخفی کردن تمام زیرمنوها و ulهای فرزند به صورت پیش‌فرض */
    .mobile-drawer .category-submenu,
    .mobile-drawer .category-tree-nav ul ul,
    .mobile-drawer .submenu,
    .mobile-drawer .sub-menu {
        display: none !important;
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        border-right: 2px solid #cbd5e1 !important;
        margin-right: 0.6rem !important;
        padding: 0.2rem 0.6rem 0.2rem 0 !important;
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* نمایش زیرمنو فقط هنگام فعال بودن کلاس is-open */
    .mobile-drawer .category-item.is-open > .category-submenu,
    .mobile-drawer .category-item.is-open > ul,
    .mobile-drawer li.is-open > .category-submenu,
    .mobile-drawer li.is-open > ul,
    .mobile-drawer li.is-open > .submenu,
    .mobile-drawer li.is-open > .sub-menu {
        display: block !important;
    }
}
