:root {
    --danger: #e04747;
    --muted: #7a7a7a;
    --glass: rgba(11, 108, 245, 0.06);
}

.form-card {
    background: var(--bg-light);
    padding: var(--spacing-xl);
    border-radius: var(--radius-md);
    max-width: 800px;
    margin: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(12, 20, 40, 0.04);
}
form .row {
    display: flex;
    gap: 12px;
}
form .col {
    flex: 1;
}
label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: #222;
    font-weight: 600;
}
input[type="text"],input[type="tel"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #e6e9ee;
    background: var(--white);
    outline: none;
    font-size: 15px;
    box-sizing: border-box;
    transition:
        box-shadow 0.18s,
        border-color 0.18s;
}
input[type="text"]:focus,
textarea:focus {
    box-shadow: 0 6px 18px rgba(11, 108, 245, 0.06);
    border-color: var(--primary-blue);
}
textarea {
    min-height: 90px;
    resize: vertical;
    font-family: inherit;
}

.field {
    margin-bottom: 16px;
    position: relative;
}

/* error */
.field.invalid input,
            .field.invalid textarea,
            /* make the visible custom select look invalid by targeting its .selected box */
            .field.invalid .custom-select,
            .field.invalid .custom-select .selected {
    border-color: var(--danger) !important;
    box-shadow: 0 6px 18px rgba(224, 71, 71, 0.06);
}
/* color the label/arrow inside the custom select when invalid */
.field.invalid .custom-select .selected {
    color: var(--danger);
}
.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 6px;
}

/* --- Custom Select styles --- */
.custom-select {
    position: relative;
    user-select: none;
    cursor: pointer;
}
.custom-select .selected {
    outline: none;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #e6e9ee;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    transition:
        border-color 0.18s,
        box-shadow 0.18s;
}
.custom-select .selected .label {
    font-size: 15px;
}
.custom-select .arrow {
    width: 20px;
    height: 20px;
    display: inline-block;
    transition: transform 0.25s ease;
}
.custom-select.open .arrow {
    transform: rotate(180deg);
}
.custom-select .options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--radius-sm);
    overflow: hidden; /* escondido por padrão */
    box-shadow: 0 10px 30px rgba(12, 20, 40, 0.08);
    border: 1px solid rgba(12, 20, 40, 0.05);
    z-index: 50;
    max-height: 0;
    transition:
        max-height 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
        opacity 0.18s,
        transform 0.18s;
    opacity: 0;
    padding: 8px; /* mantido sempre para evitar 'salto' durante a animação */
    box-sizing: border-box;
}
/* if there's more space above, open the options upwards */
.custom-select.up .options {
    /* place options above the .selected box */
    bottom: calc(100% + 8px);
    top: auto;
}
.custom-select.open .options {
    opacity: 1;
}
.option {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin: 4px 0;
    cursor: pointer;
    font-size: 15px;
    color: #222;
}
.option:hover {
    background: var(--glass);
}
.option.selected {
    background: rgba(11, 108, 245, 0.06);
    font-weight: 700;
}
/* focused item for keyboard navigation */
.option.focused {
    background: rgba(11, 108, 245, 0.06);
    outline: 2px solid rgba(11, 108, 245, 0.12);
}

/* submit */
.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
button[type="button"] {
    font-family: inherit;
    min-width: max-content;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 0;
    background: var(--primary-blue);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

button[type="submit"]:hover {
    background-color: var(--primary-hover);
}
.note {
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 600px) {
    .form-card {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 490px) {
    .form-card {
        padding: var(--spacing-md);
    }

    .actions {
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }
}
