/* =====================================================================
   Pasek CTA „Zamów darmową diagnozę" + popup z formularzem.
   Wczytywany globalnie (partials/head.php), bo popup stoi w stopce
   i może go otworzyć przycisk z dowolnej podstrony.
   ===================================================================== */

/* ---------- Pasek na całą szerokość (w miejscu dawnej karuzeli) ---------- */
.diag-bar {
    display: block;
    width: 100%;
    border: 0;
    /* Ten sam kolor co pasek nawigacji. Mięta jest JASNA, więc napis MUSI
       być ciemny — biały dałby na niej 2.09:1. */
    background: var(--accent);
    color: var(--text-on-light);
    padding: 1.15rem 1.5rem;
    text-align: center;
    font-family: var(--font-heading);
    position: relative;
    overflow: hidden;
    /* Delikatne pulsowanie: jasność + poświata. Nie skalujemy paska —
       ruch krawędzi na pełnej szerokości ekranu byłby męczący. */
    animation: diagBarPuls 2.8s ease-in-out infinite;
}

.diag-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.diag-bar-ico {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

.diag-bar-ico svg {
    width: 100%;
    height: 100%;
}

.diag-bar-txt {
    font-size: clamp(1.05rem, 2.2vw, 1.45rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.diag-bar-sub {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    /* Ciemny tekst z lekką przezroczystością — nadal ~7:1 na miętowym tle */
    color: rgba(5, 5, 5, 0.72);
    letter-spacing: 0.3px;
}

.diag-bar-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

.diag-bar:hover .diag-bar-arrow,
.diag-bar:focus-visible .diag-bar-arrow {
    transform: translateX(5px);
}

/* Smuga światła przechodząca przez pasek — dodaje ruchu bez migotania */
.diag-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -30%;
    width: 30%;
    background: transparent;
    transform: skewX(-20deg);
    animation: diagBarSmuga 5.5s ease-in-out infinite;
    pointer-events: none;
}

.diag-bar:hover {
    filter: brightness(1.06);
}

.diag-bar:focus-visible {
    outline: 3px solid var(--text-on-light);
    outline-offset: -6px;
}

@keyframes diagBarPuls {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(168, 213, 178, 0.35);
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 26px 4px rgba(168, 213, 178, 0.28);
        filter: brightness(1.05);
    }
}

@keyframes diagBarSmuga {
    0% {
        left: -30%;
    }

    55%,
    100% {
        left: 115%;
    }
}

/* ---------- Nakładka i okno popupu ---------- */
.diag-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(5, 6, 5, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* Bez tego `display: flex` powyżej wygrywa ze stylem przeglądarki dla
   [hidden] (specyficzność klasy > selektora atrybutu w UA stylesheet)
   i zamknięta nakładka dalej przykrywa stronę, przechwytując kliknięcia. */
.diag-overlay[hidden] {
    display: none;
}

.diag-overlay.is-open {
    opacity: 1;
}

.diag-modal {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: auto;
    background: var(--bg-darker);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transform: translateY(18px) scale(0.98);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.diag-overlay.is-open .diag-modal {
    transform: translateY(0) scale(1);
}

.diag-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    color: var(--text-main);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

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

.diag-close:hover {
    border-color: var(--accent);
    background: rgba(168, 213, 178, 0.12);
    transform: rotate(90deg);
}

/* ---------- Nagłówek ---------- */
.diag-head {
    margin-bottom: 1.75rem;
    padding-right: 3rem;
}

.diag-eyebrow {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.6rem;
}

.diag-head h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    text-transform: uppercase;
    line-height: 1.15;
    margin-bottom: 0.6rem;
}

.diag-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---------- Pola ---------- */
.diag-field {
    margin-bottom: 1.1rem;
    border: 0;
    padding: 0;
}

.diag-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.diag-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    padding: 0;
}

.diag-req {
    color: var(--accent);
}

.diag-form input[type="text"],
.diag-form input[type="tel"],
.diag-form input[type="email"],
.diag-form textarea,
.diag-form select {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-ui);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.98rem;
    padding: 0.8rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.diag-form textarea {
    resize: vertical;
    line-height: 1.6;
}

.diag-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239DA092' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 16px;
    padding-right: 2.6rem;
}

.diag-form input:focus,
.diag-form textarea:focus,
.diag-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(168, 213, 178, 0.18);
}

.diag-form .is-invalid {
    border-color: #E4796B;
    box-shadow: 0 0 0 3px rgba(228, 121, 107, 0.16);
}

/* Honeypot — poza ekranem, niewidoczny także dla czytników */
.diag-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

/* ---------- Kafelki typu zgłoszenia ---------- */
.diag-typy-wrap {
    margin-bottom: 1.4rem;
}

.diag-typy {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
}

.diag-typ {
    display: block;
}

/* Radio zostaje w drzewie (obsługa klawiaturą i czytnikami), ale jest
   niewidoczne — stan pokazuje kafelek. */
.diag-typ input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.diag-typ-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
    padding: 0.85rem 0.4rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.diag-typ-ico {
    width: 26px;
    height: 26px;
    color: var(--accent);
    flex-shrink: 0;
}

.diag-typ-ico svg {
    width: 100%;
    height: 100%;
}

.diag-typ-txt {
    font-size: 0.74rem;
    line-height: 1.3;
    color: var(--text-light);
    font-weight: 500;
}

.diag-typ:hover .diag-typ-box {
    border-color: rgba(168, 213, 178, 0.5);
    transform: translateY(-2px);
}

.diag-typ input:checked+.diag-typ-box {
    background: var(--accent);
    border-color: var(--accent);
}

.diag-typ input:checked+.diag-typ-box .diag-typ-ico,
.diag-typ input:checked+.diag-typ-box .diag-typ-txt {
    color: var(--text-on-light);
    font-weight: 600;
}

.diag-typ input:focus-visible+.diag-typ-box {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Sekcja rozwijana ---------- */
.diag-extra {
    margin: 1.4rem 0;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diag-extra-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.95rem 1.1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 0;
    text-align: left;
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.4;
    transition: background 0.2s ease, color 0.2s ease;
}

.diag-extra-toggle b {
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--accent);
}

.diag-extra-toggle em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.diag-extra-toggle:hover {
    background: rgba(168, 213, 178, 0.07);
}

.diag-extra-chevron {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--accent);
    transition: transform 0.25s ease;
}

.diag-extra-chevron svg {
    width: 100%;
    height: 100%;
}

.diag-extra-toggle[aria-expanded="true"] .diag-extra-chevron {
    transform: rotate(90deg);
}

.diag-extra-panel {
    padding: 1.2rem 1.1rem 0.4rem;
    border-top: 1px dashed var(--border-light);
}

/* ---------- Zgoda, przycisk, status ---------- */
.diag-rodo {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 1.3rem;
}

.diag-rodo input {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.diag-rodo a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.diag-actions {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.diag-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    /* Slate jest CIEMNY, więc napis jasny (6.14:1) */
    background: var(--custom-btn);
    color: var(--text-on-accent);
    border: 0;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 1rem 2.2rem;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.diag-submit:hover:not(:disabled) {
    background: #55757E;
    transform: translateY(-2px);
}

.diag-submit:disabled {
    opacity: 0.6;
}

.diag-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(249, 249, 249, 0.35);
    border-top-color: var(--text-on-accent);
    border-radius: 50%;
    animation: diagSpin 0.7s linear infinite;
}

.diag-form.is-sending .diag-spinner {
    display: block;
}

@keyframes diagSpin {
    to {
        transform: rotate(360deg);
    }
}

.diag-note {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.diag-status {
    margin-top: 1.1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.5;
    display: none;
}

.diag-status.is-error {
    display: block;
    background: rgba(228, 121, 107, 0.12);
    border: 1px solid rgba(228, 121, 107, 0.5);
    color: #F0A99E;
}

.diag-status.is-ok {
    display: block;
    background: rgba(168, 213, 178, 0.12);
    border: 1px solid rgba(168, 213, 178, 0.5);
    color: var(--accent);
}

/* Ekran podziękowania po wysłaniu */
.diag-done {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
}

.diag-done-ico {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(168, 213, 178, 0.14);
    color: var(--accent);
}

.diag-done-ico svg {
    width: 32px;
    height: 32px;
}

.diag-done h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
}

.diag-done p {
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 420px;
    margin: 0 auto;
}

/* Blokada przewijania tła przy otwartym popupie */
body.diag-open {
    overflow: hidden;
}

/* ---------- Tablet ---------- */
@media (max-width: 860px) {
    .diag-typy {
        /* 5 kafelków w rzędzie robi się nieczytelne — 3 + 2 */
        grid-template-columns: repeat(3, 1fr);
    }

    .diag-modal {
        padding: 2rem 1.5rem;
    }
}

/* ---------- Telefon ---------- */
@media (max-width: 560px) {
    .diag-bar {
        padding: 0.95rem 1rem;
    }

    .diag-bar-inner {
        gap: 0.4rem;
    }

    .diag-bar-txt {
        letter-spacing: 1px;
    }

    .diag-bar-sub {
        /* Cały podpis w osobnym wierszu pod hasłem */
        flex-basis: 100%;
        font-size: 0.8rem;
    }

    .diag-overlay {
        padding: 0;
    }

    .diag-modal {
        min-height: 100%;
        max-width: none;
        border-radius: 0;
        border: 0;
        padding: 1.5rem 1.1rem 2.5rem;
    }

    .diag-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .diag-typy {
        grid-template-columns: repeat(2, 1fr);
    }

    .diag-typ-box {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.6rem;
        text-align: left;
        padding: 0.7rem 0.75rem;
    }

    .diag-typ-ico {
        width: 20px;
        height: 20px;
    }

    .diag-typ-txt {
        font-size: 0.78rem;
    }

    .diag-submit {
        width: 100%;
    }

    .diag-actions {
        gap: 0.8rem;
    }

    .diag-note {
        text-align: center;
        width: 100%;
    }
}

/* ---------- Ograniczony ruch ---------- */
@media (prefers-reduced-motion: reduce) {

    .diag-bar,
    .diag-bar::after {
        animation: none;
    }

    .diag-overlay,
    .diag-modal {
        transition: none;
    }

    .diag-spinner {
        animation-duration: 2s;
    }
}
