/* ============================================
   AUTH PAGES - Login & Registro
   Prestir - Diseño profesional dividido
   ============================================ */

:root {
    --auth-primary: #021D36;
    --auth-primary-hover: #032d54;
    --auth-bg: #F8FAFC;
    --auth-white: #ffffff;
    --auth-text: #1e293b;
    --auth-text-light: #64748b;
    --auth-border: #e2e8f0;
    --auth-radius: 12px;
    --auth-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --auth-shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--auth-bg);
    color: var(--auth-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ── Layout principal dividido ── */
.auth-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ── Panel de imagen ── */
.auth-image-panel {
    flex: 1;
    background-color: #F8FAFC;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-image-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: none;
    filter: none;
    animation: none;
}

@keyframes authImageFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
}

.auth-image-overlay {
    position: absolute;
    bottom: 48px;
    left: 48px;
    right: 48px;
    color: var(--auth-white);
}

.auth-image-overlay h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-image-overlay p {
    font-size: 15px;
    opacity: 0.7;
    font-weight: 300;
    line-height: 1.5;
}

/* ── Panel del formulario ── */
.auth-form-panel {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background-color: var(--auth-bg);
    height: 100%;
    overflow-y: auto;
}

.auth-form-container {
    width: 100%;
    max-width: 360px;
}

/* ── Logo / Branding ── */
.auth-brand {
    margin-bottom: 20px;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-brand-logo img {
    width: 30px;
    height: 30px;
}

.auth-brand-logo span {
    font-size: 32px;
    font-weight: 700;
    color: var(--auth-primary);
    letter-spacing: -0.5px;
}

.auth-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--auth-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-brand p {
    font-size: 14px;
    color: var(--auth-text-light);
    font-weight: 400;
    line-height: 1.4;
    max-width: 100%;
}

/* ── Formulario ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .auth-grid-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text);
}

.auth-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--auth-text);
    background-color: var(--auth-white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input::placeholder {
    color: #94a3b8;
    font-weight: 300;
}

.auth-field input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(2, 29, 54, 0.08);
}

.auth-field input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

/* ── Campo de contraseña con toggle ── */
.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper input {
    padding-right: 48px;
}

.auth-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--auth-text-light);
    font-size: 18px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

/* ── Botón principal ── */
.auth-btn {
    width: 100%;
    padding: 11px 22px;
    background-color: var(--auth-primary);
    color: var(--auth-white);
    border: none;
    border-radius: var(--auth-radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 2px;
    position: relative;
    overflow: hidden;
}

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

.auth-btn:active {
    transform: scale(0.99);
}

.auth-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.auth-btn.loading {
    color: transparent;
    pointer-events: none;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--auth-white);
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
    top: 50%;
    left: 50%;
    margin-top: -11px;
    margin-left: -11px;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ── Footer del formulario ── */
.auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--auth-text-light);
}

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

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

/* ── Mensaje de error ── */
.auth-error {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--auth-radius);
    color: #991b1b;
    font-size: 14px;
    font-weight: 400;
    animation: authShake 0.4s ease;
}

.auth-error.visible {
    display: flex;
}

.auth-error svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0;
    color: var(--auth-text-light);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--auth-border);
}

/* ── Responsivo ── */
@media (max-width: 1024px) {
    .auth-wrapper {
        flex-direction: column;
        height: 100vh;
        min-height: 100vh;
    }

    /* Ocultar sección azul/imagen en tablet y móvil */
    .auth-image-panel {
        display: none !important;
    }

    .auth-form-panel {
        flex: 1;
        width: 100%;
        max-width: 100%;
        padding: 30px 24px;
        min-height: 100vh;
        overflow-y: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .auth-form-container {
        width: 100%;
        max-width: 400px;
        margin: auto;
    }

    .auth-brand h1 {
        font-size: 24px;
    }

    .auth-brand-logo span {
        font-size: 32px;
    }

    .auth-wrapper--login {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-form-panel {
        padding: 24px 20px;
    }

    .auth-brand h1 {
        font-size: 22px;
    }

    .auth-field input {
        padding: 11px 14px;
        font-size: 14px;
    }

    .auth-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}
