/* IBRATISS — telas de autenticação (login, recuperar e redefinir senha) */
:root {
    --ibt-navy: #082642;
    --ibt-navy-700: #0E3A63;
    --ibt-gold: #C7A54E;
    --ibt-gold-dark: #A9873A;
    --ibt-gold-light: #E3CB8A;
    --ibt-gold-text: #8A6A1F;
    --ibt-gold-soft: rgba(199, 165, 78, .16);
    --ibt-ink: #0F1B2A;
    --ibt-muted: #5B6B7F;
    --ibt-line: #EBEEF4;
    --ibt-field: #F8F9FB;
    --ibt-icon: #A7B0C0;
    --ibt-danger: #D9363E;
    --ibt-radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

html, body.ibt-auth {
    height: 100%;
    margin: 0;
}

body.ibt-auth {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ibt-ink);
    background: var(--ibt-navy);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---------- Fundo ---------- */
.ibt-auth-bg {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px 72px;
    overflow: hidden;
    isolation: isolate;
    background: #0A2A4A url("../media/ibratiss/bg-login.svg") center / cover no-repeat;
}

/* símbolo da marca, grande e discreto, preso dentro da tela */
.ibt-auth-bg::after {
    content: "";
    position: absolute;
    z-index: -1;
    right: 4vw;
    bottom: 6vh;
    width: min(26vw, 340px);
    aspect-ratio: 160 / 133;
    background: linear-gradient(135deg, var(--ibt-gold-light), var(--ibt-gold));
    -webkit-mask: url("../media/ibratiss/simbolo.png") no-repeat center / contain;
            mask: url("../media/ibratiss/simbolo.png") no-repeat center / contain;
    opacity: .12;
    pointer-events: none;
}

/* ---------- Card ---------- */
.ibt-auth-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 52px 52px 46px;
    background: #FCFCFD;
    border-radius: 32px;
    box-shadow:
        0 0 0 1px rgba(199, 165, 78, .35),
        0 40px 80px -24px rgba(2, 12, 24, .65),
        0 0 60px -10px rgba(199, 165, 78, .18);
    animation: ibtRise .7s cubic-bezier(.16, 1, .3, 1) both;
}

/* filete dourado no topo do card */
.ibt-auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 64px;
    right: 64px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, transparent, var(--ibt-gold) 25%, var(--ibt-gold-light) 50%, var(--ibt-gold) 75%, transparent);
}

@keyframes ibtRise {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.ibt-auth-head { text-align: center; margin-bottom: 28px; }

.ibt-auth-logo {
    display: block;
    width: 100%;
    max-width: 310px;
    height: auto;
    margin: 0 auto 24px;
}

.ibt-badge {
    display: inline-block;
    margin-bottom: 12px;
    padding: 5px 14px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ibt-gold-text);
    background: var(--ibt-gold-soft);
    border-radius: 8px;
}

.ibt-auth-title {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ibt-ink);
}

.ibt-auth-sub {
    margin: 0;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ibt-muted);
}

/* ---------- Campos ---------- */
.ibt-group { margin-bottom: 18px; }

.ibt-field { position: relative; flex: 1 1 auto; min-width: 0; }

.ibt-field > .ibt-icon {
    position: absolute;
    left: 20px;
    top: 27px;
    transform: translateY(-50%);
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
    color: var(--ibt-icon);
    pointer-events: none;
    z-index: 2;
    transition: color .2s ease;
}

.ibt-field.is-focused > .ibt-icon,
.ibt-field:focus-within > .ibt-icon { color: var(--ibt-gold); }

body.ibt-auth .ibt-field .form-control {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 48px 0 56px;
    font: inherit;
    font-size: .9375rem;
    font-weight: 500;
    color: var(--ibt-ink);
    background: var(--ibt-field);
    border: 2px solid var(--ibt-line);
    border-radius: var(--ibt-radius);
    box-shadow: none;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

body.ibt-auth .ibt-field .form-control::placeholder { color: #9AA4B5; font-weight: 400; }

body.ibt-auth .ibt-field .form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--ibt-gold);
    box-shadow: 0 0 0 4px rgba(199, 165, 78, .14);
}

body.ibt-auth .ibt-field .form-control.is-invalid {
    border-color: var(--ibt-danger);
    background-image: none;
}

body.ibt-auth .ibt-field .invalid-feedback {
    display: block;
    margin: 6px 0 0 6px;
    font-size: .8125rem;
    color: var(--ibt-danger);
}

body.ibt-auth .ibt-field .invalid-feedback br { display: none; }

/* mostrar/ocultar senha */
.ibt-reveal {
    position: absolute;
    right: 8px;
    top: 27px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ibt-icon);
    cursor: pointer;
    z-index: 2;
}

.ibt-reveal:hover { color: var(--ibt-gold-text); background: var(--ibt-gold-soft); }
.ibt-reveal:focus-visible { outline: 2px solid var(--ibt-gold); outline-offset: 1px; }

/* ---------- Hospital: select + botão olho (mesmo padrão do sistema de atendimento) ---------- */
.ibt-select-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.ibt-olho {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--ibt-icon);
    background: var(--ibt-field);
    border: 2px solid var(--ibt-line);
    border-radius: var(--ibt-radius);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.ibt-olho:hover { color: var(--ibt-gold-text); border-color: #DCCB9C; }

.ibt-olho[aria-pressed="true"] {
    color: var(--ibt-gold);
    border-color: var(--ibt-gold);
    background: #fff;
}

.ibt-olho:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(199, 165, 78, .2); }

.ibt-desativado { color: var(--ibt-danger); }
.select2-results__option--highlighted .ibt-desativado { color: #FFB4B8; }

/* ---------- Select2 ---------- */
body.ibt-auth .select2-container { width: 100% !important; }

body.ibt-auth .select2-container--default .select2-selection--single {
    height: 54px;
    display: flex;
    align-items: center;
    background: var(--ibt-field);
    border: 2px solid var(--ibt-line);
    border-radius: var(--ibt-radius);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

body.ibt-auth .select2-container--default.select2-container--open .select2-selection--single,
body.ibt-auth .select2-container--default.select2-container--focus .select2-selection--single {
    background: #fff;
    border-color: var(--ibt-gold);
    box-shadow: 0 0 0 4px rgba(199, 165, 78, .14);
    outline: none;
}

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding: 0 62px 0 56px;
    line-height: 50px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ibt-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9AA4B5;
    font-weight: 400;
}

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 38px;
    margin: 0;
    font-size: 1.15rem;
    color: var(--ibt-icon);
}

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__clear:hover { color: var(--ibt-gold); }

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute;
    top: 0;
    right: 14px;
    height: 100%;
    width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.ibt-auth .select2-container--default .select2-selection--single .select2-selection__arrow b {
    position: static;
    width: 7px;
    height: 7px;
    margin: -4px 0 0;
    border: 0;
    border-right: 2px solid var(--ibt-icon);
    border-bottom: 2px solid var(--ibt-icon);
    transform: rotate(45deg);
    transition: transform .2s ease;
}

body.ibt-auth .select2-container--open .select2-selection--single .select2-selection__arrow b {
    transform: rotate(-135deg);
    margin-top: 4px;
    border-color: var(--ibt-gold);
}

.select2-container--open .select2-dropdown {
    border: 2px solid var(--ibt-line);
    border-radius: var(--ibt-radius);
    box-shadow: 0 18px 40px -12px rgba(2, 12, 24, .35);
    overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
}

.select2-container--open .select2-dropdown--below { margin-top: 6px; }
.select2-container--open .select2-dropdown--above { margin-top: -6px; }

.select2-search--dropdown { padding: 8px; }

.select2-search--dropdown .select2-search__field {
    height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: .875rem;
    border: 2px solid var(--ibt-line) !important;
    border-radius: 10px;
    outline: none;
}

.select2-search--dropdown .select2-search__field:focus { border-color: var(--ibt-gold) !important; }

.select2-results__option { padding: 10px 14px; font-size: .875rem; color: var(--ibt-ink); }

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--ibt-navy);
    color: #fff;
}

.select2-container--default .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background: var(--ibt-gold-soft);
    color: var(--ibt-navy);
}

/* ---------- Lembrar / esqueci ---------- */
.ibt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 4px 24px;
    font-size: .8125rem;
}

.ibt-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ibt-muted);
    cursor: pointer;
    user-select: none;
}

.ibt-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--ibt-gold);
    cursor: pointer;
}

.ibt-link {
    color: var(--ibt-muted);
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: color .2s ease;
}

.ibt-link:hover { color: var(--ibt-gold-text); }
.ibt-link:focus-visible { outline: 2px solid var(--ibt-gold); outline-offset: 2px; }

/* ---------- Botões ---------- */
.ibt-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 54px;
    padding: 0 22px;
    font: inherit;
    font-size: .9375rem;
    font-weight: 700;
    border: 0;
    border-radius: var(--ibt-radius);
    cursor: pointer;
    text-decoration: none;
    transition: transform .25s ease, box-shadow .25s ease, background-color .2s ease, color .2s ease;
}

.ibt-btn-primary {
    width: 100%;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ibt-navy);
    background: linear-gradient(135deg, var(--ibt-gold-light) 0%, var(--ibt-gold) 45%, var(--ibt-gold-dark) 100%);
    box-shadow: 0 12px 24px -8px rgba(199, 165, 78, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.ibt-btn-primary:hover {
    color: var(--ibt-navy);
    transform: translateY(-2px);
    box-shadow: 0 18px 30px -10px rgba(199, 165, 78, .7), inset 0 1px 0 rgba(255, 255, 255, .45);
}

.ibt-btn-primary:active { transform: translateY(0); }
.ibt-btn:focus-visible { outline: 3px solid rgba(8, 38, 66, .45); outline-offset: 2px; }
.ibt-btn-primary[disabled] { opacity: .7; cursor: progress; transform: none; }

.ibt-btn-ghost {
    color: var(--ibt-navy);
    background: var(--ibt-field);
    border: 2px solid var(--ibt-line);
}

.ibt-btn-ghost:hover { color: var(--ibt-gold-text); border-color: #DCCB9C; }

.ibt-actions {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    margin-top: 6px;
}

.ibt-actions .ibt-btn-primary { width: auto; }

.ibt-alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    font-size: .875rem;
    color: #9B1C22;
    background: #FFF1F2;
    border: 1px solid #FECDD3;
    border-radius: var(--ibt-radius);
}

/* ---------- Rodapé ---------- */
.ibt-auth-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 24px;
    font-size: .75rem;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .6);
    text-align: center;
}

.ibt-auth-foot strong { color: rgba(255, 255, 255, .85); font-weight: 600; }
.ibt-auth-foot .ibt-dot { color: var(--ibt-gold); margin: 0 6px; }

/* ---------- SweetAlert2 ---------- */
body.ibt-auth .swal2-popup { border-radius: 20px; font-family: 'Inter', system-ui, sans-serif; }
body.ibt-auth .swal2-styled.swal2-confirm {
    color: var(--ibt-navy) !important;
    background: var(--ibt-gold) !important;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: none !important;
}

/* ---------- Responsivo / acessibilidade ---------- */
@media (max-width: 480px) {
    .ibt-auth-card { padding: 34px 22px 28px; border-radius: 26px; }
    .ibt-auth-card::before { left: 40px; right: 40px; }
    .ibt-auth-logo { max-width: 240px; }
    .ibt-auth-bg::after { display: none; }
}

@media (max-height: 760px) {
    .ibt-auth-bg { padding-bottom: 24px; }
    .ibt-auth-foot { position: static; margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .ibt-auth-card { animation: none; }
    .ibt-btn { transition: none; }
    .ibt-btn-primary:hover { transform: none; }
}
