:root {
    --field-bg: rgba(255, 255, 255, 0.03);
    --field-bg-hover: rgba(255, 255, 255, 0.05);
    --field-border: rgba(155, 169, 192, 0.16);
    --field-border-hover: rgba(155, 169, 192, 0.28);
    --field-placeholder: rgba(155, 169, 192, 0.45);
    --focus-ring:
        0 0 0 1px var(--brand-1), 0 0 0 5px rgba(var(--brand-1-rgb), 0.16);
    --invalid-ring:
        0 0 0 1px var(--brand-red), 0 0 0 5px rgba(244, 63, 94, 0.14);
}

/* -------------------------------------------------------------------------
   Card shell — the aurora seam is the one signature move, reused everywhere
   ------------------------------------------------------------------------- */
.form-card {
    position: relative;
    background: linear-gradient(160deg, var(--bg-3) 0%, var(--bg-2) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 30px 60px -25px rgba(0, 0, 0, 0.6);
}

.form-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--brand-3),
        var(--brand-1) 45%,
        var(--brand-2)
    );
    opacity: 0.9;
}

/* -------------------------------------------------------------------------
   Field grouping — wrap each label+control pair in .field-group
   (a plain div is fine, this just gives consistent rhythm + focus glow)
   ------------------------------------------------------------------------- */
.field-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.field-group:last-of-type {
    margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   Labels
   ------------------------------------------------------------------------- */
.form-label {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.55rem;
    transition: color 0.2s ease;
}

.field-group:focus-within .form-label {
    color: #fff;
}

/* -------------------------------------------------------------------------
   Inputs, textareas, selects
   ------------------------------------------------------------------------- */
.form-control,
.form-select {
    background-color: var(--field-bg);
    border: 1px solid var(--field-border) !important;
    border-radius: var(--radius-md);
    color: #fff;
    padding: 0.5rem .75rem;
    font-size: 0.95rem;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.form-control::placeholder {
    color: var(--field-placeholder);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--field-border-hover);
    background-color: var(--field-bg-hover);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--field-bg-hover);
    border-color: var(--brand-1);
    box-shadow: var(--focus-ring);
    color: #fff;
    outline: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 130px;
    line-height: 1.55;
}

/* Custom select arrow, themed to the palette, no JS needed */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    /* background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ba9c0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); */
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 8px;
    padding-right: 2.75rem;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234590C9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-select option {
    background-color: var(--bg-2);
    color: #fff;
}

/* Validation states — driven purely by native :invalid/:valid so no JS is needed */
.form-control:not(:placeholder-shown):invalid,
.form-select:invalid:not(:has(option:checked[value=""])) {
    border-color: rgba(244, 63, 94, 0.45);
}

.form-control:not(:placeholder-shown):invalid:focus,
.form-select:focus:invalid:not(:has(option:checked[value=""])) {
    border-color: var(--brand-red);
    box-shadow: var(--invalid-ring);
}

.form-control:not(:placeholder-shown):valid {
    border-color: rgba(16, 185, 129, 0.35);
}

.invalid-feedback {
    color: var(--brand-red);
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

/* -------------------------------------------------------------------------
   Checkboxes / radios (for reuse on other forms)
   ------------------------------------------------------------------------- */
.form-check-input {
    background-color: var(--field-bg);
    border: 1px solid var(--field-border-hover);
    width: 1.15em;
    height: 1.15em;
    margin-top: 0.2em;
}

.form-check-input:checked {
    background-color: var(--brand-1);
    border-color: var(--brand-1);
}

.form-check-input:focus {
    border-color: var(--brand-1);
    box-shadow: var(--focus-ring);
}

.form-check-label {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-footnote {
    color: var(--text-primary);
    font-size: 0.82rem;
}

.form-footnote a {
    color: var(--brand-1);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--brand-1-rgb), 0.35);
    transition:
        border-color 0.18s ease,
        color 0.18s ease;
}

.form-footnote a:hover {
    color: #fff;
    border-color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .form-control,
    .form-select,
    .btn-primary,
    .form-label {
        transition: none;
    }
}

.input-group {
    .input-group-text {
        background-color: var(--bg-2);
        border: 1px solid var(--bg-4);
    }
}

