/* ==========================================================================
   AL-RIHLA VOYAGES — enquiry form
   --------------------------------------------------------------------------
   Field styling lives here rather than in ContactSection.razor.css so the form
   can be reasoned about as one piece: the markup is in the component, the
   behaviour is in wwwroot/js/site.js, and the appearance is here.
   ========================================================================== */

.form {
    display: flex;
    flex-direction: column;
}

.form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.75rem, 1.2vw, 1.1rem);
}

/* ---------------------------------------------------------------- fields */

.field {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.field__input {
    width: 100%;
    padding: 1.7rem 1.15rem 0.7rem;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0;
    color: var(--white);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color var(--t-fast) var(--ease),
                background-color var(--t-fast) var(--ease);
}

.field__input:hover {
    border-color: rgba(255, 255, 255, 0.26);
}

.field__input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(255, 255, 255, 0.055);
}

.field__textarea {
    min-height: 168px;
    padding-top: 1.9rem;
    resize: vertical;
}

/* -------------------------------------------------------- floating label */

.field__label {
    position: absolute;
    left: 1.15rem;
    top: 1.15rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.42);
    pointer-events: none;
    transform-origin: left top;
    transition: top var(--t-fast) var(--ease),
                font-size var(--t-fast) var(--ease),
                letter-spacing var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
}

/* Inputs carry placeholder=" ", so :placeholder-shown means "still empty". */
.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label {
    top: 0.6rem;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.field__input:focus + .field__label {
    color: var(--gold);
}

/* ------------------------------------------------------------ validation */

.field__error {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: #E5A3A3;
}

.field__input.is-invalid {
    border-color: rgba(229, 163, 163, 0.65);
}

/* Chrome's autofill wash would otherwise repaint the fields pale blue. */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--white);
    -webkit-box-shadow: 0 0 0 1000px #131C31 inset;
    caret-color: var(--white);
    transition: background-color 9999s ease-out;
}

/* --------------------------------------------------------------- actions */

.form__submit {
    width: 100%;
    margin-top: clamp(1rem, 1.8vw, 1.5rem);
    padding-block: 1.25rem;
}

.form__submit[disabled] {
    opacity: 0.7;
    cursor: progress;
    transform: none;
}

.form__spinner {
    width: 14px;
    height: 14px;
    border: 1.5px solid rgba(13, 21, 39, 0.28);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: form-spin 0.7s linear infinite;
}

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

.form__alert {
    margin-top: 1.25rem;
    padding: 0.95rem 1.15rem;
    background: rgba(229, 163, 163, 0.08);
    border-left: 2px solid #E5A3A3;
    font-size: 0.85rem;
    color: #EFC4C4;
}

.form__note {
    margin-top: 1.15rem;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* --------------------------------------------------------- success state */

.thanks {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.15rem;
    padding: clamp(2rem, 4vw, 3.25rem) 0;
    animation: thanks-in 0.7s var(--ease-out) both;
}

.thanks__mark {
    display: block;
    width: 54px;
    height: 54px;
    color: var(--gold);
}

.thanks__mark svg {
    width: 100%;
    height: 100%;
}

.thanks__title {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    color: var(--white);
}

.thanks__text {
    max-width: 40ch;
    font-size: 1rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.66);
}

.thanks__reset {
    margin-top: 0.75rem;
}

@keyframes thanks-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------- queries */

@media (max-width: 680px) {
    .form__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .field__input {
        font-size: 16px; /* stops iOS Safari zooming on focus */
    }

    .field__textarea {
        min-height: 148px;
    }
}
