/* ===================================
   D-NOVA - Light Beam Navigation
   Animowana nawigacja wi�zek �wiat�a BMW Matrix LED
   =================================== */

/* Container nawigacji */
.water-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    pointer-events: none;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.water-nav.visible {
    opacity: 1 !important; /* Force visibility */
}

.water-nav.active {
    pointer-events: auto !important; /* Force interactivity */
}

/* T�o nawigacji (glassmorphism) */
.water-nav-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.water-nav.visible .water-nav-bg {
    opacity: 1;
}

/* Container przycisk�w */
.water-nav-buttons {
    display: flex;
    gap: 20px;
    position: relative;
}

/* Wi�zka �wiat�a (Matrix LED Beam) - zamiast kropli wody */
.water-drop {
    position: absolute;
    width: 4px;
    height: 150px;
    opacity: 0;
    pointer-events: none;
    animation: lightBeamDrop 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Wi�zka �wiat�a - gradient pionowy */
.water-drop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.8) 20%,
        rgba(200, 220, 255, 1) 50%,
        rgba(100, 150, 255, 0.9) 80%,
        rgba(0, 100, 255, 0) 100%
    );
    box-shadow: 
        0 0 20px rgba(200, 220, 255, 0.8),
        0 0 40px rgba(100, 150, 255, 0.5),
        0 0 60px rgba(0, 100, 255, 0.3);
    filter: blur(2px);
}

/* Punkt �wietlny na ko�cu wi�zki */
.water-drop::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 1) 0%,
        rgba(200, 220, 255, 0.8) 40%,
        rgba(100, 150, 255, 0) 100%
    );
    border-radius: 50%;
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.9),
        0 0 30px rgba(200, 220, 255, 0.6),
        0 0 45px rgba(100, 150, 255, 0.4);
}

/* Animacja spadaj�cej wi�zki �wiat�a */
@keyframes lightBeamDrop {
    0% {
        opacity: 0;
        transform: translateY(-200px) scaleY(0.3);
        filter: blur(5px);
    }
    
    30% {
        opacity: 1;
        filter: blur(2px);
    }
    
    70% {
        transform: translateY(0) scaleY(1);
        opacity: 1;
    }
    
    85% {
        transform: translateY(5px) scaleY(1.1);
    }
    
    100% {
        opacity: 0;
        transform: translateY(0) scaleY(1);
        filter: blur(0);
    }
}

/* Przycisk nawigacji (po transformacji) */
.water-nav-btn {
    position: relative;
    width: 140px;
    height: 70px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    transition: all 0.3s ease;
    transform: scale(0);
}

.water-nav-btn.transformed {
    animation: btnAppear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes btnAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    
    100% {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }
}

/* Kszta�t przycisku - BMW style */
.water-nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.04), 
        rgba(255, 255, 255, 0.01)
    );
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Hover state - NAPRAWIONY, bez jittera */
.water-nav-btn.is-hovered::before {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1), 
        rgba(200, 220, 255, 0.05)
    );
    border-color: rgba(200, 220, 255, 0.3);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(100, 150, 255, 0.2),
        inset 0 0 20px rgba(200, 220, 255, 0.08);
}

/* Ikona przycisku */
.water-nav-btn-icon {
    position: relative;
    font-size: 24px;
    color: #e8e8e8;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.water-nav-btn.is-hovered .water-nav-btn-icon {
    transform: scale(1.12);
    color: #ffffff;
    filter: drop-shadow(0 4px 12px rgba(200, 220, 255, 0.6));
}

/* Tekst przycisku */
.water-nav-btn-text {
    font-size: 13px;
    font-weight: 600;
    color: #d0d0d0;
    text-align: center;
    line-height: 1.2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.water-nav-btn.is-hovered .water-nav-btn-text {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(200, 220, 255, 0.5);
    letter-spacing: 0.5px;
}

/* Podpis (np. "Tutaj jeste�") */
.water-nav-btn-hint {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #666;
    opacity: 0;
    white-space: nowrap;
    transition: all 0.3s ease;
    pointer-events: none;
    font-weight: 500;
}

.water-nav-btn.active .water-nav-btn-hint {
    opacity: 1;
    color: #aaa;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    background: linear-gradient(135deg, 
        rgba(255, 50, 100, 0.95), 
        rgba(255, 20, 80, 0.95)
    );
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 
        0 0 20px rgba(255, 50, 100, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes badgePulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 50, 100, 0.6);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 50, 100, 0.9);
    }
}

.water-nav-btn.active::before {
    background: linear-gradient(135deg, 
        rgba(100, 150, 255, 0.15), 
        rgba(200, 220, 255, 0.08)
    );
    border-color: rgba(100, 150, 255, 0.4);
    box-shadow: 
        0 0 30px rgba(100, 150, 255, 0.25),
        0 0 60px rgba(100, 150, 255, 0.1),
        inset 0 0 20px rgba(200, 220, 255, 0.1);
}

.water-nav-btn.active .water-nav-btn-icon {
    color: #ffffff;
    transform: scale(1.08);
    filter: drop-shadow(0 3px 10px rgba(100, 150, 255, 0.7));
}

.water-nav-btn.active .water-nav-btn-text {
    color: #ffffff;
}

/* Efekt ripple przy klikni�ciu */
.water-nav-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle, 
        rgba(200, 220, 255, 0.3) 0%, 
        transparent 70%
    );
    opacity: 0;
    transform: scale(0);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.water-nav-btn:active::after {
    opacity: 1;
    transform: scale(2.5);
    transition: all 0s;
}

/* USUNI�TA animacja wave - by�a przyczyn� jittera */
/* Teraz tylko delikatny scale transition na hover */

/* Responsywno�� */
@media (max-width: 1024px) {
    .water-nav-buttons {
        gap: 15px;
    }
    
    .water-nav-btn {
        width: 120px;
        height: 65px;
    }
    
    .water-nav-btn-icon {
        font-size: 20px;
    }
    
    .water-nav-btn-text {
        font-size: 11px;
    }
}

/* ===================================================================
   MOBILE: dolny pasek nawigacji (native app "tab bar")
   Na telefonie nawigacja przenosi się na DÓŁ, jest zawsze widoczna,
   5 przycisków równomiernie na całą szerokość, z bezpiecznym
   wcięciem pod notch / pasek gestów (env safe-area).
   =================================================================== */
@media (max-width: 768px) {
    .water-nav {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
        /* Zawsze widoczna — niezależnie od animacji scrolla z JS */
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Tło wypełnia cały pasek (a nie sztywne 100px u góry) */
    .water-nav-bg {
        position: absolute;
        inset: 0;
        top: auto;
        bottom: auto;
        width: 100%;
        height: auto;
        border-bottom: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
        opacity: 1 !important;
    }

    .water-nav-buttons {
        width: 100%;
        gap: 0;
        flex-wrap: nowrap;
        justify-content: space-around;
        align-items: stretch;
        padding: 6px 4px;
        /* Wcięcie pod pasek gestów / notch */
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .water-nav-btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: auto;
        min-height: 52px;
        padding: 6px 2px;
        gap: 3px;
        /* Przyciski zawsze widoczne i klikalne na mobile */
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
        animation: none !important;
    }

    .water-nav-btn-icon {
        font-size: 22px;
    }

    /* Czytelna etykieta (zamiast nieczytelnych 9px).
       Stała wysokość = 2 wiersze dla KAŻDEGO przycisku → ikony
       są równo wyrównane, a długie nazwy ("Strona główna",
       "Panel Klienta") zawijają się zamiast ucinać w połowie słowa. */
    .water-nav-btn-text {
        font-size: 10px;
        line-height: 1.1;
        text-align: center;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        height: 22px;
        width: 100%;
        padding: 0 1px;
    }

    /* Podpowiedź ("Tutaj jesteś") niepotrzebna na dolnym pasku */
    .water-nav-btn-hint {
        display: none;
    }

    /* Aktywny przycisk: subtelny akcent górną kreską zamiast podpisu */
    .water-nav-btn.active::before {
        border-radius: 10px;
    }

    .water-drop {
        display: none;
    }
}

/* Efekt light trail (zamiast water trail) */
.water-trail {
    position: absolute;
    width: 3px;
    height: 30px;
    background: linear-gradient(180deg, 
        rgba(200, 220, 255, 0.6) 0%, 
        rgba(100, 150, 255, 0.3) 50%,
        transparent 100%
    );
    pointer-events: none;
    animation: lightTrailFade 0.8s ease-out forwards;
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.4);
    filter: blur(1px);
}

@keyframes lightTrailFade {
    0% {
        opacity: 1;
        transform: scaleY(1);
    }
    100% {
        opacity: 0;
        transform: scaleY(0.3) translateY(20px);
    }
}

/* Loader podczas animacji */
.water-nav.loading {
    pointer-events: none;
}

/* Accessibility */
.water-nav-btn:focus {
    outline: 2px solid rgba(100, 150, 255, 0.6);
    outline-offset: 4px;
}

.water-nav-btn:focus-visible::before {
    border-color: rgba(100, 150, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(100, 150, 255, 0.2);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .water-drop,
    .water-nav-btn,
    .water-nav-bg {
        animation: none !important;
        transition: opacity 0.3s ease !important;
    }
    
    .water-nav-btn::before,
    .water-nav-btn-icon,
    .water-nav-btn-text {
        transition: all 0.2s ease !important;
    }
}

/* Dark mode enhancement */
[data-theme="dark"] .water-nav-bg {
    background: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .water-nav-btn::before {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.06), 
        rgba(255, 255, 255, 0.02)
    );
    border-color: rgba(255, 255, 255, 0.1);
}

/* Dodatkowy efekt: linie �adowania jak w BMW iDrive */
.water-nav-btn .loading-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(100, 150, 255, 0.8) 50%,
        transparent 100%
    );
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.water-nav-btn.is-hovered .loading-line {
    width: 100%;
}
