/* =========================================================================
   AUTH — estilo partilhado por login, registo, recuperar e redefinir password.
   Layout split-screen com branding à esquerda e formulário à direita.
   ========================================================================= */
:root {
    --primary: #2E75B6;
    --primary-dark: #1F4E79;
    --accent: #F2A03D;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f7fa;
    color: #212529;
}

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: 1.05fr .95fr; } }

/* ===== Painel esquerdo ===== */
.auth-side {
    display: none;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #5DADE2 100%);
    color: #fff;
    padding: 3rem 3.5rem;
    position: relative;
    overflow: hidden;
}
@media (min-width: 992px) { .auth-side { display: flex; flex-direction: column; } }
.auth-side::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.08) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(242,160,61,.15) 0%, transparent 35%);
    pointer-events: none;
}
.auth-side > * { position: relative; }

.auth-side .marca { display: flex; align-items: center; gap: .75rem; font-size: 1.25rem; font-weight: 600; }
.auth-side .marca .logo-box {
    width: 44px; height: 44px;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}

.auth-side .pitch { margin-top: auto; margin-bottom: 2rem; max-width: 460px; }
.auth-side .pitch h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0 0 .75rem; }
.auth-side .pitch p { opacity: .9; line-height: 1.55; margin: 0; }

.auth-side .features { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.auth-side .features li { display: flex; align-items: center; gap: .65rem; font-size: .95rem; }
.auth-side .features .ico {
    width: 28px; height: 28px; flex-shrink: 0;
    background: rgba(255,255,255,.18); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: .9rem;
}

.auth-side .footer-side { margin-top: 2rem; font-size: .8rem; opacity: .65; }

/* ===== Painel direito (formulário) ===== */
.auth-main {
    display: flex; flex-direction: column; justify-content: center;
    padding: 2.5rem 1.5rem; min-height: 100vh;
}
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; }

.auth-mobile-brand {
    display: flex; align-items: center; gap: .65rem;
    font-weight: 600; color: var(--primary); margin-bottom: 2rem;
}
.auth-mobile-brand .logo-box {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
@media (min-width: 992px) { .auth-mobile-brand { display: none; } }

.auth-card h2 { font-size: 1.65rem; font-weight: 700; color: var(--primary-dark); margin: 0 0 .35rem; }
.auth-card .subtitle { color: #6c757d; margin: 0 0 1.75rem; }

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-weight: 500; font-size: .85rem;
    margin-bottom: .35rem; color: var(--primary-dark);
}
.form-group label .req { color: #dc3545; margin-left: 2px; }
.form-group .hint { font-size: .75rem; color: #6c757d; margin-top: .25rem; display: block; }

.input-wrap { position: relative; }
.input-wrap > .bi {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #adb5bd;
}
.form-control {
    width: 100%;
    padding: .7rem 1rem .7rem 42px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: .95rem;
    background: #fff; color: #212529;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,117,182,.15);
}

/* Grid 2 colunas (para nome/apelido por ex.) */
.form-grid { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }

/* Botão principal */
.btn-auth {
    width: 100%;
    background: var(--primary); color: #fff; border: none;
    padding: .85rem; border-radius: 8px;
    font-size: 1rem; font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .08s;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-auth:hover { background: var(--primary-dark); }
.btn-auth:active { transform: translateY(1px); }
.btn-auth:disabled { opacity: .65; cursor: not-allowed; }
.btn-auth.btn-ghost {
    background: transparent; color: var(--primary);
    border: 1px solid #ced4da; margin-top: .5rem;
}
.btn-auth.btn-ghost:hover { background: #f8f9fa; }

/* Linhas de "ou" */
.divider {
    position: relative; text-align: center; margin: 1.5rem 0;
    color: #adb5bd; font-size: .8rem;
}
.divider::before, .divider::after {
    content: ""; position: absolute; top: 50%; width: 42%;
    border-top: 1px solid #e9ecef;
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

/* Link inferior */
.auth-link {
    text-align: center; font-size: .9rem; color: #495057; margin-top: 1.25rem;
}
.auth-link a { color: var(--primary); font-weight: 500; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

.auth-footer {
    margin-top: 1.5rem; text-align: center; font-size: .75rem; color: #adb5bd;
}
.auth-footer a { color: #6c757d; text-decoration: none; }
.auth-footer a:hover { color: var(--primary); }
.auth-footer .sep { margin: 0 .4rem; }

/* Caixa de alerta */
.alert-box {
    padding: .75rem 1rem; border-radius: 8px;
    font-size: .85rem; margin-bottom: 1rem;
    display: flex; align-items: center; gap: .5rem;
}
.alert-box.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-box.danger  { background: #fef0f0; color: #721c24; border: 1px solid #f5c6cb; }
.alert-box.warning { background: #fff8e1; color: #856404; border: 1px solid #ffe5a0; }
.alert-box.info    { background: #e8f4f8; color: #0c5460; border: 1px solid #bee5eb; }
.alert-box.hidden  { display: none; }

/* Indicador força password */
.pwd-strength { margin-top: .5rem; display: flex; gap: 4px; }
.pwd-strength .bar {
    flex: 1; height: 4px;
    background: #e9ecef; border-radius: 2px;
    transition: background .2s;
}
.pwd-strength .bar.active.weak   { background: #dc3545; }
.pwd-strength .bar.active.medium { background: #ffc107; }
.pwd-strength .bar.active.strong { background: #28a745; }

/* OTP / 2FA caixa */
.otp-box {
    text-align: center;
    background: #f0f7fc;
    border: 1px solid #cfe2f3;
    border-radius: 10px;
    padding: 1rem; margin-bottom: 1.25rem;
    font-size: .85rem; color: var(--primary-dark);
}
.otp-input {
    font-size: 1.6rem; letter-spacing: .35rem;
    text-align: center; font-weight: 700;
    color: var(--primary-dark);
    padding: .65rem 1rem !important;
}

/* Input password com botão olho ao lado (não em overlay) */
.input-group-pwd { display: flex; align-items: stretch; }
.input-group-pwd .input-wrap { flex: 1; }
.input-group-pwd .input-wrap .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}
.input-group-pwd .toggle-pwd-side {
    display: flex; align-items: center; justify-content: center;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #ced4da;
    border-left: 1px solid #e9ecef;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    color: #6c757d;
    cursor: pointer;
    transition: background .15s, color .15s;
    min-width: 46px;
}
.input-group-pwd .toggle-pwd-side:hover { background: #f8f9fa; color: var(--primary); }
.input-group-pwd:focus-within .form-control,
.input-group-pwd:focus-within .toggle-pwd-side { border-color: var(--primary); }
.input-group-pwd:focus-within .form-control { box-shadow: 0 0 0 3px rgba(46,117,182,.15); }

/* Esconder reveal nativo do Edge */
input::-ms-reveal,
input::-ms-clear { display: none !important; }

/* Steps na lateral (registo) */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.steps li { display: flex; gap: .85rem; align-items: start; }
.steps .num {
    width: 32px; height: 32px; flex-shrink: 0;
    background: rgba(255,255,255,.18);
    border-radius: 50%; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.steps strong { display: block; margin-bottom: .15rem; }
.steps small { opacity: .8; line-height: 1.4; }

/* Sucesso pleno (icon grande + mensagem) */
.success-screen {
    text-align: center;
    padding: 1rem;
}
.success-screen .ico-big {
    width: 84px; height: 84px;
    border-radius: 50%;
    background: #d4edda;
    color: #155724;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 3rem;
    margin-bottom: 1.25rem;
}

/* ===== Dark mode automático ===== */
@media (prefers-color-scheme: dark) {
    body { background: #1a1d21; color: #e9ecef; }
    .auth-card h2 { color: #6FB1E8; }
    .form-control { background: #2c3038; color: #e9ecef; border-color: #3a3f47; }
    .form-control:focus { box-shadow: 0 0 0 3px rgba(74,155,217,.25); }
    .auth-mobile-brand { color: #6FB1E8; }
    .divider::before, .divider::after { border-color: #3a3f47; }
    .auth-link, .form-group label { color: #adb5bd; }
    .form-group label { color: #6FB1E8; }
    .alert-box.danger { background: #5a2a30; color: #ffb8c0; border-color: #7a3a40; }
    .alert-box.success { background: #1f4a2f; color: #b8e8c8; border-color: #2f6a47; }
    .alert-box.warning { background: #5a4a1a; color: #ffe5a0; border-color: #7a6a30; }
    .alert-box.info { background: #1a3a52; color: #b8e0ff; border-color: #2a5077; }
    .otp-box { background: #1a3a52; color: #b8e0ff; border-color: #2a5077; }
    .pwd-strength .bar { background: #3a3f47; }
    .input-group-pwd .toggle-pwd-side { background: #2c3038; border-color: #3a3f47; color: #adb5bd; }
    .input-group-pwd .toggle-pwd-side:hover { background: #3a3f47; color: #6FB1E8; }
    .btn-auth.btn-ghost { color: #6FB1E8; border-color: #3a3f47; }
    .btn-auth.btn-ghost:hover { background: #2c3038; }
    .success-screen .ico-big { background: #1f4a2f; color: #b8e8c8; }
}
