:root {
    --lego-red: #D92328;
    --lego-blue: #006CB7;
    --lego-blue-hover: #005596;
    --lego-yellow: #FFD500;
    --lego-green: #00852B;
    --text-dark: #333;
    --border-color: #eee;
}

header {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 90px;
    display: flex;
    align-items: center;
    width: 100%;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--lego-blue) 0%, var(--lego-blue) 25%, var(--lego-red) 25%, var(--lego-red) 50%, var(--lego-yellow) 50%, var(--lego-yellow) 75%, var(--lego-green) 75%, var(--lego-green) 100%);
}

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

.logo {
    display: flex;
    align-items: center;
    height: 100%;
    text-decoration: none;
}

.logo img {
    height: 60px;
    width: auto;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo:hover img {
    transform: scale(1.05);
}

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

.nav-link {
    text-decoration: none;
    color: var(--lego-blue);
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Fredoka', sans-serif;
    position: relative;
    transition: all 0.1s ease;
    box-shadow: 0 4px 0 #e2e8f0;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--lego-blue-hover);
    transform: translateY(2px);
    box-shadow: 0 2px 0 #e2e8f0;
    background-color: #f8fafc;
}

.nav-link:active {
    transform: translateY(4px);
    box-shadow: none;
}

.btn-header {
    background-color: var(--lego-blue);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: 2px solid var(--lego-blue-hover);
    text-decoration: none;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    transition: all 0.1s ease;
    box-shadow: 0 4px 0 var(--lego-blue-hover);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    position: relative;
}

.btn-header:hover {
    background-color: var(--lego-blue-hover);
    transform: translateY(2px);
    box-shadow: 0 2px 0 #004c82;
    border-color: #004c82;
    color: white;
}

.btn-header:active {
    transform: translateY(4px);
    box-shadow: none;
}

.cart-btn {
    background-color: var(--lego-yellow);
    color: var(--text-dark);
    border-color: #dcb200;
    padding: 10px 16px;
    box-shadow: 0 4px 0 #dcb200;
}

.cart-btn:hover {
    background-color: #ffe033;
    color: var(--text-dark);
    border-color: #dcb200;
    box-shadow: 0 2px 0 #dcb200;
}

.cart-btn:active {
    box-shadow: none;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--lego-red);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    border: 2px solid white;
    box-shadow: 0 3px 0 #b31217;
    z-index: 10;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-badge.bump {
    transform: scale(1.3) translateY(-2px);
}

.profile-menu {
    position: relative;
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 30px;
    transition: background 0.3s;
    border: 1px solid transparent;
}

.profile-trigger span {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    color: var(--text-dark);
}

.profile-trigger:hover {
    background-color: #f4f4f4;
    border-color: var(--border-color);
}

.avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    width: 200px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    display: flex !important; 
    flex-direction: column !important;
    gap: 0 !important;
    padding: 8px 0 !important;
    border: 1px solid var(--border-color);
    z-index: 1100;
}

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

.dropdown li {
    width: 100%;
    margin: 0;
}

.dropdown a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s, color 0.2s;
}

.dropdown a:hover {
    background-color: #f8f9fa;
    color: var(--lego-blue);
}

.separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 5px 0 !important;
}

.logout-btn:hover {
    color: var(--lego-red) !important;
    background-color: #fff5f5 !important;
}

.lang-switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
}

.lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.2s ease;
    border-radius: 5px;
}

.lang-link:hover {
    transform: scale(1.1);
}

.flag-icon {
    width: 45px;
    height: 32px;
    border-radius: 5px;
    object-fit: cover;
    border: 2px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.lang-link.active .flag-icon {
    border-color: var(--lego-yellow);
    box-shadow: 0 0 0 2px var(--lego-yellow), 0 2px 5px rgba(0,0,0,0.15);
    transform: scale(1.05);
}

.lang-link:not(.active) .flag-icon {
    opacity: 0.7;
    filter: grayscale(20%);
}

.lang-link:not(.active):hover .flag-icon {
    opacity: 1;
    filter: grayscale(0%);
}

@media (max-width: 900px) {
    header {
        height: 75px;
    }

    .header-container {
        padding: 0 15px;
    }

    .logo img {
        height: 45px; 
    }

    .main-nav ul {
        gap: 15px;
    }

    .btn-header {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .profile-trigger span {
        display: none;
    }
    
    .profile-trigger {
        padding: 0;
        border: none;
    }
    
    .profile-menu {
        margin-left: 5px;
    }

    .nav-link {
        font-size: 0.95rem;
    }
    
    .btn-header {
        padding: 6px 14px;
        font-size: 0.85rem;
    }
    
    .lang-switch-container {
        margin-left: 10px;
    }
    
    .flag-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .logo img {
        height: 35px; 
    }

    .main-nav ul {
        gap: 8px;
    }

    .main-nav a.nav-link {
        display: none;
    }

    .btn-header {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .lang-switch-container {
        margin-left: 5px;
        gap: 5px;
    }
    
    .flag-icon {
        width: 24px;
        height: 24px;
    }
}