/**
 * ONSTRYX - Estilos de Autenticação
 * Login, Cadastro, Recuperação de Senha
 */

/* =====================================================
   AUTH LAYOUT
   ===================================================== */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
}

.auth-left {
    flex: 1;
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-left-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
}

.auth-left-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: var(--spacing-2xl);
    max-width: 500px;
}

.auth-left-logo {
    height: 60px;
    margin-bottom: var(--spacing-2xl);
    filter: brightness(0) invert(1);
}

.auth-left-title {
    color: var(--color-white);
    font-family: var(--font-display);
    font-size: var(--font-4xl);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: var(--spacing-md);
}

.auth-left-subtitle {
    color: var(--color-gray-400);
    font-size: var(--font-lg);
    line-height: 1.6;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    padding-left: max(var(--spacing-2xl), env(safe-area-inset-left));
    padding-right: max(var(--spacing-2xl), env(safe-area-inset-right));
    padding-bottom: calc(var(--spacing-2xl) + env(safe-area-inset-bottom));
    background: var(--color-white);
}

.auth-form-container {
    width: 100%;
    max-width: min(420px, 100%);
}

.auth-form-header {
    margin-bottom: var(--spacing-2xl);
}

.auth-form-title {
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: var(--spacing-sm);
}

.auth-form-subtitle {
    color: var(--color-gray-500);
    font-size: var(--font-base);
}

/* =====================================================
   AUTH FORM
   ===================================================== */
.auth-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.auth-form .form-label {
    font-weight: 600;
}

.auth-form .form-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: 16px;
}

.auth-form .form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(107, 33, 168, 0.1);
}

/* Password Input with Toggle */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray-400);
    cursor: pointer;
    padding: var(--spacing-xs);
}

.password-toggle:hover {
    color: var(--color-gray-600);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Legacy password field wrapper used on recuperar-senha.php */
.password-field {
    position: relative;
}

.password-field .form-input {
    padding-right: 84px;
}

.password-field .password-toggle {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-500);
}

.password-field .password-toggle:hover {
    color: var(--color-primary);
}

/* Remember Me & Forgot Password */
.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.remember-me span {
    font-size: var(--font-sm);
    color: var(--color-gray-600);
}

.forgot-password {
    font-size: var(--font-sm);
    color: var(--color-primary);
    font-weight: 500;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Auth Button */
.auth-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--color-black);
    color: var(--color-white);
    font-size: var(--font-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-lg);
}

.auth-btn:hover {
    background: var(--color-primary);
}

.auth-btn:disabled {
    background: var(--color-gray-300);
    cursor: not-allowed;
}

/* Social Login */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background: var(--color-gray-200);
}

.auth-divider-text {
    color: var(--color-gray-400);
    font-size: var(--font-sm);
}

.social-login-btns {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.social-login-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    transition: all var(--transition-fast);
}

.social-login-btn:hover {
    border-color: var(--color-gray-400);
    background: var(--color-gray-50);
}

.social-login-btn svg {
    width: 20px;
    height: 20px;
}

/* Auth Footer */
.auth-form-footer {
    text-align: center;
    color: var(--color-gray-500);
    font-size: var(--font-sm);
}

.auth-form-footer a {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-form-footer a:hover {
    text-decoration: underline;
}

.recaptcha-disclaimer {
    margin: -4px 0 var(--spacing-lg);
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-gray-500);
}

.recaptcha-disclaimer a {
    color: inherit;
    text-decoration: underline;
}

.grecaptcha-badge {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 9998;
}

/* =====================================================
   PASSWORD STRENGTH
   ===================================================== */
.password-strength {
    margin-top: var(--spacing-sm);
}

.password-strength-bar {
    height: 4px;
    background: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.password-strength-fill {
    height: 100%;
    transition: all var(--transition-fast);
    border-radius: var(--radius-full);
}

.password-strength-fill.weak { width: 25%; background: var(--color-error); }
.password-strength-fill.fair { width: 50%; background: var(--color-warning); }
.password-strength-fill.good { width: 75%; background: var(--color-info); }
.password-strength-fill.strong { width: 100%; background: var(--color-success); }

.password-strength-text {
    font-size: var(--font-xs);
    color: var(--color-gray-500);
}

/* =====================================================
   VERIFICATION CODE
   ===================================================== */
.verification-code-inputs {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.verification-code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: var(--font-2xl);
    font-weight: 700;
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.verification-code-input:focus {
    border-color: var(--color-primary);
    outline: none;
}

.resend-code {
    text-align: center;
    margin-top: var(--spacing-md);
}

.resend-code-btn {
    color: var(--color-primary);
    font-weight: 500;
    font-size: var(--font-sm);
}

.resend-code-btn:disabled {
    color: var(--color-gray-400);
    cursor: not-allowed;
}

/* =====================================================
   PASSWORD RESET PAGE (HEADER/FOOTER LAYOUT)
   ===================================================== */
.auth-recovery-page {
    min-height: calc(100vh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
    padding-top: calc(var(--header-height) + 28px);
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
    align-items: flex-start;
    justify-content: center;
    background:
        radial-gradient(80% 80% at 50% 0%, rgba(124, 58, 237, 0.06), transparent 65%),
        linear-gradient(180deg, #f8f9fc 0%, #f5f6fa 100%);
}

.auth-recovery-page .auth-container {
    width: min(100%, 560px);
    margin: 0 auto;
    padding: 0 16px;
}

.auth-recovery-page .auth-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(17, 24, 39, 0.06);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 16px 36px rgba(17, 24, 39, 0.08);
    backdrop-filter: blur(8px);
}

.auth-recovery-page .auth-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-recovery-page .auth-logo {
    width: min(170px, 56vw);
    height: auto;
    margin: 0 auto 18px;
    display: block;
}

.auth-recovery-page .auth-title {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--color-gray-900);
}

.auth-recovery-page .auth-subtitle {
    margin: 0;
    color: var(--color-gray-600);
    font-size: 16px;
    line-height: 1.55;
}

.auth-recovery-page .auth-form {
    margin-top: 8px;
}

.auth-recovery-page .auth-form .form-group {
    margin-bottom: 18px;
}

.auth-recovery-page .auth-form .form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-gray-800);
    font-weight: 600;
}

.auth-recovery-page .auth-footer {
    margin-top: 18px;
    text-align: center;
    color: var(--color-gray-600);
}

.auth-recovery-page .auth-footer a {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-reset-meta {
    margin: -4px 0 18px;
    text-align: center;
    color: var(--color-gray-600);
    font-size: 14px;
    line-height: 1.5;
}

.auth-reset-meta strong {
    color: var(--color-gray-900);
}

.auth-reset-help {
    margin-top: 14px;
    font-size: 13px;
    color: var(--color-gray-500);
    text-align: center;
    line-height: 1.5;
}

.auth-code-actions {
    display: grid;
    gap: 10px;
}

.auth-code-resend {
    display: flex;
    justify-content: center;
}

.auth-code-resend .btn {
    min-width: 180px;
}

.auth-hidden-code {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

/* =====================================================
   AUTH TRANSITION LOADER
   ===================================================== */
.auth-screen-loader {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 12, 0.76);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.auth-screen-loader[hidden] {
    display: none !important;
}

.auth-screen-loader.active {
    opacity: 1;
    visibility: visible;
}

.auth-screen-loader-card {
    width: min(92vw, 300px);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,252,0.96));
    border: 1px solid rgba(124, 58, 237, 0.16);
    border-radius: 20px;
    padding: 20px 18px 16px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0,0,0,0.22);
}

.auth-screen-loader-icon {
    width: auto;
    height: auto;
    margin: 0 auto 12px;
    border-radius: 0;
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: none;
}

.auth-screen-loader-icon::before {
    content: none;
    display: none;
}

.auth-screen-loader-icon img {
    width: min(132px, 34vw);
    max-width: 132px;
    height: auto;
    border-radius: 0;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.14));
    animation: auth-owl-pulse 1s ease-in-out infinite;
}

.auth-screen-loader-title {
    font-weight: 700;
    color: var(--color-gray-900);
    margin: 0 0 4px;
}

.auth-screen-loader-text {
    margin: 0;
    font-size: 13px;
    color: var(--color-gray-600);
}

@keyframes auth-owl-pulse {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.94;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes auth-loader-ring {
    0%, 100% {
        transform: scale(0.96);
        opacity: 0.45;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.15;
    }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 992px) {
    .auth-left {
        display: none;
    }
    
    .auth-right {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .auth-right {
        padding: var(--spacing-lg);
        padding-left: max(var(--spacing-lg), env(safe-area-inset-left));
        padding-right: max(var(--spacing-lg), env(safe-area-inset-right));
        padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    }
    
    .auth-form-title {
        font-size: var(--font-xl);
    }

    .auth-form-options {
        flex-wrap: wrap;
    }

    .forgot-password {
        margin-left: auto;
    }
    
    .social-login-btns {
        flex-direction: column;
    }
    
    .verification-code-input {
        width: 45px;
        height: 55px;
    }

    .auth-recovery-page {
        padding-top: calc(var(--header-height) + 16px);
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .auth-recovery-page .auth-container {
        padding: 0 12px;
    }

    .auth-recovery-page .auth-card {
        border-radius: 16px;
        padding: 18px 16px;
    }

    .auth-recovery-page .auth-title {
        font-size: 24px;
        line-height: 1.12;
    }

    .auth-recovery-page .auth-subtitle {
        font-size: 15px;
    }

    .auth-recovery-page .auth-logo {
        width: min(140px, 48vw);
        margin-bottom: 14px;
    }

    .verification-code-inputs {
        gap: 8px;
    }

    .verification-code-input {
        width: 42px;
        height: 52px;
        font-size: 24px;
    }

    .auth-code-resend .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-screen-loader,
    .auth-screen-loader-icon::before,
    .auth-screen-loader-icon img {
        animation: none !important;
        transition: none !important;
    }
}
