/* ---------- Przyciski ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: .98rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--green-700); color: #fff; }
.btn--primary:hover { background: var(--green-800); color: #fff; }
.btn--primary:active { background: var(--green-900); }

.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--secondary:hover { border-color: var(--ink); color: var(--ink); }

.btn--ghost { background: transparent; color: var(--ink); padding-inline: 4px; }
.btn--ghost:hover { color: var(--green-700); }
.btn--ghost svg { transition: transform .15s ease; }
.btn--ghost:hover svg { transform: translateX(3px); }

.btn--rape { background: var(--rape-500); color: var(--green-950); }
.btn--rape:hover { background: var(--rape-400); color: var(--green-950); }

.btn--on-dark { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn--on-dark:hover { border-color: #fff; color: #fff; }

.btn--sm { min-height: 38px; padding: 7px 14px; font-size: .92rem; }
.btn--lg { min-height: 52px; padding: 14px 26px; font-size: 1.05rem; }
.btn--block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

/* Link ze strzałką */
.arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    text-decoration: none;
}
.arrow-link::after { content: '→'; transition: transform .15s ease; }
.arrow-link:hover::after { transform: translateX(3px); }

/* ---------- Plakietki ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.badge--ok { background: var(--green-100); color: var(--green-800); }
.badge--draft { background: #ebe6da; color: #5b5647; }
.badge--warn { background: var(--rape-100); color: #6d5410; }
.badge--dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.deadline-chip {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 14px 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    background: var(--surface);
    font-size: .9rem;
    color: var(--ink-soft);
}
.deadline-chip strong { color: var(--ink); font-weight: 600; }
.deadline-chip__date {
    padding: 2px 9px;
    border-radius: 99px;
    background: var(--rape-500);
    color: var(--green-950);
    font-weight: 600;
    font-size: .84rem;
}
/* Na wąskim ekranie tekst się zawija – zaokrąglony prostokąt zamiast owalu z tekstem przy krawędzi. */
@media (max-width: 640px) {
    .deadline-chip { border-radius: 14px; padding: 8px 12px 8px 8px; }
}

/* ---------- Komunikaty ---------- */
.alert {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: .95rem;
    line-height: 1.5;
}
.alert svg { width: 20px; height: 20px; margin-top: 1px; }
.alert--error { background: var(--danger-bg); border-color: #e6c0b3; color: #6f2615; }
.alert--success { background: var(--success-bg); border-color: var(--green-200); color: var(--green-900); }
.alert--info { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.alert + * { margin-top: 24px; }

/* ---------- Formularze ---------- */
.form-stack > * + * { margin-top: 20px; }

.field { display: grid; gap: 7px; }
.field > label,
.field-label {
    font-size: .93rem;
    font-weight: 600;
    color: var(--ink);
}
.field > label[data-optional]::after,
.field-label[data-optional]::after {
    content: ' ' attr(data-optional);
    font-weight: 400;
    color: var(--ink-muted);
}
/* Pole wymagane warunkowo (np. przy wybranym sposobie identyfikacji) – bez dopisku „(opcjonalnie)”. */
.field--required > label[data-optional]::after,
.field--required .field-label[data-optional]::after { content: none; }
.field > label.check { font-weight: 400; color: var(--ink-soft); }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-label-row a { font-size: .88rem; font-weight: 500; }

.input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: #9a9f95; }
.input:hover { border-color: #9d9480; }
.input:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(45, 98, 57, .18); }
textarea.input { min-height: 140px; resize: vertical; }
select.input {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23435046' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.field--invalid .input,
.input[aria-invalid='true'] { border-color: var(--danger); }
/* Pola daty i godziny mają w przeglądarkach minimalną szerokość wewnętrzną – na telefonie wychodziły poza kolumnę filtrów. */
.input:is([type='date'], [type='time'], [type='datetime-local']) { min-width: 0; max-width: 100%; }
.field--invalid .input:focus { box-shadow: 0 0 0 3px rgba(163, 64, 42, .18); }

.field-help { font-size: .87rem; color: var(--ink-muted); }
.field-errors { list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--danger); font-weight: 500; }
.field-errors li { display: flex; gap: 6px; align-items: flex-start; }
.field-errors li::before { content: '!'; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; flex-shrink: 0; }
.form-errors { margin-bottom: 20px; }

.input-group { position: relative; }
.input-group .input { padding-right: 88px; }
.input-group__action {
    position: absolute;
    top: 50%; right: 6px;
    transform: translateY(-50%);
    padding: 6px 10px;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    color: var(--green-700);
}
.input-group__action:hover { background: var(--green-50); }

/* Checkbox */
.check {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    font-size: .93rem;
    line-height: 1.5;
    color: var(--ink-soft);
    cursor: pointer;
}
.check input {
    appearance: none;
    display: grid;
    place-items: center;
    width: 20px; height: 20px;
    margin: 1px 0 0;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.check input::after {
    content: '';
    width: 10px; height: 6px;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 0 2px 2px;
    transform: rotate(-45deg) scale(0);
    transition: transform .1s ease;
}
.check input:checked { background: var(--green-700); border-color: var(--green-700); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible { box-shadow: var(--focus); }
.field--invalid .check input { border-color: var(--danger); }

/* Wybór typu konta (radio jako kafelki) */
.choice-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.choice-cards legend { margin-bottom: 8px; padding: 0; }
.choice-card { position: relative; display: block; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card__body {
    display: grid;
    align-content: start;
    gap: 3px;
    height: 100%;
    padding: 12px 12px 13px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    transition: border-color .15s ease, background-color .15s ease;
}
.choice-card__icon { width: 22px; height: 22px; margin-bottom: 4px; color: var(--ink-muted); }
.choice-card__title { font-size: .93rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.choice-card__desc { font-size: .8rem; line-height: 1.35; color: var(--ink-muted); }
.choice-card:hover .choice-card__body { border-color: #9d9480; }
.choice-card input:checked + .choice-card__body { border-color: var(--green-700); background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green-700); }
.choice-card input:checked + .choice-card__body .choice-card__icon { color: var(--green-700); }
.choice-card input:focus-visible + .choice-card__body { box-shadow: var(--focus); }

@media (max-width: 520px) {
    .choice-cards { grid-template-columns: 1fr; }
    .choice-card__body { grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
    .choice-card__icon { grid-row: span 2; margin: 0; }
}

/* Separator z tekstem */
.divider-text {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .85rem;
    color: var(--ink-muted);
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- FAQ (details/summary) ---------- */
.faq { border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    list-style: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '';
    flex-shrink: 0;
    width: 22px; height: 22px;
    margin-top: 1px;
    background: center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' stroke='%231b231d' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M7 1v12M1 7h12'/%3E%3C/svg%3E");
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--green-700); }
.faq__answer { padding: 0 48px 24px 0; color: var(--ink-soft); max-width: 46rem; }
.faq__answer p + p { margin-top: .8em; }

/* ---------- Tabele treści ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table thead th { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); border-bottom-color: var(--line-strong); }
.data-table tbody th { font-weight: 600; }
.data-table td.example { color: var(--ink-soft); }
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Ikonki pomocnicze ---------- */
.icon-check { width: 18px; height: 18px; color: var(--green-600); }
.icon-dash { width: 18px; height: 18px; color: var(--line-strong); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { position: relative; padding-left: 28px; }
.check-list li + li { margin-top: 10px; }
.check-list li::before {
    content: '';
    position: absolute;
    left: 0; top: .32em;
    width: 16px; height: 16px;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232d6239' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 8.5 3.2 3L13 4.5'/%3E%3C/svg%3E");
}

.btn--ghost.btn--lg { padding-inline: 4px; }

/* ---------- Wysyłanie formularza (assets/form_submit_guard.js) ---------- */
.btn:disabled,
.btn.is-disabled,
.btn[aria-disabled="true"] {
    opacity: .6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Kliknięty przycisk: pełna widoczność + kręcący się spinner przed etykietą. */
.btn.is-loading,
button.is-loading {
    position: relative;
    opacity: 1;
    cursor: progress;
}
.btn.is-loading::before,
button.is-loading:not(.btn)::before {
    content: "";
    flex: none;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: submit-spin .7s linear infinite;
}
button.is-loading:not(.btn)::before { display: inline-block; margin-right: .5em; vertical-align: -.15em; }
.btn.is-loading svg { display: none; }

/* Przesuwający się połysk na klikniętym przycisku. */
.btn.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .22) 50%, transparent 80%);
    background-size: 200% 100%;
    animation: submit-shimmer 1.2s ease-in-out infinite;
    pointer-events: none;
}

/* Cały formularz: wyciszone pola i kursor „w toku”. */
form.is-submitting { cursor: progress; }
form.is-submitting :is(input, select, textarea, label, fieldset) {
    pointer-events: none;
}
form.is-submitting :is(input:not([type="hidden"]), select, textarea) {
    opacity: .65;
    transition: opacity .2s ease;
}

@keyframes submit-spin { to { transform: rotate(360deg); } }
@keyframes submit-shimmer {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

/* Ograniczony ruch: globalna reguła w app.css wyłącza animacje – pokaż statyczny wskaźnik. */
@media (prefers-reduced-motion: reduce) {
    .btn.is-loading::before { border-right-color: currentColor; opacity: .7; }
    .btn.is-loading::after { display: none; }
}

/* ---------- Baner zgody na cookies (partials/_cookie_consent.html.twig) ---------- */
.cookie-consent {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    padding: 0 var(--gutter) var(--gutter);
    pointer-events: none;
}
.cookie-consent[hidden] { display: none; }
.cookie-consent__inner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px;
    max-width: 960px; margin: 0 auto; padding: 18px 22px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-window);
    pointer-events: auto;
}
.cookie-consent__text { flex: 1 1 26rem; }
.cookie-consent__title { margin: 0 0 4px; font-family: var(--font-sans); font-size: 1rem; font-weight: 600; }
.cookie-consent__text p { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.cookie-consent__actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 560px) {
    .cookie-consent__actions { width: 100%; }
    .cookie-consent__actions .btn { flex: 1 1 0; }
}
