/*
 * quote-request.css — globalny popup "Zapytaj o oferte".
 *
 * Samowystarczalny: modal renderowany jest na KAZDEJ stronie, a forms.css /
 * logowanie.css laduja sie tylko na wybranych szablonach, wiec wszystkie style
 * formularza (.form-row, inputy, przycisk, komunikaty) sa tu zdefiniowane
 * w zasiegu .atfpro-quote-modal. Kolory przez zmienne --theme-* (dark/light).
 */

/* ===== Przycisk CTA "Zapytaj o ofertę" =====
 * Stylowany globalnie (CSS ładowany na każdej stronie), bo klasa hem-btn--blue
 * z home.css NIE jest dostępna na stronach maszyn. Odwzorowuje wygląd
 * hem-btn--blue (#3D76E8 pill). Wszystkie stany jawnie.
 */
.atfpro-quote-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2.25rem;
    font-family: var(--font-base, 'Manrope', sans-serif);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    color: #fff;
    background: #3D76E8;
    border: none;
    border-radius: var(--radius-base, 25px);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.atfpro-quote-trigger:hover,
.atfpro-quote-trigger:focus,
.atfpro-quote-trigger:active,
.atfpro-quote-trigger:focus-visible {
    background: #2d63cc;
    color: #fff;
    outline: none;
}

.atfpro-quote-trigger:hover {
    transform: translateY(-2px);
}

/* ===== Overlay + kontener ===== */
.atfpro-quote-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.atfpro-quote-modal[hidden] {
    display: none;
}

.atfpro-quote-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

body.atfpro-quote-open {
    overflow: hidden;
}

/* ===== Dialog ===== */
.atfpro-quote-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--theme-card-bg, #fff);
    color: var(--theme-text, #212529);
    border: 1px solid var(--theme-border, #dee2e6);
    border-radius: 16px;
    box-shadow: var(--theme-shadow, 0 4px 24px rgba(0, 0, 0, 0.2));
    padding: 32px;
    font-family: var(--font-base, 'Manrope', sans-serif);
}

.atfpro-quote-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--theme-text-secondary, #6c757d);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.atfpro-quote-modal__close:hover,
.atfpro-quote-modal__close:focus {
    background: var(--theme-card-bg-hover, #f1f3f5);
    color: var(--theme-heading, #111);
    outline: none;
}

.atfpro-quote-modal__title {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 700;
    color: var(--theme-heading, #111);
    padding-right: 32px;
}

/* ===== Pola formularza ===== */
.atfpro-quote-modal .form-row {
    margin-bottom: 16px;
}

/* Span pełnej szerokości w układzie grid (desktop) — neutralne poza gridem. */
.atfpro-quote-form .qr-span-2 {
    grid-column: 1 / -1;
}

.atfpro-quote-modal label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-text, #212529);
}

.atfpro-quote-modal .required {
    color: var(--theme-error, #ef4444);
}

.atfpro-quote-modal input[type="email"],
.atfpro-quote-modal input[type="tel"],
.atfpro-quote-modal input[type="text"],
.atfpro-quote-modal select,
.atfpro-quote-modal textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--theme-input-text, #212529);
    background: var(--theme-input-bg, #fff);
    border: 1px solid var(--theme-input-border, #ced4da);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.atfpro-quote-modal textarea {
    resize: vertical;
    min-height: 96px;
}

.atfpro-quote-modal input:focus,
.atfpro-quote-modal select:focus,
.atfpro-quote-modal textarea:focus {
    outline: none;
    border-color: var(--button-apple-blue, #0071e3);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.atfpro-quote-modal input::placeholder,
.atfpro-quote-modal textarea::placeholder {
    color: var(--theme-input-placeholder, #999);
}

/* ===== Checkbox zgody ===== */
.atfpro-quote-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--theme-text-secondary, #495057);
    cursor: pointer;
}

.atfpro-quote-consent-label input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--button-apple-blue, #0071e3);
    cursor: pointer;
}

/* ===== Przycisk submit ===== */
.atfpro-quote-modal .login-button {
    width: 100%;
    padding: 13px 20px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--button-apple-blue, #0071e3);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.atfpro-quote-modal .login-button:hover,
.atfpro-quote-modal .login-button:focus,
.atfpro-quote-modal .login-button:active,
.atfpro-quote-modal .login-button:focus-visible {
    background: var(--button-apple-blue-hover, #0062c4);
    color: #fff;
    outline: none;
}

.atfpro-quote-modal .login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Stany błędu per-pole ===== */
/* Czerwona obwódka na niepoprawnym polu (poza checkboxem zgody — ten ma border na sekcji). */
.atfpro-quote-modal .form-row.has-error input:not([type="checkbox"]),
.atfpro-quote-modal .form-row.has-error select,
.atfpro-quote-modal .form-row.has-error textarea {
    border-color: var(--theme-error, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* Komunikat błędu pod polem. */
.atfpro-quote-field-error {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--theme-error, #ef4444);
}

/* Sekcja zgody z błędem — czerwona obwódka wokół całej klauzuli. */
.atfpro-quote-form__consent.has-error {
    border: 1px solid var(--theme-error, #ef4444);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* ===== Panel sukcesu (zastępuje formularz po wysyłce) ===== */
.atfpro-quote-success {
    text-align: center;
    padding: 16px 8px 8px;
}

.atfpro-quote-success__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.15);
    color: var(--theme-success, #10b981);
}

.atfpro-quote-success__title {
    margin: 0 0 10px;
    font-size: 21px;
    font-weight: 700;
    color: var(--theme-heading, #111);
}

.atfpro-quote-success__text {
    margin: 0 0 22px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--theme-text-secondary, #495057);
}

/* ===== Komunikaty ===== */
.atfpro-quote-modal .form-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.atfpro-quote-modal .form-message.success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--theme-success, #10b981);
    border: 1px solid var(--theme-success, #10b981);
}

.atfpro-quote-modal .form-message.error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--theme-error, #ef4444);
    border: 1px solid var(--theme-error, #ef4444);
}

/* ===== Responsywnosc ===== */

/* Desktop: dwukolumnowy grid + szerszy dialog, zeby content zmiescil sie
 * w pionie bez scrolla. Krotkie pola (selecty, email, tel) ida w 2 kolumny,
 * wysokie/szerokie (textarea, zgody RODO, submit, komunikat) span pelnej
 * szerokosci przez klase .qr-span-2. Gap zastepuje margin-bottom .form-row. */
@media (min-width: 640px) {
    .atfpro-quote-modal__dialog {
        max-width: 760px;
        padding: 26px 30px;
    }

    /* Mniejszy odstep pod tytulem — odzyskuje wysokosc na desktopie. */
    .atfpro-quote-modal__title {
        margin-bottom: 16px;
    }

    .atfpro-quote-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 20px;
        row-gap: 14px;
        align-items: start;
    }

    /* Gap kontroluje odstepy w gridzie — zerujemy margin pol. */
    .atfpro-quote-form .form-row {
        margin-bottom: 0;
    }

    /* Nizsza textarea na desktopie — i tak rozszerzalna w pionie (resize). */
    .atfpro-quote-modal__dialog .atfpro-quote-form textarea {
        min-height: 84px;
    }
}

/* Mobile: dialog pozostaje jednokolumnowy (form bez gridu). */
@media (max-width: 560px) {
    .atfpro-quote-modal__dialog {
        padding: 24px 20px;
        border-radius: 12px;
    }
    .atfpro-quote-modal__title {
        font-size: 20px;
    }
}

/* ============================================================
   Tryby produktowe: lista pozycji (adaptery / czesci zamienne)
   + podsumowanie wyboru + wariant modala dla niezalogowanego
   + info o odbiorcy Ravenol DE.
   Zmienne motywu z fallbackiem — modal jest samowystarczalny.
   ============================================================ */

.atfpro-quote-items {
    border: 1px solid var(--theme-border, #dee2e6);
    border-radius: 8px;
    background: var(--theme-input-bg, transparent);
}

.atfpro-quote-items__summary {
    cursor: pointer;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--theme-text-secondary, #6c757d);
    user-select: none;
}

.atfpro-quote-items__filter {
    display: block;
    width: calc(100% - 28px);
    margin: 0 14px 10px;
}

/* Lista przewijana — katalog adapterow potrafi miec kilkadziesiat pozycji,
   a modal nie moze rosnac poza ekran. */
.atfpro-quote-items__list {
    max-height: 190px;
    overflow-y: auto;
    padding: 0 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.atfpro-quote-items__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--theme-text, #212529);
    cursor: pointer;
}

.atfpro-quote-items__item input {
    margin-top: 2px;
    flex-shrink: 0;
}

/* Obwodka bledu na calej sekcji listy (brak zaznaczonej pozycji). */
.form-row.has-error .atfpro-quote-items {
    border-color: #dc3545;
}

.atfpro-quote-recipient {
    margin: 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--theme-card-bg-alt, rgba(37, 99, 235, 0.08));
    color: var(--theme-text-secondary, #6c757d);
    font-size: 14px;
}

/* ===== Podsumowanie wyboru nad zwinieta lista pozycji =====
   Lista jest domyslnie zwinieta, wiec to jedyne miejsce pokazujace ILE i KTORE
   pozycje sa wybrane. Chip ma "x" do odznaczenia bez rozwijania katalogu. */
.atfpro-quote-selected {
    margin-bottom: 10px;
}

.atfpro-quote-selected__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-text-secondary, #6c757d);
}

.atfpro-quote-selected.is-empty .atfpro-quote-selected__label {
    font-weight: 400;
    font-style: italic;
}

.atfpro-quote-selected__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.atfpro-quote-selected__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--theme-border, #dee2e6);
    border-radius: 999px;
    background: var(--theme-card-bg-alt, rgba(37, 99, 235, 0.08));
    font-size: 13px;
    line-height: 1.3;
    color: var(--theme-text, #212529);
}

/* Wszystkie stany jawnie. */
.atfpro-quote-selected__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--theme-text-secondary, #6c757d);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.atfpro-quote-selected__remove:hover,
.atfpro-quote-selected__remove:focus,
.atfpro-quote-selected__remove:focus-visible,
.atfpro-quote-selected__remove:active {
    background: var(--theme-border, #dee2e6);
    color: var(--theme-text, #212529);
    outline: none;
}

/* ===== Wariant modala dla niezalogowanego =====
   Ten sam kontener co wersja z formularzem, tylko wezszy — nie ma tu pol,
   wiec siatka dwukolumnowa bylaby pusta w polowie. */
.atfpro-quote-modal--login .atfpro-quote-modal__dialog {
    max-width: 520px;
}

.atfpro-quote-login {
    padding: 8px 0;
    text-align: center;
}

.atfpro-quote-login__title {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.25;
    color: var(--theme-text, #212529);
}

.atfpro-quote-login__text {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--theme-text-secondary, #6c757d);
}

.atfpro-quote-login__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* .login-button jest juz stylowany w zasiegu modala, ale tam jako <button>;
   tu uzywamy <a>, wiec domykamy roznice (inline-flex + brak podkreslenia). */
.atfpro-quote-login__actions .login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 200px;
    text-decoration: none;
}

.atfpro-quote-login__register {
    font-size: 14px;
    color: var(--theme-link, #2563eb);
    text-decoration: underline;
}

.atfpro-quote-login__register:hover,
.atfpro-quote-login__register:focus,
.atfpro-quote-login__register:focus-visible,
.atfpro-quote-login__register:active {
    color: var(--theme-link-hover, #1d4ed8);
}
