/* ============================================================
   SPIS TREŚCI - components.css (style komponentów JS)
   1. ACCORDION (+ przycisk „Pokaż więcej")
   2. TABS
   3. MOBILE MENU
   4. POPUP
   5. GALLERY (lightbox - kropki paginacji)
   6. MEGAMENU
   7. CUSTOM SCROLL
   8. SMOOTH SCROLL
   9. CONTACT FORM 7 (bez warstwy, patrz niżej)
   ------------------------------------------------------------
   Utility Tailwinda zawsze wygrywa z tym plikiem: sekcje 1-8 siedzą w
   @layer components, więc klasa TW na elemencie (hidden, lg:static, kolor)
   bije regułę komponentu bez !important i bez dodatkowych reguł .x.hidden.
   Bez warstwy tylko nadpisania cudzego CSS bez warstwy (sekcja 9: arkusz CF7),
   bo w warstwie przegrałyby z oryginałem.
   Pierwsza linia ustala kolejność warstw jak w tailwind.css - w edytorze ten
   plik ładuje się PRZED tailwind.css i bez niej components spadłoby pod base.
   ============================================================ */
@layer theme, base, components, utilities;

@layer components {

/* === 1. ACCORDION === */
    .accordion_margin:before {
        content: "";
        margin-top: 0;
        float: left;
        width: 100%;
    }
    .accordion_margin:after {
        content: "";
        margin-bottom: 20px;
        float: left;
        width: 100%;
    }

    [accordion-button].active {
        /* Active accordion styles go here */
    }

    [accordion-button].active .rotate_bar {
        rotate: -90deg;
        transition: rotate .3s ease-in-out;
    }

    [accordion-panel].active {
        display: block;
    }

    [accordion-button] {
        cursor: pointer;
    }

    [accordion-panel] {
        display: none;
        overflow: hidden;
        height: 0;
        transition: height .3s ease-in-out;
    }

    /* Show more FAQ button */
    @keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
    }

    .hide-accordion {
        max-height: 0;
        display: none;
        overflow: hidden;
        transition: max-height 0.5s ease-out;
    }

    .show-more-btn {
        margin: 20px auto 0 auto;
        display: block;
        font-family: inherit;
        color: #fff;
        font-size: 14px;
        font-weight: 600;
        width: 100%;
        padding: 18px 0 18px 0;
        background-color: var(--color-ink-950, #000);
        transition: transform 300ms;
        border: none;
        cursor: pointer;
        border-radius: 24px;
    }

    .show-more-btn:hover {
        transform: scale(1.05);
    }

/* === 2. TABS === */
    [tab-button].active {
        /* Active tab styles go here */
    }

    /* Panele przez [data-tab-panels] > *: WordPress gubi atrybut tab-panel na wrapperze
       bloku-dziecka. [tab-panel] zostaje dla starszego markupu. */
    [data-tab-panels] > *.active,
    [tab-panel].active {
        display: block;
        animation: fadeIn .5s ease-in-out;
    }

    [data-tab-buttons] > *,
    [tab-button] {
        cursor: pointer;
    }

    [data-tab-panels] > *,
    [tab-panel] {
        display: none;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }


/* === 3. MOBILE MENU === */
    .bar{
        display: block;
        width: 25px;
        height: 2px;
        margin: 5px auto;
        -webkit-transition: all 0.3s ease-in-out;
        transition: all 0.3s ease-in-out;
        background-color: currentColor; /* kolor kresek = kolor tekstu przycisku (klasa text-* na .hamburger) */
    }

    /* Stan bazowy overlayu siedzi tutaj, nie w klasach TW na elemencie: klasy TW
       wygrywają z tą warstwą, więc .active z JS nie przełączyłoby opacity/visibility. */
    .nav-overlay {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .3s;
    }

    @media(max-width:1023px){

        .nav-menu{
        position: fixed;
        z-index: 1001;
        opacity: 0;
        transform: translateX(-100%);
        top: 0;
        transition: 0.6s;
        height: calc(100dvh);
        }

        .nav-menu.active{
            opacity: 1;
            transform: translateX(-12px);
        }

        .nav-overlay.active {
            opacity: 0.5;
            visibility: visible;
            pointer-events: auto;
        }

         .hamburger.active .bar:nth-child(1) {
            transform: rotate(45deg) translate(5px, 5px);
        }
        .hamburger.active .bar:nth-child(2) {
            opacity: 0;
        }
        .hamburger.active .bar:nth-child(3) {
            transform: rotate(-45deg) translate(5px, -5px);
        }
    }

/* === 4. POPUP === */
    /* Zamknięcie z animacją: popup.js dodaje .is-closing i czeka na animationend
       (z timeoutem bezpieczeństwa). Przy prefers-reduced-motion zamyka od razu. */
    @keyframes wbPopupOut {
        from { opacity: 1; }
        to { opacity: 0; }
    }

    .popup-modal.is-closing {
        animation: wbPopupOut .3s ease forwards;
    }


/* === 5. GALLERY (lightbox - kropki paginacji) === */
    .gallery-dot {
        width: 8px;
        height: 8px;
        border-radius: 9999px;
        background-color: #fff;
        opacity: 0.2;
        transition: opacity .2s ease;
    }

    .gallery-dot-active {
        opacity: 1;
    }


/* === 6. MEGAMENU === */
    [megamenu-panel] {
        display: none;
    }

    [megamenu-panel].active {
        display: flex;
    }

    .megamenu-item svg.active{
        rotate: 180deg;
    }

/* === 7. CUSTOM SCROLL === */
    .hide-scroll {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .hide-scroll::-webkit-scrollbar {
        display: none;
    }

    .scroller {
        scrollbar-width: auto;
        scrollbar-color: #1E1E1E #E2E2E2;
    }

    .scroller::-webkit-scrollbar {
        height: 5px;
    }

    .scroller::-webkit-scrollbar-track {
        background: #E2E2E2;
        border-radius: 20px;
    }

    .scroller::-webkit-scrollbar-thumb {
        background-color: #1E1E1E;
        border-radius: 20px;
    }


/* === 8. SMOOTH SCROLL === */
    @media (prefers-reduced-motion: no-preference) {
        html {
            scroll-behavior: smooth;
        }
    }

    /* Lenis (moduł gsap) sam przewija - natywne smooth koliduje z jego przewijaniem. */
    html.lenis {
        scroll-behavior: auto;
    }

} /* koniec @layer components */


/* === 9. CONTACT FORM 7 (bez warstwy: nadpisuje niewarstwowy arkusz wtyczki) === */
    /* Układ formularza robimy klasami Tailwinda w shortcode (class:...), a <p>/<br>
       wyłącza filtr w inc/custom.php. Przez class: przechodzą TYLKO proste klasy
       (litery/cyfry/dywiz); warianty (focus:), arbitrary ([..]) i kroki .5 psują
       parser form-tagów - takie style siedzą tutaj. Wartości ramki/promienia
       podmień pod design projektu, kolory przez tokeny palety. */

    /* Ramka pól: to, czego nie da się podać przez class: (border z kryciem itd.). */
    .wpcf7-form input[type="text"],
    .wpcf7-form input[type="email"],
    .wpcf7-form input[type="tel"],
    .wpcf7-form input[type="number"],
    .wpcf7-form select,
    .wpcf7-form textarea {
        width: 100%;
        border: 1px solid color-mix(in srgb, currentColor 50%, transparent);
        border-radius: 0.625rem;
        background-color: transparent;
    }

    .wpcf7-form input:focus,
    .wpcf7-form select:focus,
    .wpcf7-form textarea:focus {
        outline: none;
        border-color: var(--color-ink-950, currentColor);
    }

    /* Select: bez natywnej strzałki (dubluje się z własnym SVG chevron w wrapperze .relative). */
    .wpcf7-form select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: none;
    }

    /* Checkbox zgody: własny wygląd zamiast systemowego. Scope pod .wpcf7-acceptance,
       żeby wygrać z globalnymi regułami startera dla input[type=checkbox]. */
    .wpcf7-acceptance input[type="checkbox"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        width: 1.125rem;
        height: 1.125rem;
        flex-shrink: 0;
        margin-top: 0.125rem;
        border: 1px solid color-mix(in srgb, currentColor 50%, transparent);
        border-radius: 0.25rem;
        background-color: transparent;
        cursor: pointer;
    }

    .wpcf7-acceptance input[type="checkbox"]:checked {
        border-color: var(--color-yellow-200, currentColor);
        background-color: var(--color-yellow-200, currentColor);
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
        background-size: 0.75rem;
        background-position: center;
        background-repeat: no-repeat;
    }

    /* Zerowanie marginesów wrapperów CF7 - bez tego akceptacja ma wcięcie z lewej
       i za duży odstęp od pola powyżej (odstęp reguluje klasa mt-* na kontenerze w shortcode). */
    .wpcf7-list-item,
    .wpcf7-form-control-wrap {
        margin: 0;
    }

    /* Wrapper pola jako blok: inline span psuje pola w gridzie i pływające etykiety (:has). */
    .wpcf7-form-control-wrap {
        display: block;
    }

    /* Turnstile (tag [turnstile size:flexible]): rezerwacja wysokości widgetu, żeby formularz
       nie skakał, gdy iframe Cloudflare doładuje się po treści. */
    .wpcf7-turnstile {
        min-height: 65px;
    }

    /* Wyrównanie checkboxa zgody z wieloliniowym tekstem zgody. */
    .wpcf7-acceptance .wpcf7-list-item label {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        margin: 0;
    }

    /* Komunikat walidacji pod polem. */
    .wpcf7-not-valid-tip {
        margin-top: 0.25rem;
        font-size: 0.75rem;
        color: #dc2626;
    }

    .wpcf7-not-valid {
        border-color: #dc2626 !important;
    }

    /* Zbiorczy komunikat CF7 (sukces/błąd) pod formularzem. */
    .wpcf7-response-output {
        margin: 1rem 0 0;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        font-size: 0.875rem;
    }

    .wpcf7-spinner {
        margin-left: 0.5rem;
    }