/* ==========================================================================
   Header & Navigation - Qustomity
   ========================================================================== */

:root {
    --header-height: 80px;
    --megamenu-offset: 24px;
}

/* ==========================================================================
   Header Base - Glass Effect
   ========================================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(109, 113, 238, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* Header po scrollu - bardziej solidny */
.header.scrolled {
    background: rgba(109, 113, 238, 0.95);
    box-shadow: 0 4px 30px rgba(20, 29, 168, 0.25);
    border-bottom-color: transparent;
}

.header__content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ==========================================================================
   Logo
   ========================================================================== */
.header__logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #FFFFFF;
    z-index: 1001;
}

.header__logo-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.header__logo-text {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
}

.header__logo-img {
    height: 100px;
    width: auto;
    display: block;
    filter: brightness(0) saturate(100%) invert(44%) sepia(52%) saturate(2800%) hue-rotate(222deg) brightness(100%) contrast(92%);
    transition: filter 0.4s ease;
}

.header.scrolled .header__logo-img {
    filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
    .header__logo-img {
        height: 55px;
    }
}
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 500px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 40%, rgba(255,255,255,0) 100%);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.header.scrolled::before {
    opacity: 0;
}
/* ==========================================================================
   Navigation
   ========================================================================== */
.header__nav {
    display: none;
}

@media (min-width: 1024px) {
    .header__nav {
        display: flex;
        align-items: center;
    }
}

.header__menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__item {
    position: relative;
}

.header__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: var(--fw-semibold);
    color: #FFFFFF;
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.header__link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

.header__link-arrow {
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
}

.header__link:hover .header__link-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Mega Menu - Glass Effect
   ========================================================================== */
.header__megamenu {
    position: absolute;
    top: calc(100% + var(--megamenu-offset));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    min-width: 700px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s, background 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(20, 29, 168, 0.2);
}

/* Mega menu po hover - pełniejsze kolory */
.header__item--has-mega:hover .header__megamenu {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 25px 60px -12px rgba(20, 29, 168, 0.25);
}

.header__megamenu::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--megamenu-offset) - 10px);
    left: 0;
    right: 0;
    height: calc(var(--megamenu-offset) + 15px);
    background: transparent;
}

.header__megamenu--compact {
    min-width: 550px;
}

.header__item--has-mega:hover .header__megamenu,
.header__megamenu:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s, background 0.3s ease;
}

.header__item--has-mega .header__megamenu {
    transform: translateX(-50%) translateY(-8px);
}

.header__item--has-mega:hover .header__link,
.header__item--has-mega:focus-within .header__link {
    background: rgba(255, 255, 255, 0.15);
}

.header__megamenu-left {
    flex: 0 0 280px;
    padding: 2.5rem 2rem;
    background: rgba(166, 170, 242, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 19px 0 0 19px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background 0.3s ease;
}

/* Left panel po hover - pełniejszy kolor */
.header__item--has-mega:hover .header__megamenu-left {
    background: rgba(166, 170, 242, 0.7);
}

.header__megamenu-headline {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: var(--fw-bold);
    color: var(--q-primary, #141DA8);
    line-height: 1.3;
    margin-bottom: 2rem;
}

.header__megamenu-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header__megamenu-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.9375rem;
    font-weight: var(--fw-medium);
    color: var(--q-primary, #141DA8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.header__megamenu-link:hover {
    color: var(--q-accent, #E74F14);
}

.header__megamenu-right {
    flex: 1;
    display: flex;
    gap: 0;
    padding: 2rem;
    background: transparent;
    border-radius: 0 19px 19px 0;
}

.header__megamenu-column {
    flex: 1;
    padding: 0 1.5rem;
    border-left: 1px solid rgba(20, 29, 168, 0.1);
}

.header__megamenu-column:first-child {
    border-left: none;
    padding-left: 0;
}

.header__megamenu-column--single {
    border-left: none;
    padding-left: 0;
}

.header__megamenu-title {
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--q-gray, #E74F14);
    margin-bottom: 1rem;
}

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

.header__megamenu-list--grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 40px;
    row-gap: 0;;
}

.header__megamenu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: var(--fw-medium);
    color: var(--q-primary, #141DA8);
    text-decoration: none;
    border-bottom: 1px solid rgba(20, 29, 168, 0.1);
    transition: all 0.2s ease;
}

.header__megamenu-item:hover {
    color: var(--q-accent, #E74F14);
}

.header__megamenu-item svg {
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.2s ease;
}

.header__megamenu-item:hover svg {
    opacity: 1;
    transform: translateX(0);
}

.header__megamenu-list li:last-child .header__megamenu-item {
    border-bottom: none;
}

/* ==========================================================================
   Header CTA Button
   ========================================================================== */
.header__cta {
    display: none;
}

@media (min-width: 1024px) {
    .header__cta {
        display: flex;
        margin-left: 1.5rem;
    }
}

.btn--white {
    background: #FFFFFF;
    color: var(--q-primary, #141DA8);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn--white:hover {
    background: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn--icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn--icon svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.btn--icon:hover svg {
    transform: translate(2px, 2px);
}

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

/* ==========================================================================
   Hamburger Menu
   ========================================================================== */
.header__burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    z-index: 1001;
    transition: background 0.2s ease;
}

.header__burger:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (min-width: 1024px) {
    .header__burger {
        display: none;
    }
}

.header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #FFFFFF;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.header__burger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header__burger.is-active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.header__burger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Mobile Navigation - POPRAWIONE
   ========================================================================== */
.header__mobile {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(109, 113, 238, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 999;
}

/* Otwarte menu - przez aria-hidden LUB klasę is-open */
.header__mobile[aria-hidden="false"],
.header__mobile.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header__mobile-nav {
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.header__mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.header__mobile-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.header__mobile-item > a,
.header__mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1.125rem 0;
    font-family: var(--font-primary);
    font-size: 1.125rem;
    font-weight: var(--fw-semibold);
    color: #FFFFFF;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.header__mobile-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

/* Chevron obrócony gdy otwarte */
.header__mobile-toggle[aria-expanded="true"] .header__mobile-chevron,
.header__mobile-toggle.is-open .header__mobile-chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   Mobile Submenu - POPRAWIONE
   ========================================================================== */
.header__mobile-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

/* Otwarte submenu - przez klasę is-open NAুPARENT lub bezpośrednio */
.header__mobile-item--has-sub.is-open .header__mobile-sub,
.header__mobile-sub.is-open {
    max-height: 600px;
}

.header__mobile-title {
    font-size: 0.75rem;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin: 1rem 0 0.75rem;
    padding-left: 1rem;
}

.header__mobile-title:first-child {
    margin-top: 0;
}

.header__mobile-sub ul {
    list-style: none;
    margin: 0;
    padding: 0 0 1rem 0;
}

.header__mobile-sub li a {
    display: block;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    font-weight: var(--fw-medium);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.header__mobile-sub li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.header__mobile-cta {
    padding-top: 1.5rem;
    margin-top: auto;
}

.header__mobile-cta .btn {
    background: #FFFFFF;
    color: var(--q-primary, #141DA8);
    font-weight: var(--fw-semibold);
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.header__mobile-cta .btn:hover {
    background: #F0F0F0;
}

/* ==========================================================================
   Body States
   ========================================================================== */
body.mobile-menu-open {
    overflow: hidden;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
    .header__content {
        padding: 0 1rem;
    }
}

@media (min-width: 1024px) and (max-width: 1200px) {
    .header__link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .header__megamenu {
        min-width: 600px;
    }
    
    .header__megamenu--compact {
        min-width: 480px;
    }
    
    .header__megamenu-left {
        flex: 0 0 220px;
        padding: 2rem 1.5rem;
    }
    
    .header__megamenu-headline {
        font-size: 1.25rem;
    }
}

/* Focus states */
.header__link:focus-visible,
.header__burger:focus-visible,
.header__megamenu-item:focus-visible,
.header__mobile-toggle:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
}

.header__megamenu-item:focus-visible {
    outline-color: var(--q-primary, #141DA8);
}
.header__megamenu-title {
    color: #E74F14 !important;
}
.header__megamenu-link {
    color: #141DA8 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    width: 100% !important;
    justify-content: center !important;
}

/* Logo position fix - align logo 35px from left edge on wide screens */
@media (min-width: 1440px) {
    .header__logo {
        position: relative;
        left: calc(723px - 50vw);
    }
}