/* ===== MODERN PROFESSIONAL HEADER STYLES ===== */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Modern Professional Header */
.modern-professional-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.modern-professional-header.scrolled {
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
}

/* Header Wrapper */
.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 70px;
    position: relative;
}

/* Brand Section */
.brand-section {
    flex: 0 0 auto;
    margin-right: 32px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.brand-logo:hover {
    transform: scale(1.02);
    color: white;
    text-decoration: none;
}

.logo-image {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-name {
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
}

/* Desktop Navigation */
.desktop-navigation {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.nav-item {
    display: inline-block;
    position: relative;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    text-decoration: none;
}

.nav-icon {
    font-size: 16px;
    opacity: 0.9;
}

.nav-text {
    font-weight: 500;
}

/* Header Actions */
.header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Professional Cart Button */
.cart-container {
    position: relative;
}

.professional-cart-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.professional-cart-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-svg-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.cart-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid white;
    animation: cartBadgePulse 2s infinite;
}

@keyframes cartBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.cart-count-badge.cart-updated {
    animation: cartBadgeUpdate 0.3s ease;
}

@keyframes cartBadgeUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cart-text {
    font-weight: 500;
    color: white;
}

/* Balance Display */
.balance-display {
    display: flex;
    align-items: center;
}

.balance-chip {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.balance-icon {
    font-size: 14px;
    opacity: 0.9;
}

.balance-amount {
    font-weight: 700;
}

/* User Profile Menu */
.user-profile-menu {
    position: relative;
}

.profile-trigger {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    text-decoration: none;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.user-avatar-container {
    position: relative;
}

.avatar-image,
.avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.avatar-image {
    object-fit: cover;
}

.avatar-fallback {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease;
}

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    padding: 8px 0;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 99999;
}

.profile-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.dropdown-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-full-name {
    display: block;
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-email {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.dropdown-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 8px 0;
    border: none;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-link:hover {
    background: #f9fafb;
    color: #1f2937;
    text-decoration: none;
}

.dropdown-link i {
    font-size: 16px;
    color: #6b7280;
    width: 16px;
    text-align: center;
}

.dropdown-link:hover i {
    color: #3b82f6;
}

.logout-link {
    color: #ef4444;
}

.logout-link:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Guest Authentication */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.login-btn {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.register-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: rgba(255, 255, 255, 0.9);
}

.register-btn:hover {
    background: white;
    transform: translateY(-1px);
    color: #667eea;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    gap: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    z-index: 10000;
    position: relative;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: none;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
    display: block;
}

.mobile-nav-content {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 100000;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.mobile-nav-overlay.active .mobile-nav-content {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.mobile-nav-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #1f2937;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    line-height: 1;
}

.mobile-nav-close:hover {
    background: #e5e7eb;
    color: #ef4444;
}

.mobile-nav-close i {
    font-size: 28px;
    line-height: 1;
}

.mobile-navigation {
    padding: 20px 0;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    color: #374151;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-link:hover {
    background: #f8fafc;
    color: #1f2937;
    border-left-color: #3b82f6;
    text-decoration: none;
}

.mobile-nav-link i {
    font-size: 20px;
    color: #6b7280;
    width: 20px;
    text-align: center;
}

.mobile-nav-link:hover i {
    color: #3b82f6;
}

.mobile-nav-link.logout {
    color: #ef4444;
}

.mobile-nav-link.logout:hover {
    background: #fef2f2;
    color: #dc2626;
    border-left-color: #ef4444;
}

.mobile-user-info {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

.mobile-balance {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #374151;
    font-weight: 600;
}

.mobile-balance i {
    font-size: 18px;
    color: #10b981;
}

/* Body Padding for Fixed Header */
body {
    padding-top: 70px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-wrapper {
        padding: 0 20px;
    }
    
    .nav-link {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .balance-chip {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .professional-cart-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .header-wrapper {
        padding: 0 16px;
        height: 64px;
    }
    
    body {
        padding-top: 64px;
    }
    
    /* Hide desktop navigation */
    .desktop-navigation {
        display: none !important;
    }
    
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
    }
    
    /* Adjust brand section */
    .brand-section {
        margin-right: auto;
    }
    
    .logo-image {
        max-height: 32px;
    }
    
    .brand-name {
        font-size: 16px;
    }
    
    /* Hide username in mobile */
    .user-name {
        display: none !important;
    }
    
    /* Hide balance display in mobile */
    .balance-display {
        display: none !important;
    }
    
    /* Hide user profile menu on mobile */
    .user-profile-menu {
        display: none !important;
    }
    
    /* Hide auth buttons on mobile - they're in the mobile menu */
    .auth-section {
        display: none !important;
    }
    
    /* Adjust header actions */
    .header-actions {
        gap: 8px;
    }
    
    /* Make cart button more compact */
    .professional-cart-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: auto;
    }
    
    .cart-text {
        display: none;
    }
    
    .cart-svg-icon {
        width: 18px;
        height: 18px;
    }
    
    .cart-count-badge {
        top: -6px;
        right: -6px;
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        padding: 1px 4px;
    }
    
    /* Adjust user avatar */
    .avatar-image,
    .avatar-fallback {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    /* Adjust auth buttons */
    .auth-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Adjust dropdown positioning */
    .profile-dropdown {
        min-width: 200px;
        right: -10px;
    }
}

@media (max-width: 480px) {
    .modern-professional-header {
        font-size: 14px;
    }
    
    .header-wrapper {
        padding: 0 12px;
        height: 56px;
    }
    
    /* Make mobile nav content full width on small screens */
    .mobile-nav-content {
        width: 100%;
    }
    
    /* Further compact cart button */
    .professional-cart-btn {
        padding: 6px 10px;
    }
    
    /* Smaller auth buttons */
    .auth-section {
        gap: 8px;
    }
    
    .auth-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Adjust dropdown */
    .profile-dropdown {
        right: -20px;
        min-width: 180px;
    }
}

/* High specificity overrides */
html body .modern-professional-header,
html body .modern-professional-header * {
    box-sizing: border-box;
}

/* Ensure header is always visible */
html body .modern-professional-header {
    display: flex;
    visibility: visible;
    opacity: 1;
}

/* Animation for smooth interactions */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-dropdown.show {
    animation: fadeInUp 0.2s ease;
}

/* Focus states for accessibility */
.nav-link:focus,
.professional-cart-btn:focus,
.auth-btn:focus,
.profile-trigger:focus,
.mobile-menu-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .modern-professional-header {
        display: none;
    }
    
    body {
        padding-top: 0;
    }
}
