/**
 * Semtak Delivery Manager - Contact Buttons (Zadzwoń / Zapytaj o produkt)
 *
 * Visually consistent with .stk-delivery-info-box (same palette, radius,
 * typography). Mobile-first. Zero JS in markup (CSP-safe).
 *
 * @package SemtakDelivery
 */

/* === Buttons row (below delivery box) === */
.stk-contact-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0 20px;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.5;
}

@media (min-width: 600px) {
    .stk-contact-buttons {
        flex-direction: row;
    }
}

.stk-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 12px 18px;
    border-radius: 0; /* kwadratowe rogi — spójnie z przyciskiem „Dodaj do koszyka" */
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.stk-contact-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.5;
}

/* Call — primary (green, like stk-status-available) */
.stk-contact-call {
    background: var(--dk-accent, #dc9814);
    border: 1px solid var(--dk-accent, #dc9814);
    color: #fff !important;
}

.stk-contact-call:hover,
.stk-contact-call:focus {
    background: #b87f10;
    border-color: #b87f10;
    color: #fff !important;
    text-decoration: none;
}

/* Ask — secondary: domyślnie wypełnione szare tło, na hover ciemniejsze */
.stk-contact-ask {
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #222;
}

.stk-contact-ask:hover,
.stk-contact-ask:focus {
    background: #e2e2e2;
    border-color: #d1d1d1;
    color: #111;
}

.stk-contact-ask svg {
    color: #E53935;
}

/* === Mobile sticky call bar === */
.stk-sticky-call-bar {
    display: none;
}

@media (max-width: 782px) {
    .stk-sticky-call-bar {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
        box-sizing: border-box;
    }

    .stk-sticky-call-bar .stk-contact-btn {
        width: 100%;
    }

    /* Make room so the bar does not cover footer content */
    body.single-product {
        padding-bottom: 70px;
    }

    /*
     * Coexistence with the theme mobile bottom bar (.igameble-mobile-bottom-bar):
     * theme bar is fixed bottom, height 60px + safe-area, z-index 9998, and sets
     * body.has-mobile-bottom-bar { padding-bottom: calc(60px + env(...)) !important; }.
     * Lift the call bar above it and reserve room for BOTH bars (60 + 70 = 130px).
     */
    body.has-mobile-bottom-bar .stk-sticky-call-bar {
        bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    body.single-product.has-mobile-bottom-bar {
        padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* === Inquiry modal === */

/* Fallback: browsers without <dialog> support render it as a plain block —
   keep it hidden unless actually opened (JS hides the trigger anyway). */
dialog.stk-inquiry-modal:not([open]) {
    display: none;
}

dialog.stk-inquiry-modal {
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

dialog.stk-inquiry-modal::backdrop {
    background: rgba(0, 0, 0, .5);
}

.stk-inquiry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.stk-inquiry-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.stk-inquiry-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
}

.stk-inquiry-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.stk-inquiry-close svg {
    width: 18px;
    height: 18px;
}

/* Override stylu przycisków motywu (button[type=submit] padding 11px 24px) —
   X zamykania ma być kwadratem 32×32, klikalny tylko wokół ikony. */
.stk-inquiry-header .stk-inquiry-close {
    width: 32px;
    height: 32px;
    min-width: 0;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
}

.stk-inquiry-form {
    padding: 16px 20px 20px;
}

.stk-inquiry-field {
    margin: 0 0 12px;
}

.stk-inquiry-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.stk-inquiry-field input,
.stk-inquiry-field textarea,
.stk-inquiry-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
}

.stk-inquiry-field input:focus,
.stk-inquiry-field textarea:focus,
.stk-inquiry-field select:focus {
    outline: none;
    border-color: var(--dk-accent, #dc9814);
    box-shadow: 0 0 0 1px var(--dk-accent, #dc9814);
}

.stk-inquiry-field input[readonly] {
    background: #f9fafb;
    color: #6b7280;
}

.stk-inquiry-hint {
    margin: -6px 0 12px;
    font-size: 12px;
    color: #6b7280;
}

.stk-inquiry-required {
    color: #dc2626;
}

.stk-inquiry-preferred {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.stk-inquiry-preferred legend {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.stk-inquiry-preferred label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

.stk-inquiry-consent {
    margin: 0 0 12px;
}

.stk-inquiry-consent label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
}

.stk-inquiry-consent input {
    margin-top: 2px;
    flex-shrink: 0;
}

.stk-inquiry-consent a {
    color: #E53935;
    text-decoration: underline;
}

/* Honeypot — visually hidden, still focusable for bots that ignore CSS */
.stk-inquiry-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    margin: 0;
}

.stk-inquiry-feedback {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.stk-inquiry-feedback[hidden] {
    display: none;
}

.stk-inquiry-feedback.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.stk-inquiry-feedback.is-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #b87f10;
}

.stk-inquiry-submit {
    width: 100%;
    background: #E53935;
    border: 1px solid #E53935;
    color: #fff;
}

.stk-inquiry-submit:hover,
.stk-inquiry-submit:focus {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

.stk-inquiry-submit[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

/* === Thank-you screen (po udanej wysyłce — oba modale) ===
   JS chowa formularz i pokazuje ten ekran; zamknięcie modala przywraca formularz. */
.stk-inquiry-thanks {
    padding: 28px 24px 24px;
    text-align: center;
}

.stk-inquiry-thanks[hidden],
.stk-inquiry-form[hidden] {
    display: none;
}

.stk-thanks-icon {
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    color: var(--dk-accent, #dc9814);
    stroke-width: 1.5;
}

.stk-thanks-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.stk-thanks-text {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
}

.stk-inquiry-thanks form {
    margin: 0;
}

.stk-thanks-close {
    width: 100%;
    background: var(--dk-accent, #dc9814);
    border: 1px solid var(--dk-accent, #dc9814);
    color: #fff;
}

.stk-thanks-close:hover,
.stk-thanks-close:focus {
    background: #b87f10;
    border-color: #b87f10;
    color: #fff;
}

/* === Callback modal ("Oddzwonimy" — poza godzinami pracy) ===
   Reuses the inquiry modal skin; only the intro message is new. */
.stk-callback-message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    font-size: 13px;
    color: #92400e;
}

/* ============ Raty bankowe (3 logotypy w jednej linii) ============ */
/* Boks rat tuż pod „Dodaj do koszyka" — odstęp równy przerwie boks↔logotypy (14px).
   Motyw daje 60px pustki pod przyciskiem (margin-bottom przycisku 30px + formularza 30px),
   więc ujemny margines domyka ją do 14px (zweryfikowane desktop + mobile). */
.dk-installments { margin-top: -46px; }
.dk-installments__heading { font-size: 13px; color: #555; margin-bottom: 8px; letter-spacing: .02em; }
.dk-installments__row { display: flex; align-items: stretch; gap: 10px; }
.dk-bank { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 10px 12px; border: 1px solid #e6e6e6; background: #fff; transition: border-color .2s, box-shadow .2s; }
a.dk-bank:hover { border-color: var(--dk-accent, #dc9814); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.dk-bank img { display: block; width: 100%; height: 34px; object-fit: contain; }
/* Logo w <picture> chroni przed motywami auto-lightboxującymi obrazki treści (np. szymiga
   content-lightbox.js pomija img.closest('picture')); display:contents = layout bez zmian. */
.dk-bank picture { display: contents; }
.dk-bank__zero { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--dk-accent, #dc9814); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .03em; line-height: 1; padding: 3px 8px; border-radius: 2px; }
@media (max-width: 480px) { .dk-installments__row { flex-wrap: wrap; } .dk-bank { flex: 1 1 40%; } }

/* ============ Symulator rat ============ */
.dk-sim { margin: 4px 0 14px; padding: 12px 14px; background: #faf7f1; border: 1px solid #eee; }
.dk-sim__lead { margin: 0 0 8px; font-size: 15px; color: #222; }
.dk-sim__lead .dk-sim__rate { color: var(--dk-accent, #dc9814); font-size: 19px; font-weight: 700; }
.dk-sim__pick { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 0 8px; }
.dk-sim__select { padding: 6px 8px; border: 1px solid #ddd; background: #fff; font-size: 13px; }
.dk-sim__detail { margin: 0 0 6px; font-size: 13px; color: #444; }
.dk-sim__note { margin: 0; font-size: 11px; color: #8a8a8a; line-height: 1.45; }
.dk-sim__note a { color: var(--dk-accent, #dc9814); }
/* Wstążka „Raty 0%" — prawy górny róg po ukosie */
.dk-bank { overflow: hidden; }
.dk-bank__ribbon { position: absolute; top: 10px; right: -29px; transform: rotate(45deg); background: #da2128; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; line-height: 1; padding: 3px 26px 3px 46px; box-shadow: 0 1px 3px rgb(0 0 0 / .25); pointer-events: none; }
/* Mobile: bank z ratami 0% (ribbon) pierwszy na pelna szerokosc, pozostale 2 w rzedzie lewo-prawo. */
@media (max-width: 480px) {
	.dk-installments__row { flex-wrap: wrap; }
	.dk-installments__row .dk-bank { flex: 1 1 calc(50% - 5px); }
	.dk-installments__row .dk-bank:has(.dk-bank__ribbon) { order: -1; flex: 1 1 100%; }
}

/* ============ Koszyk: przyciski „Oblicz ratę" 3 banków (pod listą produktów) ============ */
.dk-cart-raty { margin: 18px 0 6px; max-width: 640px; }
.dk-cart-raty__heading { font-size: 14px; font-weight: 600; color: #222; margin-bottom: 10px; }
.dk-cart-raty__row { display: flex; align-items: stretch; gap: 10px; }
.dk-bank--calc { flex-direction: column; gap: 8px; padding: 14px 12px 12px; text-decoration: none; }
/* Niektóre motywy (szymiga woo.css) ukrywają linki kalkulator.raty regułą
   `.woocommerce-cart a[href*="kalkulator.raty"]{display:none!important}` (spec. 0,2,1) —
   wymuś pokazanie naszych 3 kart rat w koszyku wyższą specyficznością (0,3,0), parytet z dekort. */
.dk-cart-raty .dk-bank.dk-bank--calc { display: flex !important; }
.dk-bank--calc img { height: 30px; width: auto; max-width: 100%; }
.dk-bank__calc-label { font-size: 13px; font-weight: 600; color: var(--dk-accent, #dc9814); letter-spacing: .02em; white-space: nowrap; }
a.dk-bank--calc:hover .dk-bank__calc-label { text-decoration: underline; }
.dk-cart-raty__note { margin: 10px 0 0; font-size: 11px; color: #8a8a8a; line-height: 1.45; }
.dk-cart-raty__note a { color: var(--dk-accent, #dc9814); }
@media (max-width: 480px) {
	.dk-cart-raty__row { flex-wrap: wrap; }
	.dk-cart-raty__row .dk-bank--calc { flex: 1 1 calc(50% - 5px); }
	.dk-cart-raty__row .dk-bank--calc:has(.dk-bank__ribbon) { order: -1; flex: 1 1 100%; }
}

/* === Odporność na motywy sklepów (wygląd jak wzór dekort-meble.pl) ===
   Niektóre motywy (np. szymiga) agresywnie stylują <img> w treści produktu i rozdmuchują
   logotypy banków oraz gubią ramkę karty. Wymuszamy wygląd karty i rozmiar logo NIEZALEŻNIE
   od motywu: biała karta z subtelną ramką (jak dekort) + logo 34px (PDP) / 30px (koszyk). */
.dk-installments .dk-bank,
.dk-cart-raty .dk-bank--calc {
    border: 1px solid #e6e6e6 !important;
    background: #fff !important;
    overflow: hidden !important;
}
.dk-installments .dk-bank img {
    height: 34px !important;
    max-height: 34px !important;
    width: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 !important;
    display: block !important;
    /* Motywy malują placeholder pod lazy-img (szymiga #f5f1ed, igameble #f5f5f5) —
       object-fit:contain zostawia pasy po bokach i placeholder prześwituje.
       Karta ma być BIAŁA jak na wzorze dekort. */
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}
.dk-cart-raty .dk-bank--calc img {
    height: 30px !important;
    max-height: 30px !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 !important;
    display: block !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
}

/* === Hover jak wzór dekort — odporny na motywy ===
   szymiga (woo.css/utility.css) nadpisuje linki z obrazkiem:
   `a:has(>img|>picture), …:hover { border-color: currentcolor !important; box-shadow: none !important }`
   oraz wymusza transition tylko koloru (springy cubic-bezier) — efekt: ramka „skacze" na kolor
   akcentu linku motywu, cień znika, animacja nie ta. Nasze reguły mają wyższą specyficzność
   (0,3,1 > 0,1,2 przy obu !important), więc wygrywają kaskadę na KAŻDYM motywie.
   Zasada wspólna: płynne .2s podświetlenie ramki kolorem akcentu SKLEPU + delikatny cień. */
.dk-installments a.dk-bank,
.dk-cart-raty a.dk-bank--calc {
    transition: border-color .2s ease, box-shadow .2s ease !important;
    transform: none !important;
}
.dk-installments a.dk-bank:hover,
.dk-installments a.dk-bank:focus-visible,
.dk-cart-raty a.dk-bank--calc:hover,
.dk-cart-raty a.dk-bank--calc:focus-visible {
    border-color: var(--dk-accent, #dc9814) !important;
    box-shadow: 0 2px 10px rgb(0 0 0 / .06) !important;
    background: #fff !important;
    transform: none !important;
    text-decoration: none !important;
}
/* Napis „Oblicz ratę" trzyma akcent sklepu także na hoverze (motywy przebarwiają linki). */
.dk-cart-raty a.dk-bank--calc .dk-bank__calc-label,
.dk-cart-raty a.dk-bank--calc:hover .dk-bank__calc-label {
    color: var(--dk-accent, #dc9814) !important;
}

/* ============ Link „Meble na Raty 0%" (nad logo / nagłówkiem, karta + koszyk) ============ */
.dk-installments__promo,
.dk-cart-raty__promo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--dk-accent, #dc9814);
    text-decoration: none;
}
.dk-installments__promo:hover,
.dk-installments__promo:focus-visible,
.dk-cart-raty__promo:hover,
.dk-cart-raty__promo:focus-visible {
    color: var(--dk-accent, #dc9814);
    text-decoration: underline;
}

/* ============ Kompaktowy wariant boksu rat (jedna linijka) ============ */
.dk-installments__compact {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    align-items: baseline;
    gap: 4px 12px;
    margin: 4px 0 14px;
    padding: 12px 14px;
    background: #faf7f1;
    border: 1px solid #eee;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}
.dk-installments__compact-lead { margin: 0; }
.dk-installments__compact-rate {
    color: var(--dk-accent, #dc9814);
    font-size: 18px;
    font-weight: 700;
}
.dk-installments__compact-term { white-space: nowrap; }
.dk-installments__compact-more {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--dk-accent, #dc9814);
    text-decoration: none;
}
.dk-installments__compact-more:hover,
.dk-installments__compact-more:focus-visible { text-decoration: underline; }
@media (max-width: 480px) {
    .dk-installments__compact-more { margin-left: 0; }
}
