header {
    max-height: 5em;
    position: fixed;
    top: 0;
    width: -webkit-fill-available;
    z-index: 3000;
    /* background: var(--gradient-primary); */
    background-size: 120% 100%;
    animation: headerGradient 30s ease infinite;
    /* box-shadow: var(--shadow-medium), var(--shadow-light); */
    /* border-bottom: 1px solid var(--border-light); */
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

@keyframes headerGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

header .container {
    height: 5em;
    display: inline-flex;
    width: -webkit-fill-available;
    justify-content: space-between;
    /* box-shadow: 0 0 5px var(--shadow-dark); */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: url(/images/bg.webp);
    align-items: center;
}

header #logo {
    display: block;
    height: -webkit-fill-available;
}

header #menu {
    display: flex;
    margin-block: auto;
    margin-inline: 0;
    overflow: hidden;
    width: -webkit-fill-available;
    justify-content: flex-end;
    flex-direction: row;
}

header #menu ul {
    list-style: none;
    display: flex;
}

/* Unified button styles for all header elements */
header #menu a, header #navigation a, header #customization a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 3em;
    padding: 0.6em 1em;
    justify-content: center;
    color: var(--text-light);
    background: var(--glass-bg);
    border-radius: 12px;
    margin: auto 0.2em;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

header #menu a::before, header #navigation a::before, header #customization a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    transition: left 0.5s;
}

header #menu a:hover, header #navigation a:hover, header #customization a:hover {
    background: var(--glass-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: var(--border-light);
}

header #menu a:hover::before, header #navigation a:hover::before, header #customization a:hover::before {
    left: 100%;
}

header #menu a:active, header #navigation a:active, header #customization a:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

/* Icon and customization styling */
header #navigation img, header #customization img {
    max-height: 32px;
    max-width: 32px;
    margin-bottom: 0.2em;
}

header #customization {
    border-left: 1px solid var(--border-light);
    margin-left: 0.5em;
    padding-left: 0.5em;
}

header img {
    height: 4em;
    width: auto;
}

/* Theme toggle button specific styles */
#night-mode, #light-mode {
    cursor: pointer;
    transition: all 0.3s ease;
}

#night-mode:hover, #light-mode:hover {
    transform: scale(1.05);
    background: var(--glass-bg);
}

/* Active theme button state */
#night-mode.active, #light-mode.active {
    background: var(--primary-purple);
    border-color: var(--white);
    box-shadow: 0 0 15px var(--primary-purple);
    transform: scale(1.05);
}

#night-mode.active span, #light-mode.active span {
    color: var(--white);
    font-weight: 600;
}

/* Theme toggle animation */
#night-mode, #light-mode {
    position: relative;
    overflow: hidden;
}

#night-mode::after, #light-mode::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--primary-purple);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: -1;
}

#night-mode:hover::after, #light-mode:hover::after {
    width: 100%;
    height: 100%;
}

#night-mode.active::after, #light-mode.active::after {
    width: 100%;
    height: 100%;
}

/* Dark theme specific header adjustments */
[data-theme="dark"] header {
    background: linear-gradient(135deg, var(--primary-blue-dark) 0%, var(--primary-orange-dark) 50%, var(    --primary-blue-dark) 100%);
}

[data-theme="dark"] header .container {
}
