/* ──────────────── VARIABLES I RESET ──────────────── */
* {
    box-sizing: border-box;
}

:root {
    --fons-primari: #002d74;
    --text-clar: #fff;
    --text-fosc: #0a2540;
    --accent: #0c5da3;
    --radius: 12px;
    --ombra: 0 10px 30px rgba(0, 0, 0, .2);
}

/* ──────────────── COS GENERAL ──────────────── */
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    color: var(--text-clar);
    background: var(--fons-primari);
}

/* ──────────────── CONTENIDOR ──────────────── */
.left {
    background-color: var(--fons-primari);
    background-image: url('img/fons.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: multiply;
    padding: 2rem 3rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
}

/* ──────────────── TEXT I TÍTOL ──────────────── */
.text {
    text-align: center;
    max-width: 70ch;
    margin-inline: auto;
    font-size: 1rem;
}

.text h1 {
    margin: 0 0 .75em;
    font-weight: 700;
    font-size: 2.25rem;
}

.left p {
    margin: 0;
    font-size: 1.125rem;
}

/* ──────────────── LOGO ──────────────── */
.logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo img {
    width: 14rem;
    height: auto;
    transition: transform .3s ease;
}

.logo img:hover {
    transform: scale(1.02);
}

/* ──────────────── FORMULARI ──────────────── */
.formulari {
    display: grid;
    background-color: rgba(255, 255, 255, .28);
    backdrop-filter: blur(6px);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    gap: 1rem;
    margin: 0 auto;
    width: 100%;
    max-width: 60rem;
    box-shadow: var(--ombra);
}

.formulari form {
    display: grid;
    grid-template-columns: 1fr;
    /* mòbil: una columna */
    gap: .75rem 1rem;
    align-items: center;
    width: 100%;
}

.formulari form .col-eti {
    color: var(--text-clar);
    font-size: 1rem;
    font-weight: 600;
}

/* ──────────────── CAMPS ──────────────── */
.formulari input[type="text"],
.formulari input[type="email"],
.formulari input[type="tel"] {
    width: 100%;
    padding: .65rem .8rem;
    border-radius: 8px;
    border: 0;
    outline: 0;
    background: rgba(255, 255, 255, .97);
    color: var(--text-fosc);
    font-size: 1rem;
}

/* ──────────────── BOTÓ ──────────────── */
.btn-enviar {
    justify-self: start;
    margin-top: .25rem;
    padding: .65rem 1rem;
    background-color: #fff;
    border: 0;
    color: var(--fons-primari);
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color .3s ease, color .3s ease, transform .08s ease, opacity .2s ease;
}

.btn-enviar:hover {
    background-color: var(--fons-primari);
    color: #fff;
}

.btn-enviar:active {
    transform: translateY(1px);
}

.btn-enviar:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ──────────────── DESKTOP/TABLET: 2 columnes (etiqueta + camp) ──────────────── */
@media (min-width:48rem) {
    .formulari form {
        grid-template-columns: fit-content(10.5rem) 1fr;
        column-gap: 1rem;
        row-gap: .75rem;
    }

    .formulari form .col-eti {
        grid-column: 1;
        justify-self: end;
        text-align: right;
        padding-right: .5rem;
        white-space: normal;
    }

    .formulari form>input,
    .formulari form>.btn-enviar {
        grid-column: 2;
        width: 100%;
    }

    .btn-enviar {
        justify-self: stretch;
    }
}

/* ──────────────── ADAPTACIÓ MÒBIL / TABLET ──────────────── */
@media (max-width:64rem) {
    .logo img {
        width: 12rem;
    }

    .left {
        padding: 2rem 1.5rem;
    }

    .formulari {
        padding: 1.25rem 1.5rem;
        margin: 1rem auto;
    }
}

@media (max-width:40rem) {
    .left {
        padding: 1.5rem 1rem;
    }

    .formulari {
        padding: 1rem 1.25rem;
        margin: 1rem auto;
    }
}

@media (max-width:30rem) {
    .left {
        padding: 1rem;
    }

    .logo img {
        width: 10rem;
    }

    .text h1 {
        font-size: 1.75rem;
    }

    .left p,
    .text {
        font-size: .95rem;
    }

    .formulari {
        margin: 1rem auto;
    }

    .btn-enviar {
        font-size: .95rem;
        padding: .6rem .9rem;
    }
}

/* ──────────────── SPINNER ──────────────── */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(255, 255, 255, .8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.amagat {
    display: none;
}

.spinner {
    border: .375rem solid #ccc;
    border-top: .375rem solid var(--accent);
    border-radius: 50%;
    width: 3.75rem;
    height: 3.75rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}








/* ──────────────── CAMPS (select, hora, textarea) ──────────────── */
.formulari select,
.formulari textarea,
.formulari input[type="datetime-local"],
.formulari input[type="time"] {
    width: 100%;
    padding: .65rem 2.25rem .65rem .8rem; /* espai extra a la dreta pel “chevron”/icones */
    border-radius: 8px;
    border: 0;
    outline: 0;
    background: rgba(255, 255, 255, .97);
    color: var(--text-fosc);
    font-size: 1rem;
    line-height: 1.4;
    box-shadow: none;
}

/* Placeholders coherents */
.formulari textarea::placeholder,
.formulari input[type="datetime-local"]::placeholder,
.formulari input[type="time"]::placeholder {
    color: rgba(10, 37, 64, .6);
}

/* Focus accessible i consistent */
.formulari select:focus-visible,
.formulari textarea:focus-visible,
.formulari input[type="datetime-local"]:focus-visible,
.formulari input[type="time"]:focus-visible,
.formulari input[type="text"]:focus-visible {
    box-shadow: 0 0 0 .15rem rgba(12, 93, 163, .35);
}

/* Textarea: alçada mínima i només redimensionar verticalment */
.formulari textarea {
    min-height: 6.5rem;
    resize: vertical;
}

/* Select: aspecte nadiu ocult i “chevron” personalitzat */
.formulari select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%230a2540'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    background-size: 1.1rem;
    cursor: pointer;
}

/* Per a navegadors que mostren botons d’esborrar/indicador en inputs d’hora */
.formulari input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.formulari input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: .85;
    cursor: pointer;
}

/* Estat deshabilitat coherent */
.formulari select:disabled,
.formulari textarea:disabled,
.formulari input[type="datetime-local"]:disabled,
.formulari input[type="time"]:disabled {
    opacity: .7;
    cursor: not-allowed;
}

/* ──────────────── DESKTOP/TABLET: assegurem columna 2 ──────────────── */
@media (min-width:48rem) {
    .formulari form > select,
    .formulari form > textarea,
    .formulari form > input[type="datetime-local"],
    .formulari form > input[type="time"] {
        grid-column: 2;
        width: 100%;
    }
}
