/* ==========================================================================
   ACCOUNT (modules/accountPage.js): Entrar, Criar conta, Esqueci a senha and the
   recovery code; the signed-in state in the pill. Neutral colors, line icons only.
   Layer: 1300 (over the title page, under the legal panel and the toast).
   ========================================================================== */

/* Elements switched with the hidden attribute keep it even when styled as flex */
.nav-menu [hidden],
.account-page [hidden] {
    display: none !important;
}

/* Signed in: the profile's avatar in place of the line icon, in the pill and in the menu */
.nav-tool.has-avatar > svg,
.nav-menu-avatar.has-avatar > svg {
    display: none;
}

.nav-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    user-select: none;
}

.nav-menu-avatar .nav-avatar {
    width: 38px;
    height: 38px;
}

/* --- The page --- */
.account-page {
    position: fixed;
    inset: 0;
    z-index: 1300;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 84px 20px 40px;
    box-sizing: border-box;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, 0.07), transparent 60%),
        var(--bg-base);
}

.account-page.is-entering .account-card {
    animation: account-card-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes account-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.account-back {
    position: fixed;
}

.account-card {
    width: min(420px, 100%);
    padding: 28px 28px 24px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(18, 18, 22, 0.92);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

.account-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

/* Entrar | Criar conta, with a sliding highlight */
.account-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.account-switch-glider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: #ffffff;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.account-switch.is-signup .account-switch-glider {
    transform: translateX(100%);
}

.account-switch-option {
    position: relative;
    z-index: 1;
    padding: 9px 0;
    border: none;
    background: none;
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease;
}

.account-switch-option.active {
    color: #09090b;
}

.account-switch-option:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.account-view.is-switching,
.account-form.is-switching {
    animation: account-fade 0.22s ease-out;
}

@keyframes account-fade {
    from { opacity: 0.35; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
}

.account-lead {
    margin: -6px 0 4px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e4e4e7;
}

.account-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.account-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.account-code-input {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-input-wrap {
    position: relative;
}

.account-input-wrap .account-input {
    padding-right: 48px;
}

/* Centered with margins, not transform: the focus style (04-sports.css) replaces the transform of a focused button */
.account-eye {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto 0;
    right: 6px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.account-eye:hover,
.account-eye:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.account-eye .icon-hide,
.account-eye.is-on .icon-show {
    display: none;
}

.account-eye.is-on .icon-hide {
    display: block;
}

.account-hint {
    min-height: 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.account-hint:empty {
    display: none;
}

.account-hint.is-problem {
    color: #fca5a5;
}

/* Strength: a bar that grows and changes color while typing */
.account-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    --strength: 0%;
}

.account-strength-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.account-strength-bar span {
    display: block;
    height: 100%;
    width: var(--strength);
    border-radius: inherit;
    background: #71717a;
    transition: width 0.25s ease, background 0.25s ease;
}

.account-strength[data-level="fraca"] .account-strength-bar span { background: #ef4444; }
.account-strength[data-level="media"] .account-strength-bar span { background: #eab308; }
.account-strength[data-level="forte"] .account-strength-bar span { background: #22c55e; }

.account-strength-label {
    min-width: 44px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
}

.account-rules {
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.account-rules li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.account-rule-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.account-rules li.is-met {
    color: #e4e4e7;
}

.account-rules li.is-met .account-rule-mark {
    background: #22c55e;
    border-color: #22c55e;
    color: #04130a;
}

/* The Turnstile check takes room only when Cloudflare shows it */
.account-turnstile {
    display: flex;
    justify-content: center;
}

.account-turnstile:empty {
    display: none;
}

.account-error {
    margin: 0;
    font-size: 0.84rem;
    color: #fca5a5;
    min-height: 0;
}

.account-error:empty {
    display: none;
}

.account-error.is-shaking {
    animation: account-shake 0.35s ease;
}

@keyframes account-shake {
    0%, 100% { transform: none; }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.account-submit {
    position: relative;
    height: 50px;
    margin-top: 4px;
    border: none;
    border-radius: 999px;
    background: #ffffff;
    color: #09090b;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.account-submit:hover:not(:disabled),
.account-submit:focus-visible {
    background: #e4e4e7;
    outline: none;
}

.account-submit:active:not(:disabled) {
    transform: scale(0.98);
}

.account-submit:disabled {
    opacity: 0.45;
    cursor: default;
}

.account-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 2.5px solid rgba(9, 9, 11, 0.2);
    border-top-color: #09090b;
    animation: title-ring-spin 0.7s linear infinite;
}

.account-submit.is-busy {
    opacity: 1;
}

.account-submit.is-busy > span:not(.account-spinner) {
    visibility: hidden;
}

.account-submit.is-busy .account-spinner {
    display: block;
}

.account-link {
    align-self: center;
    padding: 4px 6px;
    border: none;
    background: none;
    color: #e4e4e7;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.account-link:hover,
.account-link:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    outline: none;
}

.account-terms {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
}

.account-inline-link {
    padding: 0;
    border: none;
    background: none;
    color: #e4e4e7;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* --- The recovery code --- */
.account-code {
    margin: 18px 0 14px;
    padding: 18px 12px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.04);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #ffffff;
    text-align: center;
    user-select: all;
    word-break: break-all;
}

.account-secondary {
    width: 100%;
    height: 46px;
    margin-bottom: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.account-secondary:hover,
.account-secondary:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

#account-code-view {
    display: flex;
    flex-direction: column;
}

#account-code-view .account-lead {
    margin: 10px 0 0;
}

#account-code-view .account-submit {
    width: 100%;
}

/* --- A confirmation (core/confirmDialog.js), over everything --- */
.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.66);
    animation: account-fade 0.18s ease-out;
}

.confirm-dialog.hidden {
    display: none;
}

.confirm-dialog-card {
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    animation: account-card-in 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-dialog-card .account-lead {
    margin: 10px 0 18px;
}

.confirm-dialog-card .account-submit {
    width: 100%;
}

.confirm-dialog-card .account-secondary {
    margin: 10px 0 0;
}

@media (max-width: 768px) {
    .account-page {
        padding: 72px 12px 24px;
    }

    /* Nothing of the pill shows over this page: the arrow goes to the corner */
    .account-page .account-back {
        top: 14px;
        left: 12px;
    }

    .account-card {
        padding: 22px 18px 18px;
        border-radius: 18px;
    }
}
