/* ==============================================================
   Karona · Tela de Entrar (Auth)
   Usa os tokens definidos em style.css
   ============================================================== */

.sg-auth {
    min-height: 100vh;
    min-height: 100svh;
    height: 100svh;
    display: grid;
    grid-template-columns: 1fr;
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(130,230,65,.10), transparent 60%),
        radial-gradient(800px 400px at 110% 110%, rgba(60,167,255,.08), transparent 60%),
        linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    position: relative;
    overflow: hidden;
}

/* Grelha decorativa de fundo */
.sg-auth::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(130,230,65,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(130,230,65,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    pointer-events: none;
}

@media (min-width: 1024px) {
    .sg-auth { grid-template-columns: 1.05fr .95fr; }
}

/* =================== PAINEL LATERAL (BRANDING) =================== */
.sg-auth__aside {
    display: none;
    position: relative;
    padding: 22px clamp(28px, 3.5vw, 48px) 28px;
    z-index: 1;
}

@media (min-width: 1024px) {
    .sg-auth__aside {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 18px;
        height: 100svh;
        overflow: hidden;
    }
}

.sg-auth__brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sg-auth__aside-foot {
    color: var(--texto-mute);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: .8;
}

.sg-auth__aside-foot i { color: var(--amarelo); }

/* ----- Hero card (imagem + tagline + stats) ----- */
.sg-auth__hero {
    position: relative;
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0,0,0,.48);
    border: 1px solid rgba(15,31,58,.08);
    background: var(--navy-700);
    animation: sgFadeUp .7s ease both;
}

.sg-auth__hero-img {
    width: 100%;
    height: clamp(260px, 38svh, 380px);
    object-fit: cover;
    display: block;
    filter: saturate(1.05) contrast(1.02);
}

.sg-auth__hero-overlay {
    position: absolute; inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.85) 78%, rgba(255,255,255,.97) 100%),
        linear-gradient(120deg, rgba(130,230,65,.18) 0%, transparent 55%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(20px, 2.5vw, 30px);
}

.sg-auth__hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 6px 12px;
    background: rgba(130,230,65,.16);
    border: 1px solid rgba(130,230,65,.35);
    border-radius: 999px;
    color: var(--amarelo-claro);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.sg-auth__hero-eyebrow i { font-size: 13px; }

.sg-auth__hero-title {
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1.2;
    color: var(--texto);
    margin: 0 0 6px;
    font-weight: 800;
    letter-spacing: -.3px;
}

.sg-auth__hero-title em {
    font-style: normal;
    color: var(--amarelo);
}

.sg-auth__hero-sub {
    color: rgba(243,246,249,.78);
    font-size: 14px;
    margin: 0;
    max-width: 480px;
    line-height: 1.45;
}

/* Card flutuante de stats */
.sg-auth__stats {
    position: absolute;
    right: clamp(14px, 2vw, 24px);
    top: clamp(14px, 2vw, 24px);
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(15,31,58,.1);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
    animation: sgFadeDown .7s .15s ease both;
}

.sg-auth__stat-num {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--amarelo);
    line-height: 1;
}
.sg-auth__stat-lbl {
    font-size: 11px;
    color: var(--texto-mute);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-top: 4px;
}
.sg-auth__stat-sep {
    width: 1px;
    height: 30px;
    background: rgba(15,31,58,.1);
}

/* Lista de vantagens abaixo do hero */
.sg-auth__features {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
    animation: sgFadeUp .7s .1s ease both;
}

.sg-auth__features li {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--texto);
    font-size: 14.5px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(15,31,58,.025);
    border: 1px solid rgba(15,31,58,.04);
    transition: background .2s, border-color .2s, transform .2s;
}

.sg-auth__features li:hover {
    background: rgba(130,230,65,.05);
    border-color: rgba(130,230,65,.18);
    transform: translateX(4px);
}

.sg-auth__feature-icon {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(130,230,65,.12);
    color: var(--amarelo);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.sg-auth__feature-txt strong {
    display: block;
    font-weight: 600;
    color: var(--texto);
    font-size: 14px;
    line-height: 1.25;
}
.sg-auth__feature-txt span {
    color: var(--texto-mute);
    font-size: 12.5px;
    line-height: 1.35;
}

/* =================== PAINEL DO FORMULÁRIO =================== */
.sg-auth__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px clamp(20px, 4vw, 56px);
    position: relative;
    z-index: 1;
    height: 100svh;
    overflow-y: auto;
}

.sg-auth__top {
    width: 100%;
    max-width: 440px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sg-auth__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--texto-mute);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(15,31,58,.08);
    transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.sg-auth__back:hover {
    color: var(--texto);
    border-color: rgba(130,230,65,.35);
    background: rgba(130,230,65,.05);
    transform: translateX(-2px);
}

.sg-auth__brand-mobile { display: flex; }
@media (min-width: 1024px) {
    .sg-auth__brand-mobile { display: none; }
}

/* ----- Card do formulário ----- */
.sg-auth__card {
    width: 100%;
    max-width: 440px;
    position: relative;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(244,251,238,.88));
    border-radius: 24px;
    padding: clamp(26px, 3vw, 38px);
    box-shadow:
        0 28px 70px rgba(15,31,58,.12),
        inset 0 1px 0 rgba(255,255,255,.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: sgFadeUp .6s ease both;
}

/* Borda em gradiente subtil */
.sg-auth__card::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(130,230,65,.4), rgba(15,31,58,.05) 35%, rgba(15,31,58,.05) 65%, rgba(60,167,255,.25));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.sg-auth__title {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--texto);
    letter-spacing: -.3px;
}

.sg-auth__subtitle {
    color: var(--texto-mute);
    font-size: 14px;
    margin: 0 0 22px;
}

/* =================== FORMULÁRIO =================== */
.sg-form { display: grid; gap: 15px; }

.sg-form__group { display: grid; gap: 7px; }

.sg-form__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-mute);
    letter-spacing: .2px;
}

.sg-form__field {
    position: relative;
    display: flex;
    align-items: center;
}

.sg-form__field i {
    position: absolute;
    left: 16px;
    color: var(--texto-mute);
    font-size: 17px;
    pointer-events: none;
    transition: color .15s;
}

.sg-form__input {
    width: 100%;
    height: 50px;
    padding: 0 16px 0 46px;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(15,31,58,.08);
    border-radius: 12px;
    color: var(--texto);
    font-family: inherit;
    font-size: 15px;
    transition: border-color .18s, background .18s, box-shadow .18s;
}

.sg-form__input::placeholder { color: rgba(15,31,58,.4); }

.sg-form__input:hover { border-color: rgba(15,31,58,.16); }

.sg-form__input:focus {
    outline: none;
    border-color: var(--amarelo);
    background: rgba(255, 255, 255, .85);
    box-shadow: 0 0 0 4px rgba(130,230,65,.13);
}
.sg-form__field:focus-within i { color: var(--amarelo); }

/* Password */
.sg-form__field--password .sg-form__input { padding-right: 46px; }
.sg-form__toggle {
    position: absolute;
    right: 8px;
    width: 36px; height: 36px;
    background: transparent;
    border: 0;
    color: var(--texto-mute);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}
.sg-form__toggle:hover { color: var(--amarelo); background: rgba(130,230,65,.08); }

/* Linha de opções */
.sg-form__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    margin-top: 2px;
}

.sg-form__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--texto-mute);
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}
.sg-form__check:hover { color: var(--texto); }

.sg-form__check input {
    appearance: none;
    width: 18px; height: 18px;
    border: 1.5px solid rgba(15,31,58,.2);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
}
.sg-form__check input:checked {
    background: var(--amarelo);
    border-color: var(--amarelo);
}
.sg-form__check input:checked::after {
    content: "";
    position: absolute;
    left: 5px; top: 1px;
    width: 5px; height: 10px;
    border: solid var(--tinta-escura);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sg-form__link {
    color: var(--amarelo);
    font-weight: 600;
    transition: color .15s;
}
.sg-form__link:hover { color: var(--amarelo-claro); }

/* Submit com gradiente + brilho */
.sg-form__submit {
    height: 52px;
    width: 100%;
    font-size: 15.5px;
    margin-top: 6px;
    background: linear-gradient(135deg, var(--amarelo) 0%, var(--amarelo-escuro) 100%);
    color: var(--tinta-escura);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 10px 28px rgba(130,230,65,.35),
        inset 0 1px 0 rgba(15,31,58,.4);
    letter-spacing: .2px;
}
.sg-form__submit::after {
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(15,31,58,.55), transparent);
    transition: left .55s ease;
}
.sg-form__submit:hover {
    background: linear-gradient(135deg, var(--amarelo-claro) 0%, var(--amarelo) 100%);
    transform: translateY(-2px);
    box-shadow:
        0 16px 36px rgba(130,230,65,.5),
        inset 0 1px 0 rgba(15,31,58,.45);
}
.sg-form__submit:hover::after { left: 120%; }
.sg-form__submit:active { transform: translateY(0); }

/* Divisor */
.sg-auth__divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--texto-mute);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 18px 0 14px;
    font-weight: 600;
}
.sg-auth__divider::before,
.sg-auth__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(15,31,58,.12), transparent);
}

/* Rodapé do card */
.sg-auth__foot {
    text-align: center;
    color: var(--texto-mute);
    font-size: 14px;
    margin: 0;
}

/* Badge de segurança */
.sg-auth__secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    font-size: 12.5px;
    color: var(--texto-mute);
    opacity: .85;
}
.sg-auth__secure i {
    color: var(--verde);
    font-size: 14px;
}

/* =================== VARIANTE: ASIDE SÓ COM IMAGEM =================== */
.sg-auth__aside--image {
    padding: 0;
    overflow: hidden;
    position: relative;
}

.sg-auth__aside-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: sgFadeUp .7s ease both;
}

/* Borda subtil entre os dois painéis */
.sg-auth__aside--image::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(15,31,58,.08), transparent);
}

/* =================== ÍCONE DE TOPO (Recuperar senha) =================== */
.sg-auth__icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(130,230,65,.22), rgba(130,230,65,.08));
    border: 1px solid rgba(130,230,65,.32);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--amarelo);
    font-size: 26px;
    margin: 0 0 16px;
    box-shadow: 0 8px 22px rgba(130,230,65,.18);
}

.sg-auth__icon-wrap--success {
    background: linear-gradient(135deg, rgba(74,222,128,.22), rgba(74,222,128,.08));
    border-color: rgba(74,222,128,.35);
    color: var(--verde);
    box-shadow: 0 8px 22px rgba(74,222,128,.2);
}

/* Email destacado dentro do subtítulo de sucesso */
.sg-auth__email-shown {
    color: var(--amarelo);
    word-break: break-all;
    font-weight: 700;
}

/* Bloco de hint (info subtil) */
.sg-auth__hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(15,31,58,.03);
    border: 1px solid rgba(15,31,58,.06);
    border-radius: 12px;
    color: var(--texto-mute);
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 16px;
}

.sg-auth__hint i {
    color: var(--amarelo);
    font-size: 16px;
    margin-top: 1px;
    flex-shrink: 0;
}

.sg-auth__hint em {
    font-style: italic;
    color: var(--texto);
}

/* Steps (transição entre formulário e sucesso) */
.sg-auth__step {
    animation: sgFadeUp .5s ease both;
}

/* =================== REGISTAR — campos em linha =================== */
.sg-form__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 520px) {
    .sg-form__row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* Checkbox em bloco (termos) */
.sg-form__check--block {
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--texto-mute);
    margin-top: 2px;
}

.sg-form__check--block input {
    margin-top: 2px;
}

/* Hint sob o input (match de senhas, etc.) */
.sg-form__hint {
    font-size: 12.5px;
    color: var(--texto-mute);
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 16px;
    margin-top: 2px;
}

.sg-form__hint i { font-size: 13px; }

.sg-form__hint.is-ok  { color: var(--verde); }
.sg-form__hint.is-err { color: var(--vermelho); }

/* Indicador de força da senha */
.sg-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.sg-strength__bars {
    display: flex;
    gap: 4px;
    flex: 1;
}

.sg-strength__bars span {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: rgba(15,31,58,.08);
    transition: background .25s ease;
}

.sg-strength__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--texto-mute);
    min-width: 80px;
    text-align: right;
    transition: color .2s ease;
}

/* =================== ANIMAÇÕES =================== */
@keyframes sgFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes sgFadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =================== RESPONSIVO =================== */

/* Tablet (768px–1023px): mostra hero compacto acima do formulário */
@media (min-width: 768px) and (max-width: 1023px) {
    .sg-auth__main {
        padding-top: 24px;
        padding-bottom: 24px;
    }
    .sg-auth__top { max-width: 560px; }
    .sg-auth__card { max-width: 560px; }
}

/* Phone landscape e tablet pequeno */
@media (max-width: 767px) {
    .sg-auth__main {
        min-height: auto;
        padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
        padding-top: calc(20px + env(safe-area-inset-top));
    }
}

/* Phone (≤ 480px) */
@media (max-width: 480px) {
    .sg-auth__top { margin-bottom: 18px; }
    .sg-auth__back {
        padding: 8px 12px;
        font-size: 13.5px;
    }
    .sg-auth__card {
        padding: 26px 22px;
        border-radius: 20px;
    }
    .sg-auth__title { font-size: 23px; }
    .sg-auth__subtitle { font-size: 14px; margin-bottom: 22px; }
    .sg-form { gap: 14px; }
    .sg-form__input { height: 50px; font-size: 16px; /* evita zoom no iOS */ }
    .sg-form__submit { height: 52px; }
    .sg-form__options { font-size: 13.5px; flex-wrap: wrap; }
    .sg-auth__divider { margin: 20px 0 16px; letter-spacing: 1.4px; }
    .sg-auth__foot { font-size: 14px; }
    .sg-auth__secure { font-size: 12px; margin-top: 18px; }
}

/* Phones muito pequenos (≤ 360px) */
@media (max-width: 360px) {
    .sg-auth__card { padding: 22px 18px; }
    .sg-auth__title { font-size: 21px; }
    .sg-form__field i { left: 14px; font-size: 16px; }
    .sg-form__input { padding-left: 42px; }
}

/* Orientação landscape em telemóveis (altura reduzida) */
@media (max-height: 640px) and (orientation: landscape) and (max-width: 1023px) {
    .sg-auth__main { padding-top: 16px; padding-bottom: 16px; min-height: auto; }
    .sg-auth__card { padding: 22px 26px; }
    .sg-auth__title { font-size: 22px; margin-bottom: 4px; }
    .sg-auth__subtitle { margin-bottom: 18px; }
    .sg-form { gap: 12px; }
    .sg-form__input { height: 46px; }
    .sg-form__submit { height: 48px; }
}

/* Desktop grande (≥ 1440px) — mais respiro */
@media (min-width: 1440px) {
    .sg-auth { grid-template-columns: 1.1fr .9fr; }
    .sg-auth__aside { padding: 64px; }
    .sg-auth__card { max-width: 460px; }
}

/* Desktop muito grande (≥ 1920px) — limita largura útil */
@media (min-width: 1920px) {
    .sg-auth {
        max-width: 1700px;
        margin-inline: auto;
    }
}

/* Acessibilidade: respeitar utilizadores que preferem menos movimento */
@media (prefers-reduced-motion: reduce) {
    .sg-auth__hero,
    .sg-auth__stats,
    .sg-auth__features,
    .sg-auth__card { animation: none; }

    .sg-auth__features li:hover,
    .sg-form__submit:hover,
    .sg-auth__back:hover { transform: none; }

    .sg-form__submit::after { display: none; }
}

/* Alto contraste — reforçar bordas */
@media (prefers-contrast: more) {
    .sg-form__input { border-color: rgba(15,31,58,.3); }
    .sg-auth__card { border: 1px solid rgba(15,31,58,.18); }
}
