/* ---------------------------------------------------------------------------
 * Sidebar menu — base styles.
 * Hardcoded shell; items renderowane z WP menu (Wygląd → Menu).
 * Włączane przez Wygląd → Dostosuj → Sidebar Menu (theme_mod) lub shortcode.
 * Loaded via custom_style_dehash() glob w functions.php.
 * ------------------------------------------------------------------------- */

:root {
    --luk-sidebar-width: 280px;
    --luk-sidebar-z: 9999;
    --luk-sidebar-logo-max-h: 80px;
}

.luk-sidebar { position: relative; font-family: inherit; }

/* ---------- Mobile toggle button (rendered inside .luk-sidebar) ---------- */
.luk-sidebar__open-btn {
    position: fixed; top: 12px; left: 12px;
    z-index: calc(var(--luk-sidebar-z) - 1);
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: #fff; border: 1px solid #1a1a1a; border-radius: 4px;
    color: #1a1a1a; cursor: pointer;
}
.luk-sidebar__open-icon,
.luk-sidebar__open-icon::before,
.luk-sidebar__open-icon::after {
    display: block; width: 22px; height: 2px; background: currentColor;
}
.luk-sidebar__open-icon { position: relative; }
.luk-sidebar__open-icon::before,
.luk-sidebar__open-icon::after { content: ''; position: absolute; left: 0; }
.luk-sidebar__open-icon::before { top: -7px; }
.luk-sidebar__open-icon::after  { top:  7px; }

/* ---------- Panel ---------- */
.luk-sidebar__panel {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(var(--luk-sidebar-width), 92vw);
    background: #fff; color: #1a1a1a;
    box-shadow: 2px 0 20px rgba(0, 0, 0, .15);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: var(--luk-sidebar-z);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.luk-sidebar.is-open .luk-sidebar__panel { transform: translateX(0); }

.luk-sidebar__backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: calc(var(--luk-sidebar-z) - 2);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.luk-sidebar.is-open .luk-sidebar__backdrop { opacity: 1; pointer-events: auto; }

.luk-sidebar__head {
    display: flex; align-items: center; gap: 12px;
    padding: 24px 16px; border-bottom: 1px solid #e5e5e5;
    min-height: calc(var(--luk-sidebar-logo-max-h) + 24px);
}
.luk-sidebar__logo { display: inline-block; max-width: 100%; }
.luk-sidebar__logo img {
    display: block;
    max-height: var(--luk-sidebar-logo-max-h);
    max-width: 100%;
    width: auto; height: auto;
    object-fit: contain;
}
.luk-sidebar__title { margin: 0; font-weight: 700; font-size: 16px; line-height: 1.2; }
.luk-sidebar__close-btn {
    margin-left: auto;
    background: transparent; border: 0; cursor: pointer;
    font-size: 28px; line-height: 1; padding: 4px 8px; color: inherit;
}

.luk-sidebar__nav { padding: 0; flex: 1 1 auto; }

/* ---------- Menu list ---------- */
.luk-sidebar__menu,
.luk-sidebar__submenu {
    list-style: none; margin: 0; padding: 0;
}
.luk-sidebar__submenu {
    flex-basis: 100%;
    max-height: 0; overflow: hidden;
    background: transparent;
    transition: max-height .25s ease;
}
.luk-sidebar__item.is-expanded > .luk-sidebar__submenu { max-height: 2000px; }

.luk-sidebar__item {
    position: relative;
    display: flex; flex-direction: column;
}
/* Nav indicator pattern: GitHub/VS Code style — 3 distinct states.
 * Default: clean. Hover: subtle wash. Active: bar + tint + weight. */
.luk-sidebar__row {
    display: flex; align-items: center;
    position: relative;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, border-left-color 0.15s ease;
}

/* Hover/focus — transient feedback (signals "klikalne") */
.luk-sidebar__row:hover,
.luk-sidebar__row:focus-within {
    background: rgba(0, 0, 0, 0.04);
}

/* Active — persistent "you are here": left bar + light tint + bold */
.luk-sidebar__row.is-active {
    border-left-color: #3EE622;
    background: rgba(62, 230, 34, 0.08);
}
.luk-sidebar__row.is-active .luk-sidebar__link {
    font-weight: 600;
}

/* Active + hover — tint deepens, bar stays */
.luk-sidebar__row.is-active:hover,
.luk-sidebar__row.is-active:focus-within {
    background: rgba(62, 230, 34, 0.14);
}

.luk-sidebar__link {
    flex: 1 1 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    text-decoration: none; color: inherit; font-weight: 500;
    background: transparent;
    transition: color 0.15s ease;
}
.luk-sidebar__row:hover .luk-sidebar__link,
.luk-sidebar__row:focus-within .luk-sidebar__link,
.luk-sidebar__row.is-active .luk-sidebar__link {
    color: #000;
}
.luk-sidebar__row:hover .luk-sidebar__toggle,
.luk-sidebar__row:focus-within .luk-sidebar__toggle,
.luk-sidebar__row.is-active .luk-sidebar__toggle { color: #000; }
.luk-sidebar__link.is-active { color: #000; }
.luk-sidebar__icon { width: 20px; height: 20px; object-fit: contain; }

.luk-sidebar__toggle {
    flex: 0 0 auto; width: 44px; height: 44px;
    background: transparent; border: 0; cursor: pointer; color: inherit;
    display: inline-flex; align-items: center; justify-content: center;
}
.luk-sidebar__toggle-icon {
    display: block; width: 10px; height: 10px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s ease;
    margin-top: -3px;
}
.luk-sidebar__item.is-expanded > .luk-sidebar__row > .luk-sidebar__toggle .luk-sidebar__toggle-icon {
    transform: rotate(225deg); margin-top: 3px;
}

.luk-sidebar__submenu .luk-sidebar__link { padding-left: 32px; font-weight: 400; }
.luk-sidebar__submenu .luk-sidebar__submenu .luk-sidebar__link { padding-left: 48px; }
.luk-sidebar__submenu .luk-sidebar__submenu .luk-sidebar__submenu .luk-sidebar__link { padding-left: 64px; }

/* ---------- Search row (góra sidebara, klik rozwija inline form) ---------- */
.luk-sidebar__search-trigger {
    width: 100%; text-align: left;
    border: 0; cursor: pointer;
    background: transparent; color: inherit; font: inherit;
}
.luk-sidebar__search-row { /* matches .luk-sidebar__row layout */ }
.luk-sidebar__search-icon { flex: 0 0 auto; }

/* Trigger otwiera overlay lukasiewicz-search (.fs-trigger/.fs-trigger-btn).
   Plugin daje inline-flex + własny padding (spec. 0,2,0) — przywróć full-width
   wygląd wiersza sidebara wyższą specyficznością (0,3,0). */
.luk-sidebar__search.fs-trigger { display: block; width: 100%; }
.luk-sidebar__search .luk-sidebar__search-trigger.fs-trigger-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 12px 16px;
    font: inherit; font-size: inherit; text-align: left;
}

.luk-sidebar__search-form {
    display: flex; align-items: stretch; gap: 0;
    padding: 8px 12px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.luk-sidebar__search-form[hidden] { display: none; }
.luk-sidebar__search-input {
    flex: 1 1 auto;
    border: 1px solid #1a1a1a; border-right: 0;
    padding: 8px 10px;
    font: inherit; background: #fff; color: inherit;
    min-width: 0;
}
.luk-sidebar__search-input:focus { outline: none; border-color: #000; }
.luk-sidebar__search-submit {
    flex: 0 0 auto; padding: 0 14px;
    background: #1a1a1a; color: #fff; border: 1px solid #1a1a1a;
    cursor: pointer; font: inherit;
}
.luk-sidebar__search-submit:hover,
.luk-sidebar__search-submit:focus-visible {
    background: #fff; color: #000; outline: none;
}

/* ---------- CTA item (przycisk "Zapytaj o ofertę" itp.) ----------
 * Aktywacja: w Wygląd → Menu → Show advanced (Screen Options) → CSS Classes:
 *   wpisz `luk-sidebar-cta` w polu klas wybranego item.
 * Domyślne kolory można nadpisać CSS vars w Dodatkowy CSS:
 *   --luk-sidebar-cta-bg, --luk-sidebar-cta-color, --luk-sidebar-cta-border.
 */
:root {
    --luk-sidebar-cta-bg: #3EE622;
    --luk-sidebar-cta-color: #000;
    --luk-sidebar-cta-border: #3EE622;
}
.luk-sidebar__item.luk-sidebar-cta {
    margin: 12px;
}
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row {
    background: var(--luk-sidebar-cta-bg);
    border: 2px solid var(--luk-sidebar-cta-border);
}
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row .luk-sidebar__link {
    color: var(--luk-sidebar-cta-color);
    font-family: "TT Supermolot Bold", sans-serif !important;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    justify-content: center;
    text-align: center;
}
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row:hover,
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row:focus-within {
    background: #fff;
    border-color: var(--luk-sidebar-cta-border);
}
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row:hover .luk-sidebar__link,
.luk-sidebar__item.luk-sidebar-cta > .luk-sidebar__row:focus-within .luk-sidebar__link {
    color: var(--luk-sidebar-cta-color);
}

/* ---------- Dropdown trigger anchor (lang switcher / url=#) — klik = toggle ---------- */
.luk-sidebar__dropdown-trigger > .luk-sidebar__row > .luk-sidebar__link {
    cursor: pointer;
}

/* ---------- WPML language switcher (injectuje markup w title menu item) ---------- */
.luk-sidebar__label { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.luk-sidebar__label .wpml-ls-flag {
    width: 18px; height: auto;
    display: inline-block; flex: 0 0 auto;
    border: 1px solid #e0e0e0; border-radius: 2px;
    vertical-align: middle;
}
.luk-sidebar__label .wpml-ls-native,
.luk-sidebar__label .wpml-ls-display-as-translated,
.luk-sidebar__label .wpml-ls-link { color: inherit; text-decoration: none; }
/* Niektóre WPML konfiguracje wkładają <a> wewnątrz title — zneutralizuj wpływ na nasz outer <a> */
.luk-sidebar__label a { color: inherit; text-decoration: none; pointer-events: none; }

/* ---------- Desktop: zawsze widoczny fixed sidebar + body offset ---------- */
@media (min-width: 992px) {
    .luk-sidebar__open-btn,
    .luk-sidebar__close-btn,
    .luk-sidebar__backdrop { display: none; }

    .luk-sidebar__panel {
        /* position: fixed odziedziczone z base — sidebar trzyma się x=0,
         * body padding-left robi miejsce na content obok. STICKY nie działa
         * bo respektuje parent padding i sidebar wleciałby na x=280. */
        transform: none;
        box-shadow: none;
        border-right: 1px solid #e5e5e5;
        width: var(--luk-sidebar-width);
    }

    /* Auto-injected sidebar pcha całą stronę o szerokość panelu */
    body.has-luk-sidebar { padding-left: var(--luk-sidebar-width); }

    /* WP admin bar offset (logged-in users) */
    body.has-luk-sidebar.admin-bar .luk-sidebar__panel { top: 32px; }

    /* SEOPress cookie consent bar — przesuwam o szerokość sidebara
     * (default: fixed bottom 100%-width → wleciałoby pod nasz sidebar). */
    body.has-luk-sidebar .seopress-user-consent {
        left: var(--luk-sidebar-width);
        right: 0;
        width: auto;
    }
}
@media (min-width: 992px) and (max-width: 782px) {
    body.has-luk-sidebar.admin-bar .luk-sidebar__panel { top: 46px; }
}
