/* Champs de formulaire, alertes, indicateur de chargement. */

.field {
    margin-bottom: var(--sp-5);
}

.field label,
.field legend {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: var(--sp-2);
    color: var(--text);
}

.field .hint {
    font-size: 0.82rem;
    color: var(--text-soft);
    margin-top: 4px;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="search"],
.field textarea,
.field select {
    width: 100%;
    padding: 0.8em 1em;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 1rem;
    /* 16 px minimum : en dessous, iOS zoome automatiquement à la mise au point
       et l'utilisateur se retrouve avec une page décalée. */
    min-height: 44px;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #c7cdc9;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
    border-color: var(--c-green-leaf);
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
    border-color: var(--error);
}

.error-msg {
    display: none;
    color: var(--error);
    font-size: 0.82rem;
    margin-top: 4px;
    font-weight: 600;
}

.field.has-error .error-msg,
.has-error > .error-msg {
    display: block;
}

.field-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
}

.field-check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--brand);
    flex: none;
}

.field-check label {
    font-weight: 400;
}

/* --- Alertes ------------------------------------------------------------- */

.alert {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 0.92rem;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex: none;
    margin-top: 2px;
}

.alert p:last-child {
    margin-bottom: 0;
}

.alert-info {
    background: var(--c-green-pale);
    border-color: #d3e6da;
    color: #123a27;
}

.alert-error {
    background: #fbeceb;
    border-color: #f3cac6;
    color: #7a231c;
}

.alert-success {
    background: var(--c-green-pale);
    border-color: #cfe4d7;
    color: #123a27;
}

/* --- Chargement ---------------------------------------------------------- */

.spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--c-green-deep);
    animation: vlr-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2.4s;
    }
}

/* --- Formulaire de recherche ---------------------------------------------- */

.search-form {
    display: flex;
    gap: var(--sp-2);
    max-width: 480px;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 0.8em 1em;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    min-height: 44px;
}

.search-form button {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-form button svg {
    width: 18px;
    height: 18px;
}
