/* ==========================================================================
   Formularz kontaktowy — etykiety, walidacja, stany wysyłki
   ========================================================================== */

.contact-form .form-field {
    position: relative;
}

.contact-form .form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--secondary-color, #5a6f80);
}

.form-required {
    color: #c0392b;
}

/* Pole ma własny odstęp dopiero pod komunikatem błędu, więc zdejmujemy
   domyślny margines szablonu z samego inputa. */
.contact-form .form-control {
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form .form-control:focus {
    border-color: var(--primary-color, #5bc1ac);
    box-shadow: 0 0 0 3px rgba(91, 193, 172, 0.18);
}

.contact-form .form-field {
    margin-bottom: 16px;
}

/* ------------------------------- Walidacja ------------------------------- */

.contact-form .form-control.is-invalid {
    border-color: #c0392b;
    background-color: #fff6f5;
}

.contact-form .form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.16);
}

.contact-form .form-control.is-valid {
    border-color: rgba(91, 193, 172, 0.55);
}

.form-error {
    display: none;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #c0392b;
}

.form-error.is-visible {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.form-error.is-visible::before {
    content: "!";
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: 2px;
    border-radius: 50%;
    background: #c0392b;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
}

.form-counter {
    margin: 0 0 2px;
    font-size: 0.78rem;
    text-align: right;
    color: var(--p-color, #717275);
}

.form-counter.is-near-limit {
    color: #c0392b;
}

/* --------------------------------- Zgoda --------------------------------- */

.form-consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    align-items: start;
    margin-bottom: 20px;
}

.form-consent input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary-color, #5bc1ac);
    cursor: pointer;
}

.form-consent label {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--p-color, #717275);
    cursor: pointer;
}

.form-consent .form-error {
    grid-column: 1 / -1;
}

/* Pułapka na roboty — niewidoczna dla ludzi, ale obecna w drzewie strony */
.form-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ------------------------------ Przycisk --------------------------------- */

.contact-form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.contact-form button[type="submit"]:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.form-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: form-spin 0.7s linear infinite;
}

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

@keyframes form-spin {
    to { transform: rotate(360deg); }
}

/* ----------------------------- Komunikat zbiorczy ------------------------ */

.form-status {
    display: none;
    margin: 16px 0 0;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.form-status.is-visible {
    display: block;
}

.form-status.is-error {
    background: #fdecea;
    border: 1px solid #f5c6c2;
    color: #922b21;
}

.form-status.is-success {
    background: #eaf7f4;
    border: 1px solid #b8e5da;
    color: #1e6a5a;
}

.form-status a {
    color: inherit;
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    .contact-form .form-control,
    .contact-form button[type="submit"] {
        transition-duration: 0.01ms !important;
    }

    .form-spinner {
        animation: none;
    }
}
