/*
 * Akcepto v2 – "dokończ wniosek" [alm_complete_application] (szablon complete-application.php;
 * projekt Complete / CompleteMobile / CompleteReturning / CompleteReturningMobile).
 * Pola, zgody i przycisk dziedziczą wygląd formularza (.ak-form w css/form.css), tu tylko różnice.
 * Szablon ma też własne <style> z wtyczki (akordeon, popup, nagłówek) – stąd podwójne klasy i !important.
 */

/* ===== Hero ===== */
.ak-complete .ak-complete-hero {
    padding: 22px 20px 120px;
}

.ak-complete .ak-complete-hero__inner {
    max-width: 860px;
    gap: 30px;
}

.ak-complete .ak-complete-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ak-complete .alm-cta-heading {
    margin: 0 !important;
    font-size: 40px;
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -1.4px;
    text-align: left;
    color: var(--ak-ink);
}

.ak-complete .alm-name-highlight {
    color: var(--ak-orange-text);
}

.ak-complete .ak-nowrap {
    white-space: nowrap;
}

.ak-complete .alm-cta-description {
    margin: 0 !important;
    max-width: 620px;
    font-size: 18px;
    line-height: 1.5;
    text-align: left;
    color: var(--ak-text);
}

.ak-complete .ak-complete-progress {
    max-width: 520px;
    gap: 8px;
}

.ak-complete .ak-complete-progress__track {
    height: 6px;
    border-radius: 3px;
    background: rgba(42, 22, 2, 0.12);
    overflow: hidden;
}

.ak-complete .ak-complete-progress__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--ak-orange);
    transition: width 0.3s ease;
}

/* ===== Karta ===== */
.ak-complete .ak-complete-body {
    max-width: 860px;
    display: block;
}

.ak-complete .ak-complete-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Sekcje (akordeon) ===== */
.ak-complete .alm-accordion-section.alm-accordion-section {
    margin: 0;
    border: 1px solid var(--ak-line);
    border-radius: 18px;
    background: #FFFFFF;
    transition: border-color 0.2s ease;
}

.ak-complete .alm-accordion-section.alm-accordion-section:hover {
    border-color: var(--ak-field);
}

.ak-complete .alm-accordion-section.is-incomplete {
    border: 1.5px solid #F6CF95;
    background: #FFF4E3;
}

.ak-complete .alm-accordion-section.is-incomplete:hover {
    border-color: #F6CF95;
}

.ak-complete .alm-accordion-section.is-incomplete.is-open {
    background: #FFFFFF;
}

.ak-complete .alm-accordion-section .alm-accordion-header {
    min-height: 64px;
    padding: 12px 20px;
    gap: 12px;
    background: transparent !important;
    border: 0 !important;
    color: var(--ak-ink);
}

.ak-complete .alm-accordion-header:focus-visible {
    outline: 3px solid var(--ak-orange);
    outline-offset: -3px;
    border-radius: 18px;
}

.ak-complete .alm-accordion-heading {
    gap: 12px;
}

/* Ikona: zielone kółko z ptaszkiem / pomarańczowa „kropla” z ołówkiem */
.ak-complete .alm-accordion-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ak-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") no-repeat center;
}

.ak-complete .alm-accordion-section.is-incomplete .alm-accordion-status-icon {
    border-radius: 14px 14px 14px 4px;
    background: var(--ak-orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%232E1702' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4z'/%3E%3C/svg%3E") no-repeat center;
}

.ak-complete .alm-accordion-status-icon svg {
    display: none;
}

/* .ak-form ukrywa tytuły kroków (czytniki ekranu), w akordeonie tytuł jest widoczny */
.ak-complete .alm-accordion-header h3.alm-step-title {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    margin: 0 !important;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ak-ink);
}

.ak-complete .alm-accordion-meta {
    gap: 12px;
}

.ak-complete .alm-accordion-status-text {
    font-size: 14px;
    font-weight: 600;
}

.ak-complete .alm-accordion-section.is-complete .alm-accordion-status-text {
    color: #1F7A35;
}

.ak-complete .alm-accordion-section.is-incomplete .alm-accordion-status-text {
    color: #B35C00;
}

.ak-complete .alm-accordion-section.alm-accordion-section .alm-accordion-toggle {
    color: var(--ak-link);
}

.ak-complete .alm-accordion-toggle .alm-chevron {
    width: 18px;
    height: 18px;
}

.ak-complete .alm-accordion-toggle .alm-chevron path {
    stroke-width: 2.4;
}

.ak-complete .alm-accordion-section .alm-accordion-content {
    padding: 8px 20px 22px;
    background: transparent;
}

.ak-complete .alm-accordion-content .alm-form-row {
    gap: 16px;
    margin-bottom: 16px;
}

.ak-complete .alm-accordion-content .alm-form-row:last-child {
    margin-bottom: 0;
}

.ak-complete .alm-accordion-content .alm-form-field {
    flex: 1 1 0;
    min-width: 0;
}

/* Projekt: poprawne pole ma sam zielony border, bez ptaszka */
.ak-complete input.alm-input.is-valid:not(.alm-date-input) {
    padding-right: 16px !important;
    background-image: none;
}

/* ===== Zgody i przycisk ===== */
.ak-complete .ak-complete-card > .alm-form-step {
    margin: 10px 0 0;
}

.ak-complete .ak-complete-card .alm-consent-options {
    margin: 0;
}

.ak-complete .alm-form-navigation {
    margin-top: 8px;
}

.ak-complete .alm-next-step svg {
    margin-left: 10px;
    vertical-align: -4px;
}

/* ===== Popup „Witaj ponownie” ===== */
.ak-complete .ak-ret {
    padding: 16px;
    background: rgba(30, 14, 1, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.ak-complete .ak-ret__dialog {
    position: relative;
    width: 520px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 36px 36px 22px;
    border-radius: 28px;
    background: #FFFFFF;
    box-shadow: 0 30px 80px rgba(122, 61, 0, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    color: var(--ak-ink);
}

.ak-complete .ak-ret__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #FFF6EA;
    color: var(--ak-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    cursor: pointer;
}

.ak-complete .ak-ret__close:hover {
    background: #FFEBD1;
    color: var(--ak-ink);
}

.ak-complete .ak-ret__icon {
    position: relative;
    flex: none;
    width: 72px;
    height: 72px;
    border-radius: 36px 36px 36px 10px;
    background: #FFF1DE;
    color: var(--ak-orange-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ak-complete .ak-ret__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border: 3px solid #FFFFFF;
    border-radius: 50%;
    background: var(--ak-ok);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ak-complete .ak-ret__head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ak-complete .ak-ret__title {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--ak-ink);
}

.ak-complete .ak-ret__title span {
    color: var(--ak-orange-text);
}

.ak-complete .ak-ret__text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #5A4330;
}

/* Ramka zgód: wiersz „Zaznacz wszystkie” + „Pokaż treść zgód” */
.ak-complete .ak-ret__consents {
    align-self: stretch;
    border: 1px solid var(--ak-line);
    border-radius: 16px;
    overflow: hidden;
    text-align: left;
}

.ak-complete .ak-ret__consents:has(+ .ak-ret__error[style*="block"]) {
    border-color: var(--ak-err);
}

.ak-complete #popupConsentsModule {
    cursor: pointer;
    background: var(--ak-cream);
}

.ak-complete .ak-ret .alm-popup-consents {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
}

.ak-complete .ak-ret .alm-popup-consents .alm-consent-header-container > .alm-consent-option {
    margin: 0;
    padding: 14px 16px;
    border: 0;
    background: transparent;
}

.ak-complete .ak-ret__toggle {
    min-height: 48px;
    padding: 12px 16px;
    border-top: 1px solid var(--ak-line);
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ak-link);
    text-decoration: none;
}

.ak-complete .ak-ret__toggle:hover {
    color: #5C2F00;
}

.ak-complete .ak-ret__toggle::after {
    content: '';
    flex: none;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238A4600' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
    transition: transform 0.2s ease;
}

.ak-complete .ak-ret__consents:has(.alm-popup-partners-consents:not([style*="none"])) .ak-ret__toggle::after {
    transform: rotate(180deg);
}

.ak-complete .ak-ret .alm-popup-partners-consents {
    margin: 0 16px 14px;
}

.ak-complete .ak-ret__error {
    align-self: stretch;
    margin-top: -6px;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    text-align: left;
    color: var(--ak-err);
}

.ak-complete .ak-ret__error[style*="block"] {
    display: flex !important;
}

.ak-complete .ak-ret__error::before {
    content: '';
    flex: none;
    width: 15px;
    height: 15px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23B3261E' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16.5v.5'/%3E%3C/svg%3E") no-repeat center;
}

.ak-complete .ak-ret__actions {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ak-complete .ak-ret__send,
.ak-complete .ak-ret__edit {
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    padding: 0 20px;
    cursor: pointer;
}

.ak-complete .ak-ret__send {
    height: 58px;
    gap: 10px;
    border: 0;
    background: var(--ak-orange);
    color: #2E1702;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(255, 159, 10, 0.32);
}

.ak-complete .ak-ret__send svg {
    width: 20px;
    height: 20px;
}

.ak-complete .ak-ret__send:hover,
.ak-complete .ak-ret__send:focus {
    background: #F29400;
    color: #2E1702;
}

.ak-complete .ak-ret__edit {
    height: 52px;
    gap: 8px;
    border: 2px solid #EADBC8;
    background: #FFFFFF;
    color: var(--ak-ink);
    font-size: 16px;
    font-weight: 600;
    box-shadow: none;
}

.ak-complete .ak-ret__edit:hover,
.ak-complete .ak-ret__edit:focus {
    border-color: var(--ak-field);
    background: #FFFBF5;
    color: var(--ak-ink);
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
    .ak-complete .ak-complete-hero {
        padding: 18px 16px 112px;
    }

    .ak-complete .ak-complete-hero__inner {
        gap: 22px;
    }

    .ak-complete .ak-form-logo img {
        height: 48px;
    }

    .ak-complete .alm-cta-heading {
        font-size: 28px;
    }

    .ak-complete .alm-cta-description {
        font-size: 15px;
    }

    .ak-complete .ak-complete-body {
        margin-top: -84px;
        padding: 0 16px 64px;
    }

    .ak-complete .ak-complete-card {
        padding: 16px;
        border-radius: 28px;
    }

    .ak-complete .alm-accordion-section .alm-accordion-header {
        min-height: 60px;
        padding: 12px 14px;
    }

    .ak-complete .alm-accordion-header h3.alm-step-title {
        font-size: 16px;
    }

    /* Status: przy kompletnej sekcji sam ptaszek, przy niekompletnej pigułka „1 pole” (data-ak-short z js/complete.js) */
    .ak-complete .alm-accordion-section.is-complete .alm-accordion-status-text {
        display: none;
    }

    .ak-complete .alm-accordion-section.is-incomplete .alm-accordion-status-text[data-ak-short] {
        font-size: 0;
    }

    .ak-complete .alm-accordion-section.is-incomplete .alm-accordion-status-text[data-ak-short]::after {
        content: attr(data-ak-short);
        display: inline-block;
        padding: 3px 10px;
        border-radius: 999px;
        background: #FFE2B8;
        font-size: 13px;
    }

    .ak-complete .alm-accordion-section .alm-accordion-content {
        padding: 8px 14px 18px;
    }

    .ak-complete .alm-form-navigation .alm-next-step {
        font-size: 17px;
    }

    /* Popup jako arkusz od dołu */
    .ak-complete .ak-ret.ak-ret {
        align-items: flex-end;
        padding: 12px;
    }

    .ak-complete .ak-ret__dialog {
        width: 100%;
        max-height: calc(100vh - 24px);
        padding: 28px 20px 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    }

    .ak-complete .ak-ret__title {
        font-size: 22px;
    }

    .ak-complete .ak-ret__text {
        font-size: 15px;
    }
}

/* JS wtyczki pokazuje komunikat przez style="display: block" – flex, żeby była ikonka jak w formularzu */
.ak-complete .alm-validation-message[style*="block"] {
    display: flex !important;
}
