/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

body {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    position: relative;
}

/* Efecto de partículas flotantes */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Barra superior fija y responsiva */
.top-bar {
    background-color: #2a2828;
    padding: 1rem clamp(1rem, 5vw, 2.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2828;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

.top-bar-brand {
    font-weight: bold;
    font-style: oblique;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: #ffa500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.top-bar-links a {
    color: #4a5568;
    text-decoration: none;
    margin-left: clamp(0.8rem, 2vw, 1.5rem);
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    transition: color 0.3s ease;
}

.top-bar-links a:hover {
    color: #ffa500;
    text-decoration: underline;
}

/* Contenedor principal responsive */
.container_mobile {
    display: flex;
    min-height: 100vh;
    margin-top: 73px; /* Altura de la barra superior */
    position: relative;
    z-index: 2;
}

/* Sección informativa (lado izquierdo) */
a.informative_mobile {
    flex: 0 0 63%;
    background: linear-gradient(135deg, #1a62c6 0%, #2980b9 50%, #3498db 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* Efecto de ondas animadas en el fondo */
a.informative_mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 70%),
        radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(180deg); }
}

a.informative_mobile .img_informative {
    max-width: 106.5%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
    padding-bottom: 50px;
}

/* Sección de login (lado derecho) */
.fondo_login {
    flex: 0 0 39%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    position: relative;
    min-height: calc(100vh - 73px);
}

.fondo_login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%),
        linear-gradient(-45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    pointer-events: none;
}

/* Caja de login */
.view.login {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
    padding: clamp(2rem, 4vw, 3rem) !important;
    max-width: min(5000px, 90vw);
    width: 100%;
    margin: 0 !important;
    border-radius: 24px !important;
    position: relative;
    z-index: 3;
    transition: all 0.3s ease;
}

.view.login:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 35px 60px -12px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
}

.login > IMG {
    margin-bottom: 2rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    max-width: 100%;
    height: auto;
}

/* Labels de input */
p.input_login {
    font-weight: 600;
    font-size: clamp(11px, 1.5vw, 13px);
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 4px;
}

/* Inputs y select */
#user_name,
#user_password,
select[name='login_language'] {
    width: 100%;
    padding: clamp(12px, 2vw, 16px) clamp(16px, 2.5vw, 20px);
    border: 2px solid transparent !important;
    border-radius: 12px !important;
    background: rgba(248, 250, 252, 0.8) !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: clamp(14px, 2vw, 16px);
    color: #2d3748;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

#user_name:focus,
#user_password:focus,
select[name='login_language']:focus {
    outline: none;
    border-color: #3b82f6 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 4px 12px rgba(59, 130, 246, 0.15) !important;
    transform: translateY(-2px);
}

#user_name:hover,
#user_password:hover,
select[name='login_language']:hover {
    border-color: rgba(59, 130, 246, 0.3) !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

/* Botón de login */
.boton_login {
    width: 100%;
    background: linear-gradient(135deg, #002eff 0%, #8791bb 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: clamp(14px, 2vw, 16px) !important;
    font-size: clamp(14px, 2vw, 16px) !important;
    font-weight: 600;
    margin-top: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.boton_login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.boton_login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(135deg, #2f80db 0%, #2641da 100%) !important;
}

.boton_login:hover::before {
    left: 100%;
}

.boton_login:active {
    transform: translateY(0);
}

/* Enlaces adicionales */
.login_more a,
a.boton_registro {
    color: #667eea !important;
    font-size: clamp(13px, 1.8vw, 14px) !important;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.login_more a::after,
a.boton_registro::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.login_more a:hover::after,
a.boton_registro:hover::after {
    width: 100%;
}

.login_more a:hover,
a.boton_registro:hover {
    color: #5a67d8 !important;
}

/* Mensajes de error */
.error {
    display: block;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #b91c1c;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #fecaca;
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.1);
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
    font-size: clamp(13px, 1.8vw, 14px);
}

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

#post_error:empty {
    display: none !important;
}

#generate_success {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: none !important;
    height: 0 !important;
    min-height: 0 !important;
    font-size: 0 !important;
    overflow: hidden;
}

/* Tablas de login */
table.tabla_login {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f5f8fd;
    margin: 0.5rem 0;
}

table.tabla_login td {
    padding: clamp(8px, 1.5vw, 12px);
    vertical-align: middle;
    text-align: left;
}

table.tabla_login input,
table.tabla_login select {
    width: 100%;
    border: none;
    background: transparent;
    font-size: inherit;
}

/* Contenedor para imagen informativa en móvil */
.responsive_informative_container {
    display: none;
}

/* Animaciones adicionales */
.view.login {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view.login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 24px;
    pointer-events: none;
}

/* === RESPONSIVE BREAKPOINTS === */

/* Tablets grandes */
@media (max-width: 1200px) {
    .container_mobile {
        flex-direction: row;
    }
    
    a.informative_mobile {
        flex: 0 0 50%;
    }
    
    .fondo_login {
        flex: 0 0 50%;
    }
}

/* Tablets */
@media (max-width: 900px) {
    a.informative_mobile {
        flex: 0 0 45%;
    }
    
    .fondo_login {
        flex: 0 0 55%;
    }
    
    .view.login {
        max-width: min(380px, 95vw);
    }
}

/* Mobile breakpoint */
@media (max-width: 800px) {
    .top-bar {
        padding: 0.8rem 1rem;
        position: fixed;
        top: 0;
        z-index: 1000;
    }
    
    .container_mobile {
        display: block !important;
        background: linear-gradient(135deg, #1a62c6 0%, #2980b9 100%);
        margin-top: 60px; /* Altura reducida de barra en móvil */
        min-height: calc(100vh - 60px);
        padding: 0; /* ELIMINAMOS PADDING DEL CONTENEDOR */
    }
    
    /* Ocultar la versión de escritorio de la imagen informativa */
    .informative_mobile, 
    .img_informative {
        display: none !important;
    }
    
    /* Fondo principal en móvil */
    .fondo_login {
        background: transparent !important;
        backdrop-filter: none !important;
        width: 100% !important;
        min-height: calc(100vh - 60px) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important; /* ELIMINAMOS PADDING DEL FONDO LOGIN */
        position: relative;
        overflow: hidden;
    }
    
    /* Animación de fondo para móvil */
    .fondo_login::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 200%;
        height: 200%;
        background: 
            radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 70%),
            radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
        animation: float-mobile 15s ease-in-out infinite;
        pointer-events: none;
    }
    
    @keyframes float-mobile {
        0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
        50% { transform: translate(-50%, -50%) rotate(180deg); }
    }
    
    /* Mostrar imagen informativa en móvil - OCUPANDO TODO EL ANCHO */
    .responsive_informative_container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important; /* SIN PADDING LATERAL */
        margin: 0 !important; /* SIN MARGINS */
        margin-bottom: clamp(1rem, 3vw, 2rem) !important; /* SOLO MARGIN BOTTOM */
        background: transparent;
        position: relative;
        overflow: hidden;
        width: 100vw !important; /* ANCHO COMPLETO DE LA VIEWPORT */
        left: 50% !important; /* POSICIONAR DESDE EL CENTRO */
        right: 50% !important;
        margin-left: -50vw !important; /* EXTENDER COMPLETAMENTE A LA IZQUIERDA */
        margin-right: -50vw !important; /* EXTENDER COMPLETAMENTE A LA DERECHA */
    }

    .responsive_informative_container img {
        max-width: none !important; /* QUITAR LIMITACIÓN DE ANCHO */
        width: 100vw !important; /* ANCHO COMPLETO DE LA VIEWPORT */
        height: auto;
        display: block;
        margin: 0;
        filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        z-index: 2;
        object-fit: cover; /* ASEGURAR QUE LA IMAGEN CUBRA TODO EL ESPACIO */
        object-position: center; /* CENTRAR LA IMAGEN */
    }
    
    /* Caja de login en móvil */
    .view.login {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 
            0 25px 50px -12px rgba(0, 0, 0, 0.25),
            0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
        padding: clamp(1.5rem, 4vw, 2.5rem) !important;
        max-width: min(400px, 95vw) !important;
        width: 100% !important;
        border-radius: 24px !important;
        margin: 0 auto !important;
        margin-top: 0 !important; /* SIN MARGIN TOP PARA PEGARLO A LA IMAGEN */
    }
    
    /* Desactivar efectos hover en móvil */
    .view.login:hover {
        transform: none !important;
    }
    
    .boton_login:hover {
        transform: none !important;
    }
    
    #user_name:focus,
    #user_password:focus,
    select[name='login_language']:focus {
        transform: none !important;
    }
    
    /* Ajustes específicos para móviles pequeños */
    .login > IMG {
        max-width: min(250px, 80vw);
        height: auto;
    }
}

/* Mobile pequeño */
@media (max-width: 480px) {
    .container_mobile {
        margin-top: 55px;
        min-height: calc(100vh - 55px);
        padding: 0; /* SIN PADDING */
    }
    
    .fondo_login {
        min-height: calc(100vh - 55px) !important;
        padding: 0 1rem !important; /* SOLO PADDING LATERAL MÍNIMO PARA LA CAJA DE LOGIN */
    }
    
    .view.login {
        padding: 1.5rem !important;
        max-width: min(350px, 95vw) !important;
    }
    
    .responsive_informative_container {
        width: 100vw !important;
        left: 50% !important;
        right: 50% !important;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
        padding: 0 !important;
    }
    
    .responsive_informative_container img {
        max-width: none !important;
        width: 100vw !important;
    }
    
    .login > IMG {
        max-width: min(200px, 70vw);
    }
}

/* Mobile extra pequeño */
@media (max-width: 320px) {
    .top-bar {
        padding: 0.6rem 0.8rem;
    }
    
    .top-bar-brand {
        font-size: 1.1rem;
    }
    
    .view.login {
        padding: 1.2rem !important;
        max-width: 95vw !important;
    }
    
    .responsive_informative_container {
        width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        padding: 0 !important;
    }
    
    .responsive_informative_container img {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .login > IMG {
        max-width: min(160px, 65vw);
    }
}