/* =============================================================================
   SecDay CTF - Auth Pages (Login & Cadastro)
   Arquivo: static/css/auth.css

   REGRA: Este arquivo NÃO redefine font-size de NENHUM elemento do formulário.
   Tamanhos de fonte vêm integralmente do style.css:
     - labels: 0.9rem | inputs: 1rem | h1: 1.8rem | footer: herdado
     - form-hint: 0.85rem | forgot-password: 0.9rem
   Aqui só adicionamos: layout, background, glassmorphism, cores e efeitos.
   ============================================================================= */

/* ── Auth page: allow natural scroll, no rigid viewport lock ──── */
html.auth-active,
html.auth-active body {
    min-height: 100%;
    overflow-x: hidden;
}

html.auth-active body {
    display: flex;
    flex-direction: column;
}

html.auth-active .header,
html.auth-active .footer {
    flex-shrink: 0;
}

html.auth-active .main {
    flex: 1;
    padding: 0;
    overflow: visible;
}

html.auth-active .main > .container {
    max-width: 100%;
    padding: 0;
}

html.auth-active .footer {
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Fixed background layers ─────────────────────────────────── */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.auth-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 50% 80%, rgba(10, 14, 23, 0.15) 0%, rgba(10, 14, 23, 0.55) 80%),
        linear-gradient(180deg, rgba(10, 14, 23, 0.2) 0%, rgba(10, 14, 23, 0.45) 100%);
}

/* ── Auth Page fills remaining space ─────────────────────────── */
.auth-page {
    width: 100%;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(16px, 3vw, 32px);
}

/* ── Two-column grid layout ─────────────────────────────────── */
.auth-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(320px, 440px);
    gap: clamp(20px, 4vw, 60px);
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 980px;
}

/* =============================================================================
   Hero Side (left column)
   ============================================================================= */

.auth-hero {
    width: 100%;
    max-width: 420px;
}

.auth-hero-title {
    font-size: clamp(1.6rem, 2.8vw, 2.4rem);
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 14px;
}

.auth-hero-title .highlight {
    background: linear-gradient(135deg, #1dd3e0, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-hero-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 28px;
}

/* ── Mini Ranking Card ───────────────────────────────────────── */

.auth-ranking-card {
    background: rgba(26, 35, 50, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 14px;
    padding: 16px 20px;
    max-width: 340px;
    max-height: min(420px, calc(100dvh - 260px));
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-ranking-card::-webkit-scrollbar { width: 3px; }
.auth-ranking-card::-webkit-scrollbar-track { background: transparent; }
.auth-ranking-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ranking-header h4 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}

.ranking-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 10px;
    border-radius: 12px;
}

.ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    border-radius: 6px;
    transition: background 0.4s ease;
}

/* Flash verde-azulado quando a pontuação do item é atualizada */
.ranking-item--updated {
    background: rgba(29, 211, 224, 0.07);
}

.ranking-pos {
    width: 20px;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
}

.ranking-pos.gold   { color: #f59e0b; }
.ranking-pos.silver { color: #94a3b8; }
.ranking-pos.bronze { color: #b45309; }

.ranking-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ranking-name {
    color: var(--text-primary);
    flex: 1;
}

.ranking-stars {
    color: #f59e0b;
    font-size: 0.7rem;
    letter-spacing: 1px;
    display: none;
}

.ranking-item--top5 .ranking-stars {
    display: inline;
}

.ranking-score {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Auth Card — glassmorphism override
   Only: background, border, shadow, scroll. NO font-size changes.
   ============================================================================= */

.auth-page .auth-card {
    width: min(100%, 440px);
    background: rgba(26, 35, 50, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: clamp(12px, 2vw, 16px);
    padding: clamp(20px, 3vw, 32px);
    box-shadow:
        0 0 40px rgba(59, 130, 246, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-page .auth-card::-webkit-scrollbar { width: 4px; }
.auth-page .auth-card::-webkit-scrollbar-track { background: transparent; }
.auth-page .auth-card::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

/* ── Auth Logo — destaque para logo PNG em fundo escuro ──────── */

.auth-page .auth-logo {
    width: 100%;          /* controla a proporção */
    max-width: 200px;    /* evita ficar gigante em telas grandes */
    height: auto;

    filter:
        drop-shadow(0 0 20px rgba(59, 130, 246, 0.5))
        drop-shadow(0 0 40px rgba(29, 211, 224, 0.25))
        brightness(1.8);

    border-radius: 12px;
    margin: 0 auto 10px; /* reduz espaço → parece mais "perto" */
    display: block;
}

/* =============================================================================
   Form Input Visuals — colors & effects ONLY
   ============================================================================= */

.auth-page .auth-form .form-group input {
    background: rgba(10, 14, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.auth-page .auth-form .form-group input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 0 16px rgba(59, 130, 246, 0.08);
}

.auth-page .auth-form .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* =============================================================================
   Primary Button — gradient + glow, same padding/size as style.css
   ============================================================================= */

.auth-page .auth-form .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.25s, filter 0.2s;
    text-align: center;
}

.auth-page .auth-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.3);
    filter: brightness(1.08);
}

.auth-page .auth-form .btn-primary:active {
    transform: translateY(0);
}

/* =============================================================================
   Social Login Buttons — dark style to match glassmorphism card
   ============================================================================= */

.auth-page .social-login-btns .btn-google,
.auth-page .social-login-btns .btn-github {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.auth-page .social-login-btns .btn-google:hover,
.auth-page .social-login-btns .btn-github:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

/* =============================================================================
   Auth Footer, Links, Info — color overrides only
   ============================================================================= */

.auth-page .auth-footer {
    border-top-color: rgba(255, 255, 255, 0.07);
}

.auth-page .forgot-password-link:hover {
    color: var(--accent-blue);
}

.auth-page .auth-info {
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
}

.auth-page .auth-info-text {
    color: rgba(147, 197, 253, 0.85);
}

.auth-page .auth-info-text a {
    color: var(--accent-blue);
    font-weight: 600;
}

/* ── Password Toggle ─────────────────────────────────────────── */

.auth-page .password-toggle {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.auth-page .password-toggle:hover {
    opacity: 0.85;
}

/* ── Resend Box ──────────────────────────────────────────────── */

.auth-page .resend-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
}

/* ── Alert overrides ─────────────────────────────────────────── */

.auth-page .auth-card .alert {
    border-radius: 10px;
}

/* ── Turnstile: prevent overflow on narrow screens ───────────── */

.cf-turnstile {
    max-width: 100%;
    overflow: hidden;
}

/* =============================================================================
   Cadastro-specific: tighter SPACING to fit 5 fields in viewport
   ZERO font-size changes — only padding, gap, margin reductions.
   ============================================================================= */

.auth-page--cadastro .auth-card {
    max-width: 440px;
}

.auth-page--cadastro .auth-header {
    margin-bottom: 20px;
}

.auth-page--cadastro .auth-form {
    gap: 14px;
}

.auth-page--cadastro .auth-form .form-group {
    gap: 5px;
}

.auth-page--cadastro .auth-form .form-group input {
    padding: 10px 16px;
}

.auth-page--cadastro .auth-footer {
    margin-top: 18px;
    padding-top: 18px;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 980px) {
    .auth-page {
        align-items: flex-start;
        padding: 24px 20px 32px;
    }

    .auth-layout {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .auth-hero {
        display: none;
    }

    .auth-page .auth-card {
        width: 100%;
        max-width: 480px;
    }

    .auth-page--cadastro .auth-card {
        max-width: 480px;
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 16px 12px 24px;
    }

    .auth-page .auth-card {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
        padding: 24px 20px;
    }

    .auth-page--cadastro .auth-card {
        max-width: 100%;
        padding: 24px 20px;
    }

    /* Botões sociais empilhados no mobile */
    .auth-page .social-login-btns {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .auth-page .social-login-btns .btn-social {
        width: 100%;
        justify-content: center;
    }

    /* Logo menor no mobile */
    .auth-page .auth-logo {
        max-width: 140px;
    }

    /* Turnstile pode apertar em telas muito estreitas */
    .cf-turnstile {
        transform: scale(0.92);
        transform-origin: left top;
    }
}

/* ── Short viewport: compact spacing ONLY, never font sizes ──── */
@media (max-height: 750px) {
    .auth-hero-subtitle {
        display: none;
    }

    .auth-ranking-card {
        padding: 12px 16px;
    }

    .ranking-list {
        gap: 5px;
    }

    .auth-page .auth-header {
        margin-bottom: 18px;
    }

    .auth-page--cadastro .auth-form {
        gap: 10px;
    }

    .auth-page--cadastro .auth-form .form-group input {
        padding: 9px 14px;
    }

    .auth-page--cadastro .auth-footer {
        margin-top: 12px;
        padding-top: 12px;
    }
}

/* =============================================================================
   Card glow: luz interna que segue o mouse sobre o card
   Usa clip-path em vez de overflow:hidden para preservar scroll
   ============================================================================= */

.auth-page .auth-card {
    --card-glow-x: -100px;
    --card-glow-y: -100px;
}

.auth-page .auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    clip-path: inset(0 round inherit);
    background: radial-gradient(
        300px circle at var(--card-glow-x) var(--card-glow-y),
        rgba(59, 130, 246, 0.08) 0%,
        transparent 70%
    );
    transition: opacity 0.3s ease;
}

/* Garantir que o conteúdo do card fique acima do glow */
.auth-page .auth-card > * {
    position: relative;
    z-index: 1;
}

/* ── Ranking card glow ───────────────────────────────────────── */
.auth-ranking-card {
    --card-glow-x: -100px;
    --card-glow-y: -100px;
}

.auth-ranking-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    clip-path: inset(0 round inherit);
    background: radial-gradient(
        250px circle at var(--card-glow-x) var(--card-glow-y),
        rgba(29, 211, 224, 0.07) 0%,
        transparent 70%
    );
}

.auth-ranking-card > * {
    position: relative;
    z-index: 1;
}

/* ── Border glow: borda do card brilha perto do cursor ───────── */
.auth-page .auth-card::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    clip-path: inset(0 round inherit);
    background: radial-gradient(
        400px circle at var(--card-glow-x) var(--card-glow-y),
        rgba(59, 130, 246, 0.25) 0%,
        transparent 50%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 1px;
}

/* ── Desativar efeitos em mobile ─────────────────────────────── */
@media (hover: none), (pointer: coarse) {
    .auth-page .auth-card::before,
    .auth-page .auth-card::after,
    .auth-ranking-card::before {
        display: none;
    }
}
