/* ===== assets/css/header.css ===== */

/* ===== Header Variables ===== */
:root {
    --header-bg: #ffffff;
    --header-text: #333333;
    --header-hover: #667eea;
    --header-border: #eaeaea;
    --header-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    --header-transition: all 0.3s ease;
}

/* ===== Main Header - STICKY FIXED ===== */
.main-header {
    background: var(--header-bg);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9997;
    width: 100%;
    border-bottom: 1px solid var(--header-border);
    /* Important for sticky to work */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
}

.main-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

/* ===== Logo Section ===== */
.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo img {
    height: 50px;
    width: auto;
    transition: var(--header-transition);
}

.logo img:hover {
    transform: scale(1.05);
}

.logo div {
    display: flex;
    flex-direction: column;
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--header-text);
    margin: 0;
    line-height: 1.2;
}

.logo span {
    font-size: 12px;
    color: #666;
    letter-spacing: 0.5px;
}

/* ===== Navigation ===== */
.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.main-nav ul li a {
    display: flex;
    align-items: center;
    padding: 8px 18px;
    color: var(--header-text);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: var(--header-transition);
    position: relative;
}

.main-nav ul li a:hover {
    color: var(--header-hover);
    background: rgba(102, 126, 234, 0.05);
}

.main-nav ul li a.active {
    color: var(--header-hover);
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

.main-nav ul li a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--header-hover);
    border-radius: 10px;
}

/* ===== Header Icons Section ===== */
.header-icons {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1003;
}

/* Auth Buttons - Desktop */
.auth-buttons {
    display: flex;
    gap: 8px;
}

.auth-buttons a {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: var(--header-transition);
    position: relative;
    z-index: 1004;
    pointer-events: auto;
}

.btn-login {
    color: var(--header-hover);
    background: transparent;
    border: 1.5px solid var(--header-hover);
}

.btn-login:hover {
    background: var(--header-hover);
    color: white;
    transform: translateY(-2px);
}

.btn-signup {
    color: white;
    background: var(--header-hover);
    border: 1.5px solid var(--header-hover);
}

.btn-signup:hover {
    background: #5a67d8;
    border-color: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-logout {
    color: #dc3545;
    background: transparent;
    border: 1.5px solid #dc3545;
}

.btn-logout:hover {
    background: #dc3545;
    color: white;
}

/* Cart Icon */
.cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--header-text);
    font-size: 22px;
    text-decoration: none;
    transition: var(--header-transition);
    z-index: 1004;
    pointer-events: auto;
}

.cart-icon:hover {
    color: var(--header-hover);
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--header-hover);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0 4px;
    pointer-events: none;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--header-text);
    transition: var(--header-transition);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    position: relative;
    z-index: 1005;
    pointer-events: auto;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--header-hover);
}

/* Mobile Auth Buttons */
.auth-buttons-mobile {
    display: none;
}

/* ===== Menu Overlay ===== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: var(--header-transition);
    pointer-events: none;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .main-nav ul {
        gap: 2px;
    }
    
    .main-nav ul li a {
        padding: 8px 14px;
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .main-header .container {
        padding: 0 20px;
    }
    
    .main-nav ul li a {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .auth-buttons a {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ===== MOBILE MENU STYLES ===== */
@media (max-width: 768px) {
    .main-header {
        z-index: 9997;
        /* Ensure sticky works on mobile too */
        position: sticky;
        top: 0;
    }
    
    .main-header .container {
        height: 70px;
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .logo span {
        font-size: 10px;
    }
    
    .logo img {
        height: 40px;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 9999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        padding: 80px 20px 30px;
        overflow-y: auto;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 5px;
    }
    
    .main-nav ul li a {
        display: block;
        padding: 12px 15px;
        border-radius: 8px;
        width: 100%;
    }
    
    .main-nav ul li a.active::after {
        display: none;
    }
    
    .auth-buttons {
        display: none;
    }
    
    .auth-buttons-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid #eee;
    }
    
    .auth-buttons-mobile a {
        display: block;
        padding: 12px 15px;
        text-align: center;
        border-radius: 8px;
        text-decoration: none;
        font-weight: 500;
        transition: var(--header-transition);
        pointer-events: auto;
    }
    
    .header-icons {
        gap: 12px;
    }
    
    .cart-icon {
        font-size: 20px;
    }
    
    .cart-count {
        top: -5px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 16px;
    }
    
    .logo span {
        font-size: 9px;
    }
    
    .logo img {
        height: 35px;
    }
    
    .cart-icon {
        font-size: 18px;
    }
}