/**
 * Simple Header Styles - Test version
 */

/* Header Container */
.main-header {
    background: #ffffff;
    border-bottom: 2px solid #e5e7eb;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    
    /* Animation - Start from above screen */
    transform: translateY(-100%);
    animation: slideDownHeader 0.8s ease-out forwards;
}

.header-container {
    position: relative;
}

/* Keyframes for header slide down animation */
@keyframes slideDownHeader {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    50% {
        transform: translateY(-10px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Header elements animation */
.brand-section,
.main-navigation,
.user-actions {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.brand-section {
    animation-delay: 0.2s;
}

.main-navigation {
    animation-delay: 0.4s;
}

.user-actions {
    animation-delay: 0.6s;
}

/* Keyframes for content fade in */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brand */
.brand-section {
    flex: 0 0 auto;
    z-index: 1001;
    position: relative;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1f2937;
    font-weight: 600;
    font-size: 1.25rem;
}

.brand-link:hover {
    color: #2563eb;
}

.brand-icon {
    font-size: 1.5rem;
}

/* Navigation */
.main-navigation {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: #2563eb;
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.btn-login {
    color: #2563eb;
    border-color: #2563eb;
    background: transparent;
}

.btn-login:hover {
    background: #2563eb;
    color: white;
}

.btn-register {
    background: #2563eb;
    color: white;
}

.btn-register:hover {
    background: #1d4ed8;
}

/* User Actions */
.user-actions {
    flex: 0 0 auto;
    z-index: 1001;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Cart & Wishlist Icons */
.cart-wishlist-icons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
}

.icon-link:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.icon-link i {
    font-size: 16px;
}

.icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none; /* Hidden by default, shown via JS when count > 0 */
    animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.cart-link:hover {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

.wishlist-link:hover {
    background: #fce7f3;
    border-color: #f9a8d4;
    color: #be185d;
}

.wishlist-link .icon-badge {
    background: #ec4899;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.cart-sidebar.active {
    visibility: visible;
    opacity: 1;
}

.cart-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.cart-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-sidebar.active .cart-sidebar-content {
    transform: translateX(0);
}

.cart-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.cart-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
}

.cart-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-loading,
.cart-empty,
.cart-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.cart-loading i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.cart-empty {
    padding: 3rem 2rem;
}

.cart-empty i {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-image .no-image {
    color: #9ca3af;
    font-size: 1.5rem;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-price {
    margin-bottom: 0.5rem;
}

.cart-item-price .price {
    font-size: 0.875rem;
    font-weight: 600;
    color: #059669;
}

.cart-item-price .price-free {
    font-size: 0.875rem;
    font-weight: 600;
    color: #dc2626;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    background: #f3f4f6;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.qty-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    min-width: 20px;
    text-align: center;
}

.cart-item-total {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.item-total {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.remove-btn {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.remove-btn:hover {
    background: #fef2f2;
    color: #991b1b;
}

.cart-sidebar-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1.5rem;
    background: #f8fafc;
}

.cart-total {
    margin-bottom: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.cart-actions {
    display: flex;
    gap: 0.75rem;
}

.cart-actions .btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.cart-actions .btn-outline-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #6b7280;
}

.cart-actions .btn-outline-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.cart-actions .btn-primary {
    background: #2563eb;
    border: 1px solid #2563eb;
    color: white;
}

.cart-actions .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Mobile Responsive for Cart Sidebar */
@media (max-width: 768px) {
    .cart-sidebar-content {
        width: 100%;
        max-width: 100%;
    }
    
    .cart-sidebar-header {
        padding: 1rem;
    }
    
    .cart-title {
        font-size: 1.125rem;
    }
    
    .cart-sidebar-body {
        padding: 0.75rem;
    }
    
    .cart-item {
        gap: 0.75rem;
        padding: 0.75rem 0;
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
    
    .cart-sidebar-footer {
        padding: 1rem;
    }
    
    .cart-actions {
        flex-direction: column;
    }
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 768px) {
    .user-menu {
        gap: 0.5rem;
    }
    
    .user-greeting {
        display: none;
    }
}

.user-greeting {
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.user-dropdown-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.user-icon {
    font-size: 1rem;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.user-dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 200px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background: #f9fafb;
    color: #2563eb;
}

.dropdown-item.logout-btn {
    color: #dc2626;
}

.dropdown-item.logout-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

/* Mobile Navigation - Hidden by default */
.mobile-menu-toggle {
    display: none;
    z-index: 1000;
    position: relative;
}

.mobile-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    border-radius: 4px;
    transition: background-color 0.2s;
    position: relative;
    z-index: 1001;
    min-width: 40px;
    min-height: 40px;
}

.mobile-toggle-btn:hover {
    background: #f3f4f6;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: #374151;
    transition: all 0.3s ease;
    display: block;
    pointer-events: none;
}

.mobile-toggle-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(50deg) translate(3px, 3px);
}

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

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

.mobile-nav {
    display: none;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-nav.active {
    display: block !important;
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.mobile-nav-item {
    margin: 0;
}

.mobile-nav-link {
    display: block;
    padding: 0.75rem 0;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #f3f4f6;
}

.mobile-nav-link:hover {
    color: #2563eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-navigation {
        display: none;
    }
    
    .auth-buttons {
        display: none;
    }
    
    .user-actions {
        display: flex !important; /* Keep cart/wishlist icons visible on mobile */
        gap: 0.5rem;
    }
    
    /* Hide user menu dropdown on mobile */
    .user-menu {
        display: none !important;
    }
    
    /* Brand section mobile optimization */
    .brand-link {
        font-size: 1rem !important; /* Smaller font size */
        gap: 0.3rem !important; /* Less gap */
    }
    
    .brand-icon {
        font-size: 1.2rem !important; /* Smaller icon */
    }
    
    .brand-text {
        font-size: 0.9rem !important; /* Smaller text */
        font-weight: 600; /* Slightly bolder to maintain visibility */
    }
    
    .cart-wishlist-icons {
        gap: 0.5rem;
    }
    
    .icon-link {
        width: 36px;
        height: 36px;
    }
    
    .icon-link i {
        font-size: 14px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .mobile-nav.active {
        display: block;
    }
}

/* User Dropdown Styles */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #374151;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.user-dropdown-btn:hover {
    background: #f3f4f6;
}

.user-dropdown .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    min-width: 200px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: all 0.2s ease !important;
    z-index: 1000 !important;
    margin-top: 0.5rem !important;
    display: block !important;
}

.user-dropdown:hover .dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
    border: none;
}

/* ==================== WISHLIST SIDEBAR ==================== */

.wishlist-sidebar {
    position: fixed !important;
    top: 0;
    right: -100% !important;
    width: 400px;
    height: 100vh;
    z-index: 1050;
    transition: all 0.3s ease;
    opacity: 0 !important;
    visibility: hidden !important;
}

.wishlist-sidebar.active {
    right: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.wishlist-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wishlist-sidebar.active .wishlist-sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.wishlist-sidebar-content {
    background: white;
    height: 100%;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.wishlist-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fef2f2;
    flex-shrink: 0;
}

.wishlist-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #dc2626;
}

.wishlist-close-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.wishlist-close-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.wishlist-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.wishlist-sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    flex-shrink: 0;
}

.wishlist-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wishlist-actions .btn {
    width: 100%;
    justify-content: center;
}

/* Wishlist Items */
.wishlist-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wishlist-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    transition: all 0.2s ease;
}

.wishlist-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #dc2626;
}

.wishlist-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wishlist-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wishlist-item-image .no-image {
    color: #9ca3af;
    font-size: 1.5rem;
}

.wishlist-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wishlist-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}

.wishlist-item-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: #dc2626;
}

.wishlist-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.wishlist-item-actions .btn-sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Wishlist Empty/Loading States */
.wishlist-empty,
.wishlist-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.wishlist-empty i,
.wishlist-loading i {
    display: block;
    margin: 0 auto 1rem;
    color: #dc2626;
}

.wishlist-loading i {
    animation: spin 1s linear infinite;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .wishlist-sidebar {
        width: 100vw;
        right: -100%;
    }
    
    .wishlist-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .wishlist-item-image {
        width: 50px;
        height: 50px;
    }
    
    .wishlist-sidebar-header,
    .wishlist-sidebar-footer {
        padding: 1rem;
    }
}