/**
 * Modais de autenticação — paleta, escala tipográfica e alta especificidade (body …).
 */

body .modal.modal-auth {
    /* —— Paleta de texto —— */
    --ma-color-text: #1e2125;
    --ma-color-text-secondary: #495057;
    --ma-color-muted: #6c757d;
    --ma-color-label: #343a40;
    --ma-color-accent: #2e15bb;
    --ma-color-accent-soft: #5b4dbe;
    --ma-color-danger: #b02a37;
    --ma-color-success: #198754;
    --ma-color-border: #ced4da;
    --ma-color-border-light: #e9ecef;

    /* —— Escala tipográfica (px) — ligeiramente mais compacta —— */
    --ma-text-xs: 12px;
    --ma-text-sm: 13px;
    --ma-text-base: 15px;
    --ma-text-md: 16px;
    --ma-text-label: 14px;
    --ma-text-title: 18px;
    --ma-text-title-sm-up: 19px;
    --ma-text-btn: 15px;
    --ma-text-btn-lg: 16px;
    --ma-line-tight: 1.35;
    --ma-line-body: 1.5;

    color: var(--ma-color-text) !important;
    font-size: var(--ma-text-base) !important;
    line-height: var(--ma-line-body) !important;
    -webkit-text-size-adjust: 100%;
}

body .modal.modal-auth .modal-content {
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    border-radius: 0.4rem;
    background: #fff;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-size: var(--ma-text-base) !important;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth .modal-header {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f3f5 100%);
    border-bottom: 1px solid var(--ma-color-border-light);
    padding: 1.15rem 1.5rem;
}

body .modal.modal-auth .modal-header .close {
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    font-size: 24px !important;
    font-weight: 400;
    line-height: 1;
    color: var(--ma-color-muted) !important;
    opacity: 0.85;
}

body .modal.modal-auth .modal-header .close:hover {
    color: var(--ma-color-text) !important;
    opacity: 1;
}

body .modal.modal-auth .modal-header .modal-title,
body .modal.modal-auth h5.modal-title {
    font-family: "Mulish", "Segoe UI", sans-serif !important;
    font-size: var(--ma-text-title) !important;
    font-weight: 700 !important;
    color: var(--ma-color-text) !important;
    line-height: var(--ma-line-tight) !important;
    text-transform: none !important;
    margin: 0 !important;
}

@media (min-width: 576px) {
    body .modal.modal-auth .modal-header .modal-title,
    body .modal.modal-auth h5.modal-title {
        font-size: var(--ma-text-title-sm-up) !important;
    }
}

body .modal.modal-auth .modal-body,
body .modal.modal-auth .modal-footer {
    font-size: var(--ma-text-base) !important;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth .modal-body {
    padding: 1.35rem 1.65rem;
}

body .modal.modal-auth .modal-footer {
    padding: 1.1rem 1.65rem;
    background: #fff;
    border-top: 1px solid var(--ma-color-border-light);
}

body .modal.modal-auth .modal-body p,
body .modal.modal-auth .modal-body li,
body .modal.modal-auth .modal-auth__intro,
body .modal.modal-auth .modal-auth__hint,
body .modal.modal-auth .modal-auth__footer-note {
    font-size: var(--ma-text-base) !important;
    line-height: var(--ma-line-body) !important;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth .modal-auth__steps {
    text-align: left;
    line-height: var(--ma-line-body) !important;
    font-size: var(--ma-text-base) !important;
    color: var(--ma-color-text-secondary) !important;
    padding-left: 1.35rem;
}

body .modal.modal-auth .modal-auth__steps li {
    margin-bottom: 0.45rem;
}

body .modal.modal-auth .modal-auth__steps strong {
    font-weight: 700;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth .text-muted {
    font-size: var(--ma-text-sm) !important;
    color: var(--ma-color-muted) !important;
}

body .modal.modal-auth #resposta_new_password .alert,
body .modal.modal-auth #resposta_new_user .alert {
    font-size: var(--ma-text-sm) !important;
    line-height: 1.45 !important;
}

body .modal.modal-auth .form-group > label,
body .modal.modal-auth label.modal-auth__label {
    position: static !important;
    transform: none !important;
    display: block;
    left: auto;
    top: auto;
    background: transparent !important;
    font-size: var(--ma-text-label) !important;
    font-weight: 600 !important;
    color: var(--ma-color-label) !important;
    margin-bottom: 0.45rem;
    pointer-events: auto;
    letter-spacing: 0.01em;
}

body .modal.modal-auth .form-group {
    position: relative;
    margin-top: 0 !important;
    margin-bottom: 1.1rem;
}

body .modal.modal-auth .form-control {
    font-size: var(--ma-text-md) !important;
    line-height: 1.4 !important;
    min-height: 46px !important;
    height: auto !important;
    padding: 7px 11px !important;
    margin-bottom: 0;
    color: var(--ma-color-text) !important;
    border-color: var(--ma-color-border) !important;
}

body .modal.modal-auth .form-control::placeholder {
    color: #9aa0a6 !important;
    opacity: 1;
}

body .modal.modal-auth .form-control:focus {
    border-color: var(--ma-color-accent) !important;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth select.form-control {
    min-height: 46px !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
    color: var(--ma-color-text) !important;
}

body .modal.modal-auth input[type="date"].form-control {
    min-height: 46px !important;
    padding: 5px 11px !important;
}

body .modal.modal-auth .modal-auth__field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: var(--ma-text-xs) !important;
    color: var(--ma-color-danger) !important;
}

body .modal.modal-auth .modal-auth__feedback {
    margin-top: 0.35rem;
    font-size: var(--ma-text-sm) !important;
    color: var(--ma-color-text-secondary) !important;
}

/* Campo de senha integrado */
body .modal.modal-auth .modal-auth__password-wrap--joined {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: 1px solid var(--ma-color-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body .modal.modal-auth .modal-auth__password-wrap--joined:focus-within {
    border-color: var(--ma-color-accent);
    box-shadow: 0 0 0 0.2rem rgba(46, 21, 187, 0.16);
}

body .modal.modal-auth .modal-auth__password-wrap--joined.modal-auth__password-wrap--invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.18);
}

body .modal.modal-auth .modal-auth__password-wrap--joined.modal-auth__password-wrap--valid {
    border-color: var(--ma-color-success);
    box-shadow: 0 0 0 0.15rem rgba(25, 135, 84, 0.18);
}

body .modal.modal-auth .modal-auth__password-wrap--joined .modal-auth__password-input,
body .modal.modal-auth .modal-auth__password-wrap--joined .form-control {
    flex: 1 1 auto;
    min-width: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: 46px !important;
    font-size: var(--ma-text-md) !important;
    color: var(--ma-color-text) !important;
    padding-right: 11px !important;
    padding-left: 12px !important;
}

body .modal.modal-auth .modal-auth__toggle-password {
    flex: 0 0 46px;
    width: 46px;
    min-width: 46px;
    min-height: 46px;
    align-self: stretch;
    border: none;
    border-left: 1px solid var(--ma-color-border-light);
    background: linear-gradient(180deg, #fafbfc 0%, #f1f3f5 100%);
    color: var(--ma-color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

body .modal.modal-auth .modal-auth__toggle-password:hover {
    background: #e9ecef;
    color: var(--ma-color-accent);
}

body .modal.modal-auth .modal-auth__toggle-password:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(46, 21, 187, 0.4);
    z-index: 2;
}

body .modal.modal-auth .modal-auth__toggle-password:active {
    background: #dee2e6;
}

body .modal.modal-auth .modal-auth__toggle-password i {
    font-size: 16px !important;
    pointer-events: none;
}

body .modal.modal-auth .modal-auth__section-title {
    font-size: var(--ma-text-sm) !important;
    letter-spacing: 0.06em;
    color: var(--ma-color-text-secondary) !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--ma-color-border-light);
}

/* Botões — tamanhos alinhados à escala */
body .modal.modal-auth .btn {
    font-size: var(--ma-text-btn) !important;
    font-weight: 600 !important;
    padding: 9px 16px !important;
    min-height: 42px !important;
    border-radius: 0.35rem;
}

body .modal.modal-auth .btn-lg {
    font-size: var(--ma-text-btn-lg) !important;
    padding: 10px 18px !important;
    min-height: 46px !important;
    line-height: 1.35 !important;
}

body .modal.modal-auth .btn-primary {
    background-color: var(--ma-color-accent) !important;
    border-color: var(--ma-color-accent) !important;
}

body .modal.modal-auth .btn-primary:hover,
body .modal.modal-auth .btn-primary:focus {
    background-color: #2512a0 !important;
    border-color: #2512a0 !important;
}

body .modal.modal-auth .btn-outline-primary {
    color: var(--ma-color-accent) !important;
    border-color: var(--ma-color-accent) !important;
}

body .modal.modal-auth .btn-outline-primary:hover {
    background-color: var(--ma-color-accent) !important;
    border-color: var(--ma-color-accent) !important;
    color: #fff !important;
}

body .modal.modal-auth .btn-block {
    width: 100%;
}

body .modal.modal-auth .modal-auth__actions .btn {
    white-space: normal;
}

body .modal.modal-auth .modal-footer .btn-lg {
    min-width: 9rem;
}

body .modal.modal-auth .modal-auth__btn-close {
    font-size: var(--ma-text-label) !important;
    font-weight: 600 !important;
    min-height: auto !important;
    padding: 8px 0 !important;
    color: var(--ma-color-muted) !important;
}

body .modal.modal-auth .modal-auth__btn-close:hover {
    color: var(--ma-color-accent) !important;
}

body .modal.modal-auth .modal-auth__btn-close .fa {
    font-size: 16px !important;
    margin-right: 0.25rem;
    vertical-align: -0.1em;
}

body .modal.modal-auth .modal-auth__btn-link {
    font-size: var(--ma-text-label) !important;
    font-weight: 600 !important;
    min-height: auto !important;
    line-height: 1.4 !important;
    color: var(--ma-color-accent) !important;
}

body .modal.modal-auth .modal-auth__btn-link:hover {
    color: #2512a0 !important;
}

body .modal.modal-auth .password-status {
    margin-top: 0.55rem;
    font-size: var(--ma-text-sm) !important;
}

body .modal.modal-auth .password-status .alert {
    padding: 10px 12px;
    margin-bottom: 0;
    font-size: var(--ma-text-sm) !important;
    line-height: 1.45 !important;
}

body .modal.modal-auth .modal-auth__login-inner {
    padding: 0;
}

body .modal.modal-auth .text-danger {
    color: var(--ma-color-danger) !important;
}

/*
 * Modal "Criar cadastro": corpo rolável
 */
.modal-auth--cadastro .modal-auth__dialog-cadastro {
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.modal-auth--cadastro.modal-auth .modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.modal-auth--cadastro .modal-header {
    flex-shrink: 0;
}

.modal-auth--cadastro #form_new {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.modal-auth--cadastro #form_new .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal-auth--cadastro #form_new .modal-footer {
    flex-shrink: 0;
}

.modal-auth--cadastro .modal-header {
    border-bottom: 1px solid var(--ma-color-border-light, #e9ecef);
    background: linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);
}

.modal-auth--cadastro .modal-header .modal-title {
    padding-left: 0.65rem;
    border-left: 4px solid #2e15bb;
}

body .modal.modal-auth.modal-auth--cadastro .modal-auth__cadastro-body {
    background: #f9fafb;
}

body .modal.modal-auth.modal-auth--cadastro .modal-auth__senha-bloco {
    background: #f0f2f6;
    border: 1px solid var(--ma-color-border-light, #e9ecef);
    border-radius: 10px;
    padding: 1.15rem 1.25rem 1.35rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

body .modal.modal-auth.modal-auth--cadastro .modal-auth__senha-dica {
    font-size: var(--ma-text-sm) !important;
    line-height: 1.5 !important;
    color: var(--ma-color-muted) !important;
}

body .modal.modal-auth.modal-auth--cadastro .modal-auth__section-title {
    margin-bottom: 0.65rem !important;
}
