﻿/* wwwroot/css/header.css */
.site-header {
    background: var(--color-dark);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* ============================================================ */
/* لوگو                                                          */
/* ============================================================ */
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 16px;
    flex-shrink: 0;
    text-decoration: none;
}

    .header-logo svg,
    .header-logo img {
        width: 42px;
        height: 42px;
        color: var(--color-primary);
    }

.header-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

    .header-logo-text strong {
        font-size: 16px;
        font-family: var(--font-heading);
    }

    .header-logo-text small {
        font-size: 10px;
        color: #94a3b8;
        font-family: var(--font-primary);
        font-weight: normal;
    }

/* ============================================================ */
/* منوی اصلی                                                      */
/* ============================================================ */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

    .main-nav ul {
        display: flex;
        align-items: center;
        gap: 4px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .main-nav a {
        display: block;
        padding: 8px 14px;
        color: #cbd5e1;
        font-size: 13px;
        font-family: var(--font-primary);
        border-radius: var(--radius-sm);
        position: relative;
        transition: all 0.25s ease;
        text-decoration: none;
    }

        .main-nav a:hover,
        .main-nav a.active {
            color: var(--color-primary);
            background: rgba(212, 160, 23, 0.08);
            text-decoration: none;
        }

            .main-nav a.active::after {
                content: '';
                position: absolute;
                bottom: -2px;
                right: 50%;
                transform: translateX(50%);
                width: 30%;
                height: 2px;
                background: var(--color-primary);
                border-radius: 2px;
            }

/* ============================================================ */
/* اکشن‌های سمت چپ / کنار همبرگری                                */
/* ============================================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* دکمه آیکون‌دار (جستجو) */
.header-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

    .header-icon-btn:hover {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: var(--color-dark);
        transform: rotate(90deg);
    }

/* دکمه ورود / ثبت نام */
.header-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    background: rgba(212, 160, 23, 0.1);
    border: 1px solid rgba(212, 160, 23, 0.35);
    color: var(--color-primary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
}

    .header-auth-btn:hover {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: var(--color-dark);
        text-decoration: none;
    }

    .header-auth-btn svg {
        flex-shrink: 0;
    }

/* دکمه سبد خرید */
.header-cart-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    text-decoration: none;
}

    .header-cart-btn:hover {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: var(--color-dark);
        text-decoration: none;
    }

/* نشانگر تعداد */
.cart-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-family: var(--font-primary);
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--color-dark);
    box-sizing: content-box;
}

/* حالت فعال سبد خرید (تعداد > 0) */
.header-cart-btn.has-items .cart-badge {
    display: flex;
}

/* حالت غیرفعال سبد خرید (خالی) */
.header-cart-btn.is-empty {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(80%);
}

/* دکمه همبرگری */
.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .mobile-menu-toggle:hover {
        background: rgba(212, 160, 23, 0.1);
        border-color: var(--color-primary);
        color: var(--color-primary);
    }

/* ============================================================ */
/* جستجوی بازشو (زیر هدر)                                        */
/* ============================================================ */
.header-search-box {
    background: var(--color-dark-2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 24px;
}

    .header-search-box.open {
        max-height: 100px;
        padding: 14px 24px;
    }

.header-search-form {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

    .header-search-form input[type="text"] {
        flex: 1;
        height: 44px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: var(--radius-sm);
        padding: 0 16px;
        color: #fff;
        font-family: var(--font-primary);
        font-size: 14px;
        outline: none;
        transition: border-color 0.25s ease;
    }

        .header-search-form input[type="text"]::placeholder {
            color: #7a8394;
        }

        .header-search-form input[type="text"]:focus {
            border-color: var(--color-primary);
            background: rgba(255, 255, 255, 0.08);
        }

    .header-search-form button {
        width: 44px;
        height: 44px;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.25s ease;
        flex-shrink: 0;
    }

        .header-search-form button:hover {
            background: var(--color-primary);
            border-color: var(--color-primary);
            color: var(--color-dark);
        }

    .header-search-form .header-search-close:hover {
        background: #ef4444;
        border-color: #ef4444;
        color: #fff;
    }

/* ============================================================ */
/* دسکتاپ بزرگ (>1200px) — نمایش کامل متن دکمه ورود              */
/* ============================================================ */
@media (min-width: 1201px) {
    .header-auth-btn .auth-text {
        display: inline;
    }
}

/* ============================================================ */
/* تبلت (993px - 1200px) — پنهان کردن متن دکمه ورود              */
/* ============================================================ */
@media (max-width: 1200px) {
    .header-auth-btn {
        padding: 0 12px;
    }

        .header-auth-btn .auth-text {
            display: none;
        }

    .main-nav a {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ============================================================ */
/* تبلت و موبایل (<= 992px)                                      */
/* ============================================================ */
@media (max-width: 992px) {

    /* منوی موبایل */
    .main-nav {
        position: fixed;
        top: 72px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 72px);
        background: var(--color-dark-2);
        padding: 20px;
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 999;
        display: block;
        justify-content: flex-start;
    }

        .main-nav.open {
            right: 0;
        }

        .main-nav ul {
            flex-direction: column;
            align-items: stretch;
            gap: 4px;
        }

        .main-nav a {
            padding: 12px 16px;
            font-size: 14px;
        }

    /* دکمه همبرگری نمایش داده شود */
    .mobile-menu-toggle {
        display: flex;
    }

    /* متن لوگو کوچک مخفی */
    .header-logo-text small {
        display: none;
    }

    /* دکمه ورود در موبایل فقط آیکون */
    .header-auth-btn {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

        .header-auth-btn .auth-text {
            display: none;
        }

    /* ترتیب اکشن‌ها در موبایل: جستجو، ورود، سبد، همبرگری */
    .header-actions {
        gap: 6px;
    }
}

/* ============================================================ */
/* موبایل کوچک (<= 600px)                                       */
/* ============================================================ */
@media (max-width: 600px) {
    .header-inner {
        height: 64px;
        padding: 0 12px;
        gap: 8px;
    }

    .header-logo svg,
    .header-logo img {
        width: 34px;
        height: 34px;
    }

    .header-logo-text strong {
        font-size: 13px;
    }

    .header-icon-btn,
    .header-cart-btn,
    .header-auth-btn,
    .mobile-menu-toggle {
        width: 38px;
        height: 38px;
    }

    .header-actions {
        gap: 4px;
    }

    .cart-badge {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        top: -3px;
        left: -3px;
    }

    .main-nav {
        top: 64px;
        height: calc(100vh - 64px);
    }
}

/* ============================================================ */
/* موبایل خیلی کوچک (<= 380px)                                  */
/* ============================================================ */
@media (max-width: 380px) {
    .header-inner {
        padding: 0 8px;
    }

    .header-icon-btn,
    .header-cart-btn,
    .header-auth-btn,
    .mobile-menu-toggle {
        width: 34px;
        height: 34px;
    }

    .header-logo svg,
    .header-logo img {
        width: 30px;
        height: 30px;
    }

    .header-logo-text strong {
        font-size: 12px;
    }
}

/* ============================================================ */
/* Dropdown منوی کاربر و فعالیت‌های فرهنگی — تم تیره              */
/* ============================================================ */
.site-header .dropdown-menu {
    background-color: #1a2d4a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 6px 0;
    margin-top: 8px;
    min-width: 200px;
    border-radius: 8px;
}

    .site-header .dropdown-menu .dropdown-item {
        color: #d5d9e1;
        padding: 9px 16px;
        font-family: var(--font-primary);
        font-size: 13px;
        transition: all 0.2s ease;
        border-radius: 0;
    }

        .site-header .dropdown-menu .dropdown-item:hover,
        .site-header .dropdown-menu .dropdown-item:focus {
            background-color: #0f1d30 !important;
            color: #ffd966;
        }

        .site-header .dropdown-menu .dropdown-item i {
            color: #ffd966;
            width: 18px;
            text-align: center;
            margin-left: 6px;
        }

    .site-header .dropdown-menu .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.08);
        margin: 4px 0;
    }

.site-header .main-nav .dropdown-toggle::after {
    margin-right: 6px;
    vertical-align: middle;
    color: #cbd5e1;
    font-size: 10px;
}

.site-header .main-nav .dropdown-toggle:hover {
    color: #d4a017;
}

.site-header .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #1a2d4a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 6px 0;
    min-width: 200px;
    z-index: 1050;
}

    .site-header .dropdown-menu.show {
        display: block;
    }

    .site-header .dropdown-menu .dropdown-item {
        color: #d5d9e1;
        padding: 9px 16px;
        font-size: 13px;
    }

        .site-header .dropdown-menu .dropdown-item:hover {
            background-color: #0f1d30;
            color: #ffd966;
        }