/* ==========================================================
   JUPER SISTEM - AUTH CSS (corregido)
   Diseño exclusivo de inicio de sesión
   ========================================================== */

/* ==========================================================
   RESPALDO DE BASE.CSS
   Variables y reset duplicados a propósito: si base.css no carga
   (404, caché, archivo cortado), el login se ve igual.
   ========================================================== */
:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F6FA;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --brand-blue: #1E6DFF;
    --brand-gradient: linear-gradient(135deg, #EC0CA0 0%, #7B2FF7 45%, #1E6DFF 75%, #4DC9F6 100%);
    --border: #E5E7EB;
    --text-primary-rgb: 26, 26, 46;
    --text-secondary-rgb: 107, 114, 128;
    --brand-blue-rgb: 30, 109, 255;
    --border-rgb: 229, 231, 235;
}

* {
    box-sizing: border-box;
    scrollbar-width: none;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Poppins", Arial, Helvetica, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ==========================================================
   FUENTE ESTABLE EN TODOS LOS CAMPOS (FIX TAMAÑO AUTOFILL)
   ========================================================== */
:root {
    --auth-font: "Poppins", Arial, Helvetica, sans-serif;
    --auth-input-size: 16px;
}

.auth-input,
.iti input,
.iti input[type="tel"],
.iti input[type="text"],
.iti__search-input,
#authWhatsapp,
#authPassword {
    font-family: var(--auth-font) !important;
    font-size: var(--auth-input-size) !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
    line-height: normal !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ==========================================================
   CONTENEDOR PRINCIPAL
   ========================================================== */
.auth-wrap {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow-x: clip;
}

/* ==========================================================
   PANEL DEL LOGIN
   ========================================================== */
.auth-panel-izquierdo {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    background: #FFFFFF;
    position: relative;
    overflow: hidden;
}

/* EFECTO DE LUZ DETRÁS DE LA TARJETA */
.auth-panel-izquierdo::before {
    content: '';
    position: absolute;
    left: -10%;
    right: -10%;
    top: 50%;
    transform: translateY(-50%);
    height: 200px;
    background: var(--brand-gradient);
    filter: blur(90px);
    opacity: 0.65;
    z-index: 0;
    pointer-events: none;
}

/* ==========================================================
   TARJETA DE LOGIN
   ========================================================== */
.auth-card {
    width: calc(100% - 32px);
    max-width: 420px;
    min-width: 0;
    position: relative;
    z-index: 1;
    background: #FFFFFF;
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
        0 0 90px rgba(236, 12, 160, 0.14),
        0 0 130px rgba(123, 47, 247, 0.12),
        0 0 170px rgba(30, 109, 255, 0.10),
        0 10px 50px rgba(26, 26, 46, 0.06);
}

/* ==========================================================
   LOGO Y NOMBRE
   ========================================================== */
.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-brand-icono {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.auth-brand-texto {
    font-family: "Poppins", sans-serif;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.auth-brand-texto strong {
    font-weight: 800;
}

/* ==========================================================
   MENSAJE DE ERROR
   ========================================================== */
.auth-error {
    display: none;
    align-items: center;
    gap: 8px;
    background-color: rgba(var(--border-rgb), 0.2);
    border: 1px solid rgba(var(--text-secondary-rgb), 0.3);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 18px;
}

.auth-error.mostrar {
    display: flex;
}

.auth-error span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ==========================================================
   FORMULARIO
   ========================================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    max-width: 100%;
}

.auth-campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    min-width: 0;
    max-width: 100%;
}

.auth-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* INPUTS */
.auth-input {
    width: 100%;
    max-width: 100%;
    height: 46px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.auth-input::placeholder {
    color: rgba(var(--text-primary-rgb), 0.35);
}

.auth-input:focus {
    background: var(--bg-primary);
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(var(--brand-blue-rgb), 0.12);
}

/* ==========================================================
   MOSTRAR / OCULTAR CONTRASEÑA
   ========================================================== */
.auth-input-wrap {
    position: relative;
    min-width: 0;
    max-width: 100%;
}

.auth-input-wrap .auth-input {
    padding-right: 44px;
}

.auth-toggle-pass {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(var(--text-primary-rgb), 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition:
        color 0.2s ease,
        background-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.auth-toggle-pass:hover {
    color: var(--brand-blue);
    background-color: rgba(var(--brand-blue-rgb), 0.15);
}

/* OCULTAR EL ÍCONO NATIVO DE CONTRASEÑA */
.auth-input::-ms-reveal,
.auth-input::-ms-clear {
    display: none;
}

/* ==========================================================
   RECORDARME
   ========================================================== */
.auth-fila-opciones {
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-recordarme {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1.6vw, 8px);
    min-width: 0;
    font-size: clamp(0.56rem, 3.3vw, 0.85rem);
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.auth-recordarme input[type="checkbox"] {
    flex-shrink: 0;
    width: clamp(13px, 4vw, 16px);
    height: clamp(13px, 4vw, 16px);
    accent-color: var(--brand-blue);
    cursor: pointer;
}

/* ==========================================================
   BOTÓN INICIAR SESIÓN
   ========================================================== */
.auth-btn-enviar {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    background: linear-gradient(
        135deg,
        #3D82FF 0%,
        var(--brand-blue) 50%,
        #144FC4 100%
    );
    color: var(--bg-primary);
    border: none;
    border-radius: 14px;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    margin-top: 4px;
    box-shadow: 0 6px 20px rgba(var(--brand-blue-rgb), 0.25);
    transition:
        filter 0.2s ease,
        transform 0.15s ease;
}

.auth-btn-enviar:hover {
    filter: brightness(1.1);
}

.auth-btn-enviar:active {
    transform: scale(0.98);
}

.auth-btn-enviar:disabled {
    background: rgba(var(--brand-blue-rgb), 0.35);
    color: rgba(var(--text-primary-rgb), 0.55);
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
}

/* ==========================================================
   WHATSAPP - SELECTOR INTERNACIONAL (intl-tel-input)
   ========================================================== */
.iti {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.iti input {
    width: 100%;
    max-width: 100%;
    height: 46px;
    padding: 13px 14px 13px 90px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.iti input:focus {
    border-color: var(--brand-blue);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-blue-rgb), 0.12);
}

/* PAÍS SELECCIONADO */
.iti__selected-flag {
    padding-left: 12px;
    border-right: 1px solid rgba(var(--text-primary-rgb), 0.15);
}

.iti__selected-dial-code {
    color: var(--text-primary);
}

/* ==========================================================
   DESPLEGABLE DE PAÍSES
   ========================================================== */
.iti__dropdown-content {
    max-width: calc(100vw - 48px);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(26, 26, 46, 0.15);
    border: 1px solid var(--border);
    margin-top: 6px;
}

.iti__country-list {
    background-color: var(--bg-primary);
    border: none;
    border-radius: 14px;
    max-width: 100%;
    max-height: 220px;
    padding: 6px;
    color: var(--text-primary);
    overflow-x: hidden;
}

.iti__country {
    padding: 10px 12px;
    border-radius: 10px;
    font-family: "Poppins", sans-serif;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.iti__country.iti__highlight {
    background-color: rgba(var(--brand-blue-rgb), 0.1);
}

.iti__country-name {
    min-width: 0;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iti__dial-code {
    color: var(--text-secondary);
    font-weight: 500;
}

.iti__flag-box {
    margin-right: 2px;
}

/* ==========================================================
   BUSCADOR DE PAÍSES
   ========================================================== */
.iti__dropdown-content .iti__search-input,
.iti__country-list .iti__search-input,
input.iti__search-input {
    width: calc(100% - 12px) !important;
    height: 42px !important;
    padding: 10px 14px !important;
    margin: 6px 6px 10px !important;
    box-sizing: border-box !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    outline: none !important;
}

.iti__search-input:focus {
    border-color: var(--brand-blue) !important;
    background-color: var(--bg-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-blue-rgb), 0.12) !important;
}

.iti__search-input::placeholder {
    color: rgba(var(--text-primary-rgb), 0.35);
}

.iti__country-list::-webkit-scrollbar {
    width: 6px;
}

.iti__country-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* ==========================================================
   DISEÑO RESPONSIVE
   ========================================================== */
@media (max-width: 899px) {
    .auth-panel-izquierdo {
        min-height: 100svh;
        align-items: safe center;
        justify-content: center;
        overflow-y: auto;
        padding: 24px 0;
    }
}

@media (max-width: 420px) {
    .auth-card {
        padding: 28px 22px;
        border-radius: 20px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        width: calc(100% - 24px);
        padding: 24px 16px;
        border-radius: 18px;
    }
}

/* EVITAR ZOOM AUTOMÁTICO EN INPUTS MÓVILES */
@media (pointer: coarse) {
    #authWhatsapp,
    #authPassword,
    .iti input,
    .iti__search-input {
        font-size: 16px !important;
    }
}

/* ==========================================================
   FIX AUTOCOMPLETADO DE CHROME (WhatsApp + contraseña)
   Al rellenar el gestor de contraseñas, Chrome aplica
   `appearance: menulist-button` (control nativo del sistema),
   que ignora font-size/font-family hasta que se hace clic.
   Anulamos ese appearance para que SIEMPRE use nuestro estilo.
   ========================================================== */
.auth-input,
.iti input,
#authWhatsapp,
#authPassword {
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Un selector por regla: si uno no existe en el navegador,
   no invalida a los demás */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active,
.iti input:-webkit-autofill,
.iti input:-webkit-autofill:hover,
.iti input:-webkit-autofill:focus,
.iti input:-webkit-autofill:active {
    -webkit-appearance: none !important;
    appearance: none !important;
    -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
    box-shadow: 0 0 0 1000px #FFFFFF inset !important;
    -webkit-text-fill-color: #1A1A2E !important;
    caret-color: #1A1A2E !important;
    font-family: "Poppins", Arial, Helvetica, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    transition: background-color 5000s ease-in-out 0s;
}

.auth-input:autofill,
.iti input:autofill {
    -webkit-appearance: none !important;
    appearance: none !important;
    font-family: "Poppins", Arial, Helvetica, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
}