@import url('../components/logo.css');

/* از متغیرهای main.css استفاده می‌کنیم:
   --color-black, --color-cream, --color-taupe, --color-rosegold
*/
:root {
    --tw-header-height: 84px;
}

/* ───────── سکشن بالایی (فقط این بخش بک‌گراند عکس دارد) ───────── */
.tw-top {
    height: var(--tw-header-height);
    position: relative;
    z-index: 1;
    background-image: url('../../images/header-background/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    padding: 0 .5rem;
}

.tw-top::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, .6);
    z-index: 0;
}

.tw-top .container {
    position: relative;
    z-index: 1;
    width: 100%;
}

.tw-top .row {
    min-height: var(--tw-header-height);
    align-items: center;
}

/* شعار */
.tw-slogan {
    text-align: center;
    font-weight: 700;
    font-size: 22px;
    color: var(--color-black);
    letter-spacing: .2px;
}

/* ───────── سرچ‌بار ───────── */
.tw-search__group {
    overflow: hidden;
    border-radius: .75rem;
    background: #fff;
    border: 1px solid #e6e6e6;
    box-shadow: var(--shadow-sm);
}

.tw-search__input {
    direction: rtl;
    border: 0;
    box-shadow: none !important;
    font-family: var(--font-fa), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

.tw-search__input::placeholder {
    color: #888;
}

.tw-search__btn {
    background: #fff;
    border: 0;
    color: var(--color-black);
    transition: var(--transition);
}

.tw-search__btn:hover, .tw-search__btn:focus {
    background: #f5f5f5;
    color: var(--color-rosegold);
}

/* ==== User chip inside dark navbar ==== */
.tw-nav .hh-user {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    color: #fff;
    padding: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.tw-nav .hh-user__link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: 6px 12px;
    text-decoration: none;
    color: inherit;
}

/* 3) هاور مثل آیتم‌های منو: زمینه کرم + آیکن رزگلد */
.tw-nav .hh-user:hover {
    background: #fff;
    color: var(--color-rosegold);
}

.tw-nav .hh-user__link:hover {
    background: #f8fafc;
}

.tw-nav .hh-user__toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #fff;
    border-radius: 9999px;
    cursor: pointer;
}

.tw-nav .hh-user__name {
    direction: ltr;
    unicode-bidi: plaintext;
    font-weight: 700;
    letter-spacing: .2px;
}

.tw-nav .bi-person {
    font-size: 1rem;
}

/* منو دقیقاً زیرِ چیپ و وسط */
.tw-nav .hh-user .dropdown-menu {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    top: calc(100% + .6rem) !important;
    margin-top: 0 !important;

    min-width: 220px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .12);
    border: 0;
    border-radius: 12px;
}

/* فلش بچرخد (Bootstrap aria-expanded را روی دکمه آپدیت می‌کند) */
.hh-user .bi-chevron-down {
    transition: transform .2s ease;
}

.hh-user .hh-user__toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* فلش در حالت هاور روی چیپ → مشکی */
.tw-nav .hh-user:hover .bi-chevron-down {
    color: var(--color-black) !important;
}

/* فلش وقتی منو باز است → همچنان مشکی بماند */
.hh-user .hh-user__toggle[aria-expanded="true"] .bi-chevron-down {
    color: var(--color-black) !important;
    transform: rotate(180deg);
}

/* اگر ترتیب عناصر را عوض نکردی، با order هم میشه فلش را ببری راست چیپ */
.hh-user__link {
    order: 1;
}

.hh-user__toggle {
    order: 2;
}

/* ───────── Navbar ───────── */
.tw-nav {
    background: var(--color-black);
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(255, 255, 255, .06);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.tw-menu {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center;
    gap: .25rem;
    align-items: stretch;
}

.tw-item {
    position: relative;
    display: flex;
}

.tw-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    color: var(--color-cream);
    text-decoration: none;
    transition: var(--transition);
}

.tw-link__text {
    display: inline-flex;
    align-items: center;
}

.tw-link__icon, .tw-caret {
    order: 1;
    margin-inline-end: .5rem;
    display: inline-flex;
}

.tw-link__icon {
    opacity: 0;
    transform: translateX(6px);
    transition: var(--transition);
}

.tw-item:hover .tw-link__icon {
    opacity: 1;
    transform: translateX(0);
}

.tw-item:hover > .tw-link,
.tw-subitem:hover,
.tw-subitem:hover > a {
    background: var(--color-cream);
    color: var(--color-black);
}

.tw-item:hover > .tw-link .bi {
    color: var(--color-rosegold);
}

/* فلش «محصولات» */
.tw-item--products > .tw-link .tw-caret {
    transition: transform .2s ease;
    font-size: 1rem;
}

.tw-item--products:hover > .tw-link .tw-caret,
.tw-item--products.open > .tw-link .tw-caret {
    transform: rotate(180deg);
}

/* ───────── Mega menu (تک‌ستونه) ───────── */
.tw-submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-black);
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
    padding: .75rem;
    display: none;
    z-index: 10;
    width: max-content;
    max-width: 90vw;
    white-space: nowrap;
    overflow: visible;
}

.tw-item--products:hover .tw-submenu,
.tw-item--products.open .tw-submenu {
    display: block;
}

.tw-subcol {
    display: inline-flex;
    flex-direction: column;
    gap: .25rem;
    vertical-align: top;
}

/* آیتم‌های سطح دوم (والدها) */
.tw-subitem {
    position: relative;
}

.tw-subitem, .tw-subitem > a {
    display: block;
    padding: .5rem .65rem;
    color: var(--color-cream);
    text-decoration: none;
    transition: var(--transition);
}

.tw-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
}

.tw-sub-caret {
    transition: transform .2s ease;
    font-size: .95rem;
}

.tw-has-children:hover > a .tw-sub-caret {
    transform: rotate(180deg);
}

/* ───────── سطح سوم: همیشه به چپ باز شود ───────── */
.tw-submenu-child {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    transform: translateX(-100%);
    background: var(--color-black);
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
    min-width: 200px;
    padding: .5rem;
    display: none;
    z-index: 50;
}

.tw-submenu-child a {
    display: block;
    padding: .45rem .6rem;
    color: var(--color-cream);
    text-decoration: none;
    transition: var(--transition);
}

.tw-submenu-child a:hover {
    background: var(--color-cream);
    color: var(--color-black);
}

/* نمایش سطح سوم روی هاور */
.tw-has-children:hover > .tw-submenu-child {
    display: block;
}

/* ریسپانسیو: مگامنو در تبلت/موبایل تک‌ستونه + چایلد زیر آیتم */
@media (max-width: 991.98px) {
    .tw-submenu {
        max-width: calc(100vw - 2rem);
        left: 1rem;
        right: 1rem;
        transform: none;
        white-space: normal;
    }

    .tw-submenu-child {
        position: static;
        transform: none;
        inset: auto;
        margin-top: .25rem;
        box-shadow: none;
        min-width: 0;
    }
}

/* موبایل: شعار پنهان و سرچ فیت */
@media (max-width: 575.98px) {
    .tw-slogan {
        display: none;
    }

    .tw-search__group {
        max-width: 100%;
    }
}

/* همبرگر فقط در موبایل */
.tw-burger {
    display: none;
    background: transparent;
    border: 0;
    color: var(--color-cream);
    padding: .5rem .75rem;
    font-weight: 600;
}

.tw-burger .bi {
    font-size: 1.25rem;
}

@media (max-width: 575.98px) {
    .tw-burger {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
    }

    .tw-menu {
        display: none;
    }
}

/* پرده نیمه‌شفاف */
.tw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(183, 110, 121, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1040;
}

.tw-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* کشوی موبایل */
.tw-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(85vw, 360px);
    background: var(--color-black);
    color: var(--color-cream);
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, .35);
    border-inline-start: 1px solid rgba(255, 255, 255, .06);
}

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

.tw-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.tw-drawer__close {
    background: transparent;
    border: 0;
    color: var(--color-cream);
    font-size: 1.1rem;
}

/* استک پنل‌ها (موبایل) */
.tw-mob-stack {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}

.tw-mob-level {
    position: absolute;
    inset: 0;
    padding: .5rem 0;
    overflow: auto;
    transform: translateX(100%);
    transition: transform .25s ease;
}

.tw-mob-level.is-active {
    transform: translateX(0);
}

.tw-mob-level li {
    list-style: none;
}

.tw-mob-level a, .tw-mob-next, .tw-mob-prev {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: right;
    background: transparent;
    border: 0;
    color: var(--color-cream);
    text-decoration: none;
    padding: .85rem 1rem;
    transition: var(--transition);
    border-radius: .5rem;
}

.tw-mob-level a:hover, .tw-mob-next:hover, .tw-mob-prev:hover {
    background: var(--color-cream);
    color: var(--color-black);
}

.tw-mob-level .bi {
    font-size: 1rem;
}

.tw-mob-next .bi {
    margin-inline-start: .5rem;
}

/* ورود (چپ) */
.tw-mob-prev .bi {
    margin-inline-end: .5rem;
}

/* بازگشت (راست) */


.tw-mob-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1rem;
    margin-top: .25rem;
    color: var(--color-cream);
    border: 1px dashed rgba(255, 255, 255, .15);
    border-radius: .5rem;
}

.tw-mob-user .bi {
    font-size: 1rem;
}