* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    min-height: 100vh;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7fb;
    -webkit-font-smoothing: antialiased;
    color: #111827;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================
   NUEVO LAYOUT DIVIDIDO
   ========================= */
.auth-layout {
    display: flex;
    align-items: stretch;
    flex: 1; /* Fill the #app container */
    min-height: 100vh; /* Asegura que cubra la pantalla en desktop */
    background-color: #f4f7fb;
    width: 100%;
    margin: 0;
}

/* Panel Izquierdo (Promocional) */
.auth-promo-panel {
    flex: 1.2;
    background: #1e3a8a; /* Azul corporativo base */
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.8) 0, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(30, 64, 175, 0.9) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.8) 0, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centrado vertical */
    align-items: center;
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-promo-panel::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 30px 30px; opacity: 0.2; pointer-events: none;
}

.auth-promo-content {
    text-align: left;
    max-width: 580px;
    position: relative;
    z-index: 2;
}

.auth-promo-title {
    font-size: 46px; font-weight: 800; line-height: 1.15; margin: 0 0 20px 0; letter-spacing: -1px;
    background: linear-gradient(to right, #ffffff, #e0e7ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-promo-subtitle { 
    font-size: 19px; font-weight: 400; line-height: 1.6; margin: 0 0 40px 0; color: #bfdbfe; 
}

.auth-promo-image-container {
    width: 100%;
    max-width: 600px;
    position: relative; 
    z-index: 2;
    transition: transform 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-promo-image-container:hover { transform: translateY(-5px); }

.auth-promo-image {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 25px 25px rgba(0, 0, 0, 0.3)); /* Sombra a los bordes de la imagen transparente */
}

/* Panel Derecho (Formulario) */
.auth-form-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: #f4f7fb;
}

/* =========================
   ESTILOS DEL FORMULARIO
   ========================= */
.auth-wrapper {
    width: 100%;
    min-height: 100vh; /* Para que al menos cubra la altura disponible en desktop */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

/* Decoraciones de fondo sutiles para la parte clara */
.auth-wrapper::before {
    content: ''; position: absolute; top: -10%; left: -10%; width: 120%; height: 120%;
    background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 40%);
    pointer-events: none; z-index: 0;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 10;
    animation: fadeInUp 0.6s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    height: 40px;
    width: auto;
    margin-bottom: 24px;
    transition: transform 0.3s ease;
}

.auth-logo:hover {
    transform: scale(1.02);
}

.auth-title {
    font-size: 28px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 15px;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

.auth-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    padding: 32px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.input-label {
    display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px;
}

.form-input {
    width: 100%; height: 46px; padding: 0 14px; border: 1px solid #d1d5db; border-radius: 10px;
    font-size: 14px; background: #ffffff; transition: all 0.2s ease; color: #111827;
    box-sizing: border-box; font-family: 'Inter', sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-input:focus {
    outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder { color: #9ca3af; font-weight: 400; }

.form-input.is-invalid {
    border-color: #ef4444; background: #fef2f2;
}

.form-actions {
    display: flex; justify-content: flex-end; margin-bottom: 24px; margin-top: -8px;
}

.forgot-password {
    color: #3b82f6; text-decoration: none; font-size: 13px; font-weight: 600; transition: all 0.2s;
}

.forgot-password:hover { color: #2563eb; text-decoration: underline; }

.error-message {
    color: #ef4444; font-size: 12px; margin-top: 6px; display: flex; align-items: center; font-weight: 500;
}
.error-message i { margin-right: 4px; }

/* Para mensajes de error principales (login) */
.error-section { margin: 16px 0; }
.error-message-main {
    background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 14px;
    color: #dc2626; font-size: 13px; font-weight: 500; display: flex; align-items: center;
}
.error-message-main i { margin-right: 8px; font-size: 14px; }

.help-text {
    color: #6b7280; font-size: 12px; margin-top: 6px; display: block; line-height: 1.4;
}
.form-group-with-help { margin-bottom: 20px; }

/* TÉRMINOS Y CONDICIONES (Register) */
.terms-group { margin-bottom: 24px; margin-top: 10px; }
.terms-checkbox { display: flex; align-items: flex-start; cursor: pointer; position: relative; padding-left: 28px; line-height: 1.4; font-size: 13px; color: #4b5563; }
.terms-checkbox input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: #ffffff; border: 1.5px solid #d1d5db; border-radius: 4px; transition: all 0.2s ease; }
.terms-checkbox:hover input~.checkmark { border-color: #3b82f6; }
.terms-checkbox input:checked~.checkmark { background-color: #3b82f6; border-color: #3b82f6; }
.checkmark:after { content: ""; position: absolute; display: none; left: 5px; top: 2px; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.terms-checkbox input:checked~.checkmark:after { display: block; }
.terms-text { flex: 1; }
.terms-text a { color: #3b82f6; text-decoration: none; font-weight: 600; }
.terms-text a:hover { color: #2563eb; text-decoration: underline; }

.btn-primary {
    width: 100%; height: 46px; background: #3b82f6; border: none; border-radius: 10px; color: white;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -1px rgba(59, 130, 246, 0.1);
    font-family: 'Inter', sans-serif; display: flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-primary:hover { 
    background: #2563eb; 
    transform: translateY(-1px); 
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3); 
}

.btn-primary:active { transform: translateY(0); }

.form-input:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary.loading { background: #9ca3af; cursor: not-allowed; pointer-events: none; }

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

.register-link, .login-link {
    font-size: 14px; color: #4b5563; margin-bottom: 16px;
}

.register-link a, .login-link a {
    color: #3b82f6; font-weight: 600; text-decoration: none; margin-left: 4px;
}

.register-link a:hover, .login-link a:hover { text-decoration: underline; color: #2563eb; }

.copyright {
    color: #9ca3af; font-size: 12px; line-height: 1.5;
}

/* Mensajes Generales (Register / Ajax) */
#general_messages { margin-bottom: 20px; }
#general_messages .alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; display: flex; align-items: center; margin-bottom: 0; }
#general_messages .alert-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
#general_messages .alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
#general_messages .alert i { margin-right: 8px; font-size: 14px; }
.close-btn { background: none; border: none; margin-left: auto; color: inherit; cursor: pointer; padding: 0; display: flex; align-items: center; }

/* Loading Overlay */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.9); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(4px); }
.loading-overlay img { width: 60px; margin-bottom: 16px; }
.loading-overlay h2 { color: #111827; font-size: 16px; font-weight: 600; }
.hidden { display: none !important; }

/* Animations */
@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .auth-promo-panel { display: none; }
    .auth-layout { min-height: auto; } /* En móvil no forzamos el alto de la pantalla, que sea fluido */
    .auth-wrapper { min-height: auto; padding-top: 4vh; } /* Altura fluida en móvil */
}

@media (max-width: 480px) {
    .auth-wrapper { padding: 20px 16px; justify-content: flex-start; margin-top: 4vh; }
    .auth-card { padding: 24px 20px; }
    .auth-title { font-size: 24px; }
    .auth-subtitle { font-size: 14px; }
}
