/* ── Floating label fields ── */
/* Shared by the Contact form AND the Project Code lookup form. */
.field {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.field label {
    position: absolute;
    left: 1rem;
    top: 1.15rem;
    font-size: clamp(0.85rem, 0.4vw + 0.6rem, 1rem);
    letter-spacing: 0.02em;
    text-transform: none;
    color: rgba(255, 255, 255, 0.75);
    pointer-events: none;
    transform-origin: left top;
    transition: all 0.2s ease;
    z-index: 1;
}

.field textarea~label {
    top: 1.15rem;
}

.field input:focus~label,
.field input:not(:placeholder-shown)~label,
.field textarea:focus~label,
.field textarea:not(:placeholder-shown)~label,
.field select:focus~label,
.field select:not(:invalid)~label {
    top: 0.4rem;
    left: 1rem;
    transform: scale(0.8);
}

/* ── Generic form field appearance (used by .contact-form, reused by the lookup form) ── */
.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    padding: 1.4rem 1rem 0.6rem 1rem;
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.contact-form textarea {
    resize: vertical;
    min-height: 150px;
    padding-top: 1.6rem;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    border-color: white;
    background: rgba(255, 255, 255, 0.14);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: transparent;
}

.contact-form option {
    color: #111;
}

/* Dropdown arrow — must come AFTER the generic rule above so it isn't wiped out */
.field-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.8rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5l6.5 6 6.5-6' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 14px;
    cursor: pointer;
}

/* ── Phone field: country code selector + phone number (Contact page only) ── */
/* Width/font-size for .country-select are set dynamically by JS (script.js)
   based on screen size, so the closed box always fits its text exactly. */

.phone-input-group {
    display: flex;
    width: 100%;
}

.country-select {
    text-align: center;
    text-align-last: center;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-right: none;

    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;

    background-color: rgba(255, 255, 255, 0.14);
    color: white;
    font: inherit;
    font-weight: 400 !important;
    padding: 0.9rem clamp(0.6rem, 1.2vw, 0.9rem) 0.9rem 0.6rem !important;
    font-size: clamp(1rem, 0.95vw, 1.4rem) !important;
    outline: none;
    cursor: pointer;
    white-space: nowrap;
    /* No overflow/ellipsis — JS sizing means the box always fits its text */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5l6.5 6 6.5-6' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 10px;
    transition: border-color 0.2s ease, background-color 0.2s ease, width 0.2s ease;
}

.country-select:focus {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.2);
}

.country-select option {
    color: #111;
    text-align: left;
}

.field-phone {
    flex: 1 1 auto;
    min-width: 0;
}

.field-phone input {
    border-top-right-radius: 16px !important;
    border-bottom-right-radius: 16px !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    width: 100%;
}

/* ── Form action buttons row (used by Contact form + lookup form) ── */
.form-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(10px, 1.4vw, 16px);
    align-items: center;
}

.form-actions .btn-primary,
.form-actions .btn-ghost {
    min-width: 150px;
    text-align: center;
}

/* ── Tablet fix — iPad portrait & landscape get properly sized form fields ── */
@media (min-width: 481px) and (max-width: 1024px) {
    .contact-form input,
    .contact-form select,
    .contact-form textarea {
        font-size: 17px;
        padding: 1.5rem 1.2rem 0.65rem 1.2rem;
    }

    .field label {
        font-size: 0.95rem;
    }

    .contact-form textarea {
        min-height: 170px;
    }
}