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

body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-repeat: no-repeat;
    background-position: center;
    background-attachment: fixed;
    background-size: cover;
}

/* Modo claro: overlay suave para que se vea más la imagen de fondo */
body {
    background-image: radial-gradient(circle at 10% 20%, rgba(15, 87, 161, 0.05) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(7, 87, 161, 0.08) 0%, transparent 40%),
                      linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(226, 232, 240, 0.85) 100%),
                      url('https://energonec.es/wp-content/uploads/2025/06/fondovideo.jpg');
    color: #1e293b;
    overflow-x: hidden;
}

/* Modo oscuro */
html.dark-mode body {
    background-image: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.65)),
        url('https://energonec.es/wp-content/uploads/2025/06/fondovideo.jpg');
}

/* Contenedor principal - aprovecha el espacio de la pantalla */
.login-container {
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    width: min(94vw, 1000px);
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    margin: 5px auto;
    box-shadow: 0 20px 50px rgba(7, 87, 161, 0.2);
}

/* Modo claro - sofisticado glassmorphism */
.login-container {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 25px 65px rgba(7, 87, 161, 0.15),
                0 0 1px rgba(7, 87, 161, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Modo oscuro */
html.dark-mode .login-container {
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.4),
                0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Header del login */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px 5px;
    text-align: center;
}

.tagline {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 2px;
    opacity: 0.8;
}

/* Modo claro */
.tagline { color: #0f57a1; }

/* Modo oscuro */
html.dark-mode .tagline { color: rgba(255, 255, 255, 0.7); }

/* Contenedor del formulario */
.login-form-container {
    display: flex;
    flex: 1;
}

/* Formulario de login */
.login-form {
    flex: 1.2;
    padding: 20px 50px 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
}

/* Modo claro */
.login-form { color: #334155; }

/* Modo oscuro */
html.dark-mode .login-form { color: white; }

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.logo-img {
    max-width: 130px;
    height: auto;
}

/* Modo claro: logo normal */
.logo-img { filter: none; }

/* Modo oscuro: logo blanco */
html.dark-mode .logo-img { filter: brightness(0) invert(1); }

.login-form h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 800;
    background: linear-gradient(135deg, #0f57a1 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Modo oscuro */
html.dark-mode .login-form h1 { 
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Modo claro */
.login-subtitle { color: #475569; }

/* Modo oscuro */
html.dark-mode .login-subtitle { color: rgba(255, 255, 255, 0.8); }

/* Estilos del formulario */
.form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Modo claro */
.form-group label { color: #334155; }

/* Modo oscuro */
html.dark-mode .form-group label { color: white; }

.form-group label i {
    color: #0f57a1;
    font-size: 0.8rem;
    opacity: 0.7;
}

html.dark-mode .form-group label i {
    color: #60a5fa;
}

/* Inputs Premium */
.form-group input {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(15, 87, 161, 0.15);
    color: #1e293b;
}

.form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1),
                0 10px 15px -3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

/* Modo oscuro */
html.dark-mode .form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

html.dark-mode .form-group input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

/* Password input wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

/* Modo claro */
.toggle-password { color: #475569; }

/* Modo oscuro */
html.dark-mode .toggle-password { color: white; }

.toggle-password:hover {
    opacity: 1;
}

/* Opciones */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

/* Modo claro */
.form-options { color: #475569; }

/* Modo oscuro */
html.dark-mode .form-options { color: white; }

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    accent-color: #0f57a1;
    width: 16px;
    height: 16px;
}

.forgot-password {
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

/* Modo claro */
.forgot-password { color: #0f57a1; }
.forgot-password:hover { color: #0757A1; text-decoration: underline; }

/* Modo oscuro */
html.dark-mode .forgot-password { color: #b2cce3; }
html.dark-mode .forgot-password:hover { color: white; text-decoration: underline; }

/* Botón Login Premium */
.login-btn {
    background: linear-gradient(135deg, #0f57a1 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    box-shadow: 0 8px 15px -4px rgba(15, 87, 161, 0.4);
    position: relative;
    overflow: hidden;
}

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

.login-btn:hover::after {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -10px rgba(15, 87, 161, 0.5);
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
}

.login-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.login-btn i {
    display: none;
    /* Simplificado */
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    font-size: 0.9rem;
}

/* Modo claro */
.login-footer { border-top: 1px solid rgba(15, 87, 161, 0.2); }
.login-footer p { color: #64748b; }
.login-footer a { color: #0f57a1; font-weight: 600; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* Modo oscuro */
html.dark-mode .login-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); }
html.dark-mode .login-footer p { color: rgba(255, 255, 255, 0.7); }
html.dark-mode .login-footer a { color: white; }

/* Panel informativo (Derecha) */
.login-info {
    flex: 1;
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-info {
    background: linear-gradient(165deg, #0f57a1 0%, #1e40af 100%);
    color: white;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.1);
}

/* Modo oscuro */
html.dark-mode .login-info {
    background: linear-gradient(165deg, #0f172a 0%, #172554 100%);
}

.login-info h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -0.2px;
    position: relative;
}

.login-info h3::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 60px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}

.features-list li:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(8px);
}

.features-list i {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    font-size: 1.2rem;
}

.company-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.company-info p {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.company-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
    padding: 8px 18px;
    border: 1px solid white;
    border-radius: 50px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.company-link:hover {
    background: white;
    color: #0f57a1;
}

/* Modal de carga */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    width: min(90vw, 450px);
}

/* Modo oscuro: modal de carga coherente */
html.dark-mode .modal-content {
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

html.dark-mode .modal-content p {
    color: #e2e8f0;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: none;
    background-image: url('https://energonec.es/wp-content/uploads/2025/05/favicon2-44x44.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: spin-logo 2s linear infinite;
    margin: 0 auto 35px;
}

@keyframes spin-logo {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mensajes de error/éxito */
.error-message {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message {
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Responsive design updates for 2026 */

/* Desktop & Large Tablets (Above 768px) */
@media (min-width: 769px) {
    .login-form {
        flex: 1.2;
        padding: 40px 60px;
    }
    
    .login-info {
        flex: 1;
        padding: 40px 40px;
    }
}

/* Tablets and small desktops (Up to 1024px) */
@media (max-width: 1024px) {
    .login-container {
        width: 94vw;
        max-width: 900px;
    }
}

/* Mobile & Small Tablets (Up to 768px) - STACKING POINT */
@media (max-width: 768px) {
    .login-container {
        max-width: 500px;
        width: 94vw;
        margin: 10px auto;
    }

    .login-form-container {
        flex-direction: column;
    }

    .login-header {
        padding: 20px 20px 5px;
    }

    .login-form {
        padding: 20px 30px;
    }

    .login-info {
        padding: 20px 30px;
        order: 2;
    }

    .logo-img {
        max-width: 120px;
    }

    .login-form h2 {
        font-size: 1.6rem;
    }
}

/* Phones (Up to 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .login-container {
        border-radius: 15px;
    }

    .login-form {
        padding: 30px 20px;
    }

    .login-form h1 {
        font-size: 1.4rem;
    }

    .login-subtitle {
        margin-bottom: 25px;
        font-size: 0.85rem;
    }

    .login-info {
        padding: 30px 20px;
    }

    .login-info h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .features-list li {
        font-size: 0.9rem;
        gap: 10px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .login-btn {
        width: 100%;
        padding: 14px;
        border-radius: 12px;
    }
}

/* Extra small phones (Up to 360px) */
@media (max-width: 360px) {
    .logo-img {
        max-width: 140px;
    }

    .tagline {
        font-size: 0.7rem;
    }

    .login-form h1 {
        font-size: 1.2rem;
    }
}

/* Modal de Información (Dinámico desde JS) - Fix para botón Olvidé Contraseña */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.info-modal.is-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.info-modal-content {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

/* Modo oscuro: modal informativo coherente con tema */
html.dark-mode .info-modal-content {
    background: #1e293b;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

html.dark-mode .info-modal-body {
    color: #e2e8f0;
}

html.dark-mode .info-modal-body strong {
    color: #60a5fa;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.info-modal-header {
    background: #0f57a1;
    padding: 30px 20px 20px;
    text-align: center;
    color: white;
}

.info-modal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.1);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.info-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
}

.info-modal-body {
    padding: 30px;
    color: #333;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
}

.info-modal-body strong {
    color: #0f57a1;
}

.info-modal-footer {
    padding: 0 30px 30px;
    text-align: center;
}

.btn-info-accept {
    background: #0f57a1;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-info-accept:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 87, 161, 0.3);
}