/* ========================================
   RASTI - Authentication Page (Sliding Panels)
   ======================================== */

.auth-container {
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-top: calc(var(--navbar-height) + 1rem);
    /* Space for fixed navbar */
    background: var(--gray-50);
}

.auth-wrapper {
    width: 100%;
    max-width: 1000px;
    height: 600px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.btn-outline {
    z-index: 3;
}

/* Slider wrapper (overlapping views) */
.auth-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Each view fills the wrapper and overlaps */
.auth-container-inner {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Register view es solo plantilla de contenido, no para el layout */
.auth-container-inner.register-view {
    display: none;
}

/* Smooth crossing animation for panels */
.auth-form-panel,
.auth-decorative-panel {
    transition: transform 0.25s ease-in-out;
}

/* Suavizado solo para contenido (texto/botón), no imágenes de fondo */
.auth-decorative-panel> :not(.auth-decor-img) {
    transition: opacity 0.15s ease;
}

/* Suavizado para el contenido del formulario al intercambiar */
.auth-form-panel>* {
    transition: opacity 0.15s ease;
}

/* Base layering and pointer events (no fading) */
.auth-wrapper .login-view {
    z-index: 2;
    pointer-events: auto;
}

.auth-wrapper .register-view {
    z-index: 1;
    pointer-events: none;
}

/* Form Panel */
.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    background: var(--white);
    z-index: 1;
}

.auth-panel-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    text-align: left;
    font-family: var(--font-body);
}

.auth-panel-subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
}

.btn-google {
    width: 100%;
    gap: 0.6rem;
    justify-content: center;
    transition: all 0.3s ease;
}

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

.btn-google:hover {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}

/* Social Buttons */
.social-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.social-btn {
    width: 45px;
    height: 45px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--gray-700);
}

.social-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Form Inputs */
.auth-panel-input {
    width: 100%;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
    background: var(--gray-100);
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--gray-900);
}

.password-field {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}

.password-field .auth-panel-input {
    margin-bottom: 0;
    padding-right: 4.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--gray-500);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.password-toggle:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.7;
    fill: none;
}

.password-toggle .password-eye-off {
    display: none;
}

.password-toggle.is-revealed .password-eye {
    display: none;
}

.password-toggle.is-revealed .password-eye-off {
    display: block;
}

.auth-panel-input:-webkit-autofill,
.auth-panel-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--gray-100) inset;
    box-shadow: 0 0 0 1000px var(--gray-100) inset;
    -webkit-text-fill-color: var(--gray-900);
    caret-color: var(--gray-900);
}

.auth-panel-input:focus,
.auth-panel-input:hover {
    outline: none;
    background: var(--gray-50);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

.auth-panel-input::placeholder {
    color: #d1d5db;
    /* lighter placeholder so empty state is clearer */
}

/* Forgot Password */
.auth-forgot {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-600);
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

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

/* Decorative Panel */
.auth-decorative-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: visible;
    background: linear-gradient(135deg,
            var(--primary),
            color-mix(in srgb, var(--primary) 70%, #000));
    color: white;
    z-index: 2;
}

.login-decorative {
    background: linear-gradient(135deg,
            var(--primary),
            color-mix(in srgb, var(--primary) 70%, #000));
    border-radius: 18px;
}

.register-decorative {
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 70%, #000),
            var(--primary));
}


/* ---------- Crossing animation states (desktop) ---------- */

/* Estado inicial: Login visible, Registro fuera de pantalla */
.auth-wrapper:not(.register-mode) .login-view .auth-form-panel,
.auth-wrapper:not(.register-mode) .login-view .auth-decorative-panel {
    transform: translateX(0);
}

.auth-wrapper:not(.register-mode) .register-view .auth-form-panel {
    transform: translateX(100%);
}

.auth-wrapper:not(.register-mode) .register-view .auth-decorative-panel {
    transform: translateX(-100%);
}

/* Modo registro: se cruzan en sentidos opuestos */
.auth-wrapper.register-mode .login-view .auth-form-panel {
    transform: translateX(100%);
}

.auth-wrapper.register-mode .login-view .auth-decorative-panel {
    transform: translateX(-100%);
}

.auth-wrapper.register-mode .register-view .auth-form-panel {
    transform: translateX(0);
}

.auth-wrapper.register-mode .register-view .auth-decorative-panel {
    transform: translateX(0);
}

/* Decorative Images - JavaScript Controlled Carousel */
.auth-decor-img {
    position: absolute;
    background-size: cover;
    background-position: center;
    filter: blur(3px);
    border-radius: 12px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    transition: opacity 1.5s ease-in-out;
    z-index: 0;
}

.auth-decor-img-1 {
    width: 250px;
    height: 280px;
    opacity: 0.15;
    top: 5%;
    right: -20px;
    background-image: url('/public/img/estilos_cuento/acuarela.webp');
    animation: authFloat1 6s ease-in-out infinite;
}

@keyframes authFloat1 {

    0%,
    100% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(-18px, -22px);
    }
}

.auth-decor-img-2 {
    width: 250px;
    height: 250px;
    opacity: 0.12;
    bottom: 30px;
    left: -30px;
    background-image: url('/public/img/estilos_cuento/pencil.webp');
    animation: authFloat2 7s ease-in-out infinite;
}

@keyframes authFloat2 {

    0%,
    100% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(20px, 16px);
    }
}

.auth-decor-img-3 {
    width: 250px;
    height: 250px;
    opacity: 0.15;
    top: 20px;
    left: -40px;
    background-image: url('/public/img/estilos_cuento/cartoon.webp');
    animation: authFloat3 8s ease-in-out infinite;
}

@keyframes authFloat3 {

    0%,
    100% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(-14px, 20px);
    }
}

.auth-decor-img-4 {
    width: 250px;
    height: 250px;
    opacity: 0.1;
    bottom: 40px;
    right: -20px;
    background-image: url('/public/img/estilos_cuento/flat.webp');
    animation: authFloat4 5.5s ease-in-out infinite;
}

@keyframes authFloat4 {

    0%,
    100% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(16px, -20px);
    }
}

.auth-decor-img-5 {
    width: 250px;
    height: 250px;
    opacity: 0.11;
    bottom: 50%;
    left: 0px;
    background-image: url('/public/img/estilos_cuento/flat.webp');
    animation: authFloat5 6.8s ease-in-out infinite;
}

@keyframes authFloat5 {

    0%,
    100% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(-16px, 18px);
    }
}

.auth-welcome-title {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
    font-family: var(--font-display);
}

.auth-welcome-text {
    font-size: 1rem;
    line-height: 1.6;
    color: white;
    text-align: center;
    max-width: 280px;
    margin-bottom: 2rem;
    opacity: 0.95;
    position: relative;
    z-index: 2;
    font-family: var(--font-body);
}

/* Responsive Design */
@media (max-width: 900px) {
    .auth-wrapper {
        height: auto;
        min-height: 600px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
        border-radius: 16px;
    }

    .auth-slider {
        width: 100%;
        transform: translateX(0) !important;
    }

    .auth-container-inner {
        width: 100%;
        grid-template-columns: 1fr;
        position: relative;
        min-height: auto;
    }

    .auth-decorative-panel {
        display: none;
    }

    /* On mobile we just toggle which view is visible using the wrapper mode */
    /* Use opacity for smooth fade transition */
    .auth-wrapper .login-view,
    .auth-wrapper .register-view {
        transition: opacity 0.15s ease;
    }

    .auth-wrapper .login-view {
        display: block;
        opacity: 1;
    }

    .auth-wrapper .register-view {
        display: block;
        opacity: 0;
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .auth-wrapper.register-mode .login-view {
        opacity: 0;
        pointer-events: none;
    }

    .auth-wrapper.register-mode .register-view {
        opacity: 1;
        pointer-events: auto;
    }

    .auth-form-panel {
        padding: 2.5rem 2rem;
        max-width: 640px;
        margin: 0 auto;
        box-shadow: none;
    }

    .auth-panel-title,
    .auth-panel-subtitle {
        text-align: center;
    }

    .auth-forgot {
        text-align: center;
    }
}

@media (max-width: 600px) {
    .auth-container {
        padding: 1rem;
        padding-top: calc(var(--navbar-height) + 1rem);
        /* Mantener espacio para navbar */
    }

    .auth-form-panel {
        padding: 2rem 1.5rem;
        gap: 0.75rem;
    }

    .auth-panel-title {
        font-size: 1.75rem;
    }

    .social-buttons {
        gap: 0.75rem;
    }

    .social-btn {
        width: 40px;
        height: 40px;
    }

    .auth-panel-input {
        font-size: 0.95rem;
    }

    .auth-container .btn-primary,
    .auth-container .btn-google {
        width: 100%;
    }
}

/* Mobile-only switch links between login/register */
.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .mobile-only {
        display: block;
    }
}

.auth-switch-text {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.9rem;
    color: var(--gray-600);
}

.auth-switch-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-switch-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ========================================
   Verification Code Page
   ======================================== */

.verify-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: calc(var(--navbar-height) + 2rem);
}

.verify-panel {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    text-align: center;
}

.verify-panel .auth-panel-title,
.verify-panel .auth-panel-subtitle {
    text-align: center;
    font-family: var(--font-sans);
}

.verify-panel .auth-panel-subtitle {
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.verify-panel .auth-panel-input {
    text-align: left;
}

.verify-code-container {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 1.5rem auto;
    width: 100%;
    max-width: 360px;
}

.verify-code-input {
    width: 100%;
    height: clamp(44px, 8vw, 64px);
    box-sizing: border-box;
    flex: 0 0 auto;
    line-height: 1;
    padding: 0;
    text-align: center;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    font-weight: 600;
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: var(--gray-50);
    color: var(--gray-900);
    transition: all 0.2s ease;
}

.verify-code-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.verify-code-input:hover:not(:focus) {
    border-color: var(--gray-300);
}

.verify-email {
    word-break: break-all;
}

.verify-resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* Auth Error Message */
.auth-error {
    background: color-mix(in srgb, #ef4444 10%, transparent);
    border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
}

.auth-success {
    background: color-mix(in srgb, #22c55e 12%, transparent);
    border: 1px solid color-mix(in srgb, #22c55e 30%, transparent);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    color: #15803d;
}

@media (max-width: 600px) {
    .verify-wrapper {
        padding: 1rem;
        padding-top: calc(var(--navbar-height) + 1rem);
    }

    .verify-panel {
        padding: 2rem 1.5rem;
    }

    .verify-code-container {
        gap: 8px;
        max-width: 320px;
    }
}

/* ========================================
   Button Loading Spinner
   ======================================== */
.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

/* ========================================
   Password Validation Feedback
   Usa mismos colores que auth-error/auth-success
   ======================================== */
.password-feedback {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    animation: feedbackSlideIn 0.2s ease-out;
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 500px) {
    .password-rules {
        grid-template-columns: 1fr;
    }
}

.password-rule {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    transition: color 0.2s ease;
}

.password-rule .rule-icon {
    font-size: 0.75rem;
    width: 1rem;
    text-align: center;
    transition: color 0.2s ease;
}

/* Mismo verde que auth-success: #22c55e */
.password-rule.rule-passed {
    color: #15803d;
}

.password-rule.rule-passed .rule-icon {
    color: #22c55e;
    font-weight: 600;
}

.password-rule.rule-failed {
    color: var(--gray-500);
}

/* Password Strength Bar */
.password-strength {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.strength-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Colores consistentes con auth-error (#ef4444) y auth-success (#22c55e) */
.strength-fill.strength-very-weak {
    background: #ef4444;
}

.strength-fill.strength-weak {
    background: #f97316;
}

.strength-fill.strength-fair {
    background: #eab308;
}

.strength-fill.strength-good {
    background: #84cc16;
}

.strength-fill.strength-strong {
    background: #22c55e;
}

.strength-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.strength-text {
    font-weight: 600;
}

/* Disabled button state */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
