﻿/* ============================================
   Header Component Styles
   ============================================ */

/* ===== Header Base ===== */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0.8rem 0;
    transition: all 0.3s ease;
}

    .header.scrolled {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    }

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    gap: 10px;
}

.navbar-brand {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

    .nav-link:hover,
    .nav-link.active {
        color: var(--secondary-color);
    }

    .nav-link::after {
        content: '';
        position: absolute;
        bottom: -5px;
        right: 0;
        width: 0;
        height: 2px;
        background: var(--secondary-color);
        transition: width 0.3s ease;
    }

    .nav-link:hover::after,
    .nav-link.active::after {
        width: 100%;
    }

/* ===== Nav Actions ===== */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.2rem;
    position: relative;
    padding: 0.4rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
}

    .nav-icon:hover {
        color: var(--secondary-color);
        background: var(--bg-light);
    }

/* ===== Search Toggle ===== */
.search-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

    .search-toggle:hover {
        background: var(--bg-light);
        color: var(--secondary-color);
    }

/* ===== Cart & Favorites Count Badge ===== */
.cart-count,
.favorites-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-color);
    color: var(--white);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1;
}

/* ===== User Section ===== */
.user-section {
    display: flex;
    align-items: center;
}

.auth-buttons {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.login-btn,
.register-btn {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.login-btn {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.register-btn {
    background: var(--primary-color);
    color: var(--white);
    border: 1px solid var(--primary-color);
}

    .login-btn:hover,
    .register-btn:hover {
        transform: translateY(-1px);
    }

    .register-btn:hover {
        background: var(--secondary-color);
        border-color: var(--secondary-color);
    }

/* ===== User Dropdown ===== */
.user-dropdown .user-menu {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

    .user-dropdown .user-menu:hover {
        background: var(--bg-light);
        border-color: var(--border-color);
    }

.user-icon {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.user-name {
    font-weight: 500;
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-menu {
    min-width: 200px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

    .user-dropdown-menu .dropdown-item {
        padding: 0.75rem 1.5rem;
        display: flex;
        align-items: center;
        gap: 10px;
        transition: all 0.3s ease;
        color: var(--primary-color);
        text-decoration: none;
    }

        .user-dropdown-menu .dropdown-item:hover {
            background: var(--bg-light);
            color: var(--secondary-color);
            transform: translateX(-5px);
        }

        .user-dropdown-menu .dropdown-item i {
            width: 20px;
            text-align: center;
            color: #8B4513;
        }

    .user-dropdown-menu .dropdown-divider {
        margin: 0.5rem 0;
    }

/* ===== Dropdown Base ===== */
.dropdown-menu {
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 0.5rem 0;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Favorites Dropdown ===== */
.favorites-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

    .favorites-dropdown-header h6 {
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0;
        color: #2C1810;
    }

.favorites-dropdown-body {
    padding: 0 20px;
    max-height: 300px;
    overflow-y: auto;
}

.favorite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}

    .favorite-item:last-child {
        border-bottom: none;
    }

.favorite-item-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

    .favorite-item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }

.favorite-item-info {
    flex: 1;
}

.favorite-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 4px;
    color: #2C1810;
}

.favorite-item-price {
    font-size: 0.85rem;
    color: #8B4513;
    font-weight: 600;
}

.favorite-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.favorites-dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
}

.favorites-empty {
    text-align: center;
    padding: 30px 0;
}

    .favorites-empty i {
        font-size: 2.5rem;
        color: #ddd;
        margin-bottom: 10px;
    }

    .favorites-empty p {
        color: #999;
        margin: 0;
    }

/* ===== Cart Dropdown ===== */
.cart-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

    .cart-dropdown-header h6 {
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0;
        color: #2C1810;
    }

.cart-total {
    font-size: 0.9rem;
    font-weight: 600;
    color: #8B4513;
}

.cart-dropdown-body {
    padding: 0 20px;
    max-height: 300px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}

    .cart-item:last-child {
        border-bottom: none;
    }

.cart-item-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

    .cart-item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 4px;
    color: #2C1810;
}

.cart-item-price {
    font-size: 0.8rem;
    color: #666;
}

.cart-item-total {
    font-weight: 600;
    color: #8B4513;
    margin-right: 8px;
}

.cart-item-actions {
    flex-shrink: 0;
}

.cart-empty {
    text-align: center;
    padding: 30px 0;
}

    .cart-empty i {
        font-size: 2.5rem;
        color: #ddd;
        margin-bottom: 10px;
    }

    .cart-empty p {
        color: #999;
        margin: 0;
    }

.cart-dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
}

.cart-more-items {
    text-align: center;
    padding: 8px 0;
    color: #999;
    font-size: 0.85rem;
}

/* ===== Navbar Toggler ===== */
.navbar-toggler {
    border: none;
    padding: 8px 10px;
    background: none;
    z-index: 1060;
}

    .navbar-toggler:focus {
        box-shadow: none;
        outline: none;
    }

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 1.5em;
    height: 1.5em;
    display: block;
}

/* ===== Search Overlay ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

    .search-overlay.active {
        display: flex;
    }

.search-container {
    width: 90%;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1.2rem 1.5rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    background: white;
    color: #333;
    outline: none;
}

.search-submit {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.3s ease;
}

    .search-submit:hover {
        background: var(--secondary-color);
    }

.search-close {
    position: absolute;
    top: -60px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* ============================================
   Full-Width Dropdown for Mobile
   ============================================ */
@media (max-width: 991.98px) {
    /* تنظیمات کلی برای همه dropdown ها - Full-Width */
    .header .dropdown-menu {
        position: fixed !important;
        top: 70px !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        border-radius: 0 !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: none !important;
        will-change: auto !important;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        border: none;
        background: var(--white);
        z-index: 1050;
        display: none !important;
        animation: slideDown 0.25s ease forwards;
    }

        .header .dropdown-menu.show {
            display: block !important;
        }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* دکمه بستن منو */
    .dropdown-close-btn {
        position: absolute;
        top: 12px;
        left: 15px;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #999;
        cursor: pointer;
        padding: 5px;
        transition: color 0.3s ease;
        z-index: 10;
    }

        .dropdown-close-btn:hover {
            color: #333;
        }

    /* Overlay برای بستن منو */
    .dropdown-overlay {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 1040;
        display: none;
    }

        .dropdown-overlay.show {
            display: block;
        }

    /* منوی علاقه‌مندی‌ها */
    .favorites-dropdown .dropdown-menu {
        top: 70px !important;
    }

    .favorites-dropdown-menu {
        padding: 15px 0 !important;
    }

    /* منوی سبد خرید */
    .cart-dropdown .dropdown-menu {
        top: 70px !important;
    }

    .cart-dropdown-menu {
        padding: 15px 0 !important;
    }

    /* منوی کاربر */
    .user-dropdown .dropdown-menu {
        top: 70px !important;
    }

    .user-dropdown-menu {
        padding: 8px 0 !important;
    }

    /* منوی همبرگر */
    .navbar-collapse {
        margin-top: 0.8rem;
        background: var(--white);
        padding: 1rem;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0.3rem;
    }

    .nav-link {
        padding: 0.5rem 0;
    }

    /* نوار اقدامات */
    .nav-actions {
        display: flex;
        align-items: center;
        gap: 0.3rem;
        flex-wrap: nowrap;
    }

    .nav-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        padding: 0.3rem;
    }

    .cart-count,
    .favorites-count {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        top: -3px;
        right: -3px;
    }

    /* بخش کاربر */
    .user-section {
        margin-right: 0.2rem;
    }

    .auth-buttons {
        gap: 0.3rem;
    }

    .login-btn,
    .register-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .user-name {
        display: none;
    }

    .user-dropdown .user-menu {
        padding: 0.3rem 0.5rem;
    }

    .user-icon {
        font-size: 1.1rem;
    }

    /* برند */
    .brand-name {
        font-size: 1.3rem;
    }

    .brand-subtitle {
        font-size: 0.65rem;
    }

    .logo-img {
        height: 35px !important;
    }
}

/* ============================================
   Small Mobile Devices
   ============================================ */
@media (max-width: 576px) {
    .header {
        padding: 0.5rem 0;
    }

    .navbar {
        gap: 5px;
    }

    .nav-actions {
        gap: 0.15rem;
    }

    .nav-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        padding: 0.2rem;
    }

    .cart-count,
    .favorites-count {
        width: 14px;
        height: 14px;
        font-size: 0.5rem;
        top: -2px;
        right: -2px;
    }

    .login-btn,
    .register-btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
    }

        .login-btn i,
        .register-btn i {
            display: none;
        }

    .brand-name {
        font-size: 1.1rem;
    }

    .logo-img {
        height: 30px !important;
    }

    .navbar-toggler {
        padding: 0.15rem 0.35rem;
    }

    .navbar-toggler-icon {
        width: 1.2em;
        height: 1.2em;
    }

    .search-toggle {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .navbar-collapse {
        margin-top: 0.5rem;
        padding: 0.8rem;
    }

    .user-section {
        margin-right: 0;
    }
}

/* ============================================
   Extra Small Mobile Devices
   ============================================ */
@media (max-width: 380px) {
    .nav-actions {
        gap: 0.1rem;
    }

    .nav-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        padding: 0.15rem;
    }

    .cart-count,
    .favorites-count {
        width: 12px;
        height: 12px;
        font-size: 0.4rem;
        top: -1px;
        right: -1px;
    }

    .login-btn,
    .register-btn {
        padding: 0.15rem 0.4rem;
        font-size: 0.6rem;
    }

    .logo-img {
        height: 25px !important;
    }

    .brand-name {
        font-size: 0.9rem;
    }
}
