/* Auth Pages — Light theme aligned with the dashboard */

:root {
    --auth-bg:          #f3f4f6;
    --auth-card-bg:     #ffffff;
    --auth-border:      #e5e7eb;
    --auth-text:        #1f2937;
    --auth-text-muted:  #6b7280;
    --auth-primary:     #3b82f6;
    --auth-primary-hov: #2563eb;
    --auth-danger-bg:   #fef2f2;
    --auth-danger-text: #dc2626;
    --auth-danger-bdr:  #fca5a5;
    --auth-success-bg:  #f0fdf4;
    --auth-success-txt: #16a34a;
    --auth-success-bdr: #86efac;
    --auth-radius:      10px;
    --auth-font:        "DM Sans", "Roboto", system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--auth-font);
    background-color: var(--auth-bg);
    color: var(--auth-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* ── Card ────────────────────────────────────────────── */
.login-container,
.register-container {
    width: 100%;
    max-width: 440px;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08);
    animation: fadeInUp .3s ease-out;
}

.register-container { max-width: 600px; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ────────────────────────────────────────────── */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 1.75rem;
    text-decoration: none;
}

.auth-logo img {
    height: 36px;
    width: auto;
}

.auth-logo span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -.02em;
}

/* ── Header ──────────────────────────────────────────── */
.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--auth-text);
    margin-bottom: .35rem;
}

.login-header p {
    color: var(--auth-text-muted);
    font-size: .9rem;
}

/* ── Divider ─────────────────────────────────────────── */
.auth-divider {
    border: none;
    border-top: 1px solid var(--auth-border);
    margin: 1.5rem 0;
}

/* ── Form elements ───────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label,
label {
    display: block;
    margin-bottom: .4rem;
    font-size: .85rem;
    font-weight: 500;
    color: var(--auth-text-muted);
}

.form-control {
    width: 100%;
    padding: .65rem .9rem;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    color: var(--auth-text);
    font-size: .95rem;
    font-family: var(--auth-font);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-control::placeholder { color: #9ca3af; }

/* floating-label compatibility (form-floating Bootstrap pattern) */
.form-floating > .form-control { padding-top: 1.375rem; padding-bottom: .375rem; }
.form-floating > label {
    position: absolute;
    top: 0; left: 0;
    padding: 1rem .9rem;
    pointer-events: none;
    transform-origin: 0 0;
    transition: opacity .1s ease-in-out, transform .1s ease-in-out;
    color: #9ca3af;
    font-size: .95rem;
    font-weight: 400;
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: .65;
    transform: scale(.85) translateY(-.5rem);
    color: var(--auth-primary);
}
.form-floating { position: relative; }

/* ── Validation ──────────────────────────────────────── */
.form-control.invalid {
    border-color: var(--auth-danger-text);
    background-color: var(--auth-danger-bg);
}
.form-control.invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: .7rem 1.25rem;
    border-radius: var(--auth-radius);
    font-size: .95rem;
    font-weight: 600;
    font-family: var(--auth-font);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, box-shadow .15s, transform .1s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: var(--auth-primary);
    color: #fff;
    border-color: var(--auth-primary);
    box-shadow: 0 1px 2px rgba(59,130,246,.3);
}

.btn-primary:hover {
    background: var(--auth-primary-hov);
    border-color: var(--auth-primary-hov);
    box-shadow: 0 4px 12px rgba(59,130,246,.25);
}

.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    background: transparent;
    border-color: var(--auth-border);
    color: var(--auth-text-muted);
}

.btn-secondary:hover {
    background: var(--auth-bg);
    color: var(--auth-text);
}

/* ── Links ───────────────────────────────────────────── */
.forgot-password,
.login-link a,
.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: .875rem;
    transition: color .15s;
}

.forgot-password:hover,
.login-link a:hover,
.auth-link:hover {
    color: var(--auth-primary-hov);
    text-decoration: underline;
}

.forgot-password { display: block; text-align: right; margin-top: .35rem; }

.login-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--auth-text-muted);
    font-size: .875rem;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--auth-radius);
    margin-bottom: 1.25rem;
    font-size: .875rem;
    border: 1px solid transparent;
}

.alert-danger, .alert-error {
    background: var(--auth-danger-bg);
    color: var(--auth-danger-text);
    border-color: var(--auth-danger-bdr);
}

.alert-success {
    background: var(--auth-success-bg);
    color: var(--auth-success-txt);
    border-color: var(--auth-success-bdr);
}

/* ── Register Wizard ─────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 1.75rem;
    gap: .5rem;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--auth-border);
    transition: all .25s ease;
}

.step-dot.active   { background-color: var(--auth-primary); transform: scale(1.3); }
.step-dot.completed { background-color: #93c5fd; }

.form-step { display: none; animation: fadeIn .3s ease; }
.form-step.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.wizard-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.75rem;
}

.wizard-buttons button { flex: 1; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 1rem 0;
    color: var(--auth-text-muted);
    font-size: .875rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--auth-primary);
    flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .login-container,
    .register-container { padding: 1.75rem 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
}

/* Cadastro em um ecrã */
.signup-container { max-width: 440px; }
.form-select {
    padding-right: 2.4rem; cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right .9rem center; background-size: 14px 10px;
}
.signup-submit { width: 100%; margin-top: .25rem; }
.signup-terms { margin: .75rem 0 0; font-size: .82rem; text-align: center; color: var(--auth-text-muted); }
.signup-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-container .errorlist { margin: .35rem 0 0; padding: 0; list-style: none; font-size: .85rem; color: var(--auth-danger-text); }
.signup-correct { margin-top: 1rem; }
.signup-correct summary { text-align: center; font-size: .9rem; color: var(--auth-primary-hov); cursor: pointer; }
.signup-correct form { margin-top: 1rem; }

/* ── Registo em dois passos ──────────────────────────── */
.signup-page { display: block; padding: 0; }
.signup-layout { min-height: 100vh; display: flex; }
.signup-main {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.signup-aside { display: none; }

@media (min-width: 992px) {
    .signup-aside {
        flex: 0 0 42%; max-width: 560px;
        display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
        padding: 3rem 3.5rem;
        color: #fff;
        background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    }
    .signup-main { padding: 3rem 2rem; }
    .signup-main .auth-logo { display: none; }
}

.signup-aside__logo { display: inline-flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-size: 1.35rem; font-weight: 700; }
.signup-aside__logo img { width: 36px; height: 36px; padding: 4px; border-radius: 10px; background: #fff; }
.signup-aside__pitch h1 { margin: 0 0 1.5rem; font-size: clamp(1.8rem, 2.6vw, 2.4rem); line-height: 1.15; font-weight: 700; color: #fff; }
.signup-aside__benefits { list-style: none; display: grid; gap: .9rem; }
.signup-aside__benefits li { position: relative; padding-left: 2rem; font-size: 1.05rem; color: rgba(255, 255, 255, .92); }
.signup-aside__benefits li::before {
    content: ""; position: absolute; left: 0; top: .2rem;
    width: 1.3rem; height: 1.3rem; border-radius: 50%;
    background: rgba(255, 255, 255, .2) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='m4 8.5 2.5 2.5L12 5.5'/%3e%3c/svg%3e") center / .8rem no-repeat;
}
.signup-aside__help { font-size: .95rem; color: rgba(255, 255, 255, .85); }
.signup-aside__help a { color: #fff; font-weight: 600; }

/* Barra de progresso (só com JavaScript) */
.signup-progress { margin: 0 0 1.25rem; }
.signup-progress__label { margin: 0 0 .4rem; font-size: .82rem; font-weight: 600; color: var(--auth-text-muted); }
.signup-progress__track { height: 6px; border-radius: 999px; background: var(--auth-border); overflow: hidden; }
.signup-progress__bar { display: block; height: 100%; width: 50%; border-radius: inherit; background: var(--auth-primary); transition: width .25s ease; }
.signup-progress__track[aria-valuenow="100"] .signup-progress__bar { width: 100%; }

/* Passos */
.signup-step + .signup-step { margin-top: 1.75rem; }
.js-steps .signup-step + .signup-step { margin-top: 0; }
.signup-step[hidden] { display: none; }
.signup-step__title { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 700; color: var(--auth-text); }
.js-steps .signup-step__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Planos numa linha cada */
.signup-plans { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
.signup-plans legend { padding: 0; }
.signup-plans__help { margin: 0 0 .5rem; font-size: .82rem; color: var(--auth-text-muted); }
.signup-plan { position: relative; display: block; margin: 0 0 .4rem; cursor: pointer; }
.signup-plan input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.signup-plan__body {
    display: grid; grid-template-columns: 1fr auto; gap: 0 .75rem; align-items: baseline;
    padding: .55rem .8rem;
    background: var(--auth-card-bg); border: 1px solid var(--auth-border); border-radius: var(--auth-radius);
    transition: border-color .15s, background .15s;
}
.signup-plan__name { font-weight: 700; color: var(--auth-text); }
.signup-plan__price { font-size: .88rem; font-weight: 600; color: var(--auth-text); }
.signup-plan__summary { grid-column: 1 / -1; font-size: .8rem; color: var(--auth-text-muted); }
.signup-plan:hover .signup-plan__body { border-color: #93c5fd; }
.signup-plan input:checked + .signup-plan__body { background: #eff6ff; border-color: var(--auth-primary); box-shadow: inset 0 0 0 1px var(--auth-primary); }
.signup-plan input:focus-visible + .signup-plan__body { outline: 2px solid var(--auth-primary); outline-offset: 2px; }

/* Telefone com +258 */
.signup-phone { display: flex; }
.signup-prefix {
    display: inline-flex; align-items: center; padding: 0 .75rem;
    font-weight: 600; color: var(--auth-text-muted);
    background: var(--auth-bg); border: 1px solid var(--auth-border); border-right: 0;
    border-radius: var(--auth-radius) 0 0 var(--auth-radius);
}
.signup-phone .form-control { border-radius: 0 var(--auth-radius) var(--auth-radius) 0; min-width: 0; }

.signup-help { display: block; margin-top: .35rem; font-size: .8rem; color: var(--auth-text-muted); }
.signup-client-error { margin: .35rem 0 0; font-size: .85rem; color: var(--auth-danger-text); }
.form-control[aria-invalid="true"], .signup-plans[aria-invalid="true"] .signup-plan__body { border-color: var(--auth-danger-bdr); }
.signup-back-wrap { margin: .9rem 0 0; text-align: center; }
.signup-back { font-size: .9rem; font-weight: 600; color: var(--auth-primary-hov); text-decoration: none; }
.signup-back:hover { text-decoration: underline; }
.signup-page [hidden] { display: none !important; }
