﻿/* app.css */

/* GLOBALNA OCHRONA PRZED POZIOMYM SCROLLEM (fix dla mobile) */
html, body {
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* RESPONSYWNOŚĆ */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        overflow-x: hidden;
    }

        .navbar nav {
            justify-content: center;
            margin-top: 0.5rem;
        }
}

/* ==================================================================== */
/* HAMBURGER MOBILE MENU - CSS-only (checkbox hack, bez JS)              */
/* Dziala na kazdej stronie niezaleznie od trybu renderowania Blazor     */
/* ==================================================================== */

/* Ukryj checkbox - jest tylko stanem, nie widoczny */
.mobile-menu-checkbox {
    display: none !important;
}

/* Przycisk hamburger - domyslnie ukryty (desktop) */
.mobile-menu-toggle {
    display: none;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 1.8rem;
    line-height: 1;
    z-index: 1002;
    user-select: none;
    -webkit-user-select: none;
    background: transparent;
    border: none;
}

/* Hamburger icon - rysowany z linii, bez fontow */
.hamburger-icon {
    display: inline-block;
    width: 28px;
    height: 22px;
    position: relative;
    vertical-align: middle;
}

.hamburger-icon::before,
.hamburger-icon::after,
.hamburger-icon {
    box-sizing: border-box;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: currentColor;
    border-radius: 2px;
    transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
}

.hamburger-icon::before {
    top: 0;
    box-shadow: 0 9px 0 currentColor;
}

.hamburger-icon::after {
    bottom: 0;
}

/* Overlay - ciemne tlo gdy menu otwarte, klikalne do zamkniecia */
.mobile-menu-overlay {
    display: none;
}

@media (max-width: 900px) {
    .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
    }

    .cart-text {
        display: none !important;
    }

    /* Mobilne menu - wysuwane z prawej strony */
    header .nav-links,
    .modern-navbar .nav-links,
    .green-navbar .nav-links {
        position: fixed !important;
        left: auto !important;
        top: 0 !important;
        right: -100% !important;
        bottom: 0 !important;
        transform: none !important;
        width: 80% !important;
        max-width: 320px !important;
        height: 100vh !important;
        background: white !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2rem !important;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15) !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1001 !important;
        display: flex !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    header .nav-links a,
    .modern-navbar .nav-links a,
    .green-navbar .nav-links a {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: #064e3b !important;
        text-decoration: none !important;
    }

    header .nav-links a:hover,
    .modern-navbar .nav-links a:hover,
    .green-navbar .nav-links a:hover {
        color: #81CF40 !important;
    }

    /* Overlay - ciemne tlo gdy checkbox jest checked */
    .mobile-menu-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0);
        z-index: 1000;
        pointer-events: none;
        transition: background 0.3s ease;
    }

    /* === CHECKBOX HACK - gdy checkbox :checked === */

    /* Menu wysuwa sie */
    .mobile-menu-checkbox:checked ~ .nav-links {
        right: 0 !important;
    }

    /* Overlay staje sie widoczny i klikalny */
    .mobile-menu-checkbox:checked ~ .mobile-menu-overlay {
        background: rgba(0, 0, 0, 0.5) !important;
        pointer-events: auto !important;
    }

    /* Hamburger icon -> X animacja */
    .mobile-menu-checkbox:checked ~ .mobile-menu-toggle .hamburger-icon::before {
        top: 9px !important;
        transform: rotate(45deg) !important;
        box-shadow: none !important;
    }

    .mobile-menu-checkbox:checked ~ .mobile-menu-toggle .hamburger-icon::after {
        bottom: 10px !important;
        transform: rotate(-45deg) !important;
    }
}
