/* --- Estilos Globales y Variables --- */
:root {
    /* -- Colores para el MODO OSCURO (por defecto) -- */
    --bg-color: #0a0a0a;
    --primary-color: #00d4ff;
    --primary-dark: #00a3cc;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
    --input-border: rgba(255, 255, 255, 0.2);
    --font-family: 'Inter', sans-serif;

    /* -- Variables de BRANDING (Inmutables) -- */
    --brand-color-start: #00d4ff;
    --brand-color-end: #00a3cc;
    --brand-color-glow: rgba(0, 212, 255, 0.3);
}

/* -- Colores para el MODO CLARO (Refinado) -- */
body.light-mode {
    --bg-color: #f4f6f8;
    --primary-color: #6c5ce7;
    --primary-dark: #574b90;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --input-border: rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* --- Fondo Animado y Degradado (para modo claro) --- */
.animated-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background: linear-gradient(45deg, #0a0a0a, #1a1a2e);
    transition: opacity 0.4s ease;
}

body.light-mode .animated-bg {
    opacity: 1;
    background: radial-gradient(circle at 20% 80%, #e0e7ff 0%, #f4f6f8 50%);
}

body.light-mode .shape {
    opacity: 0.4;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.7;
    animation: float 20s infinite ease-in-out;
}

.shape1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    top: -150px;
    right: -150px;
    animation-delay: 0s;
}

.shape2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #ff006e, #8338ec);
    bottom: -125px;
    left: -125px;
    animation-delay: 5s;
}

.shape3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #06ffa5, #00d4ff);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* --- Contenedor Principal del Login --- */
.login-container {
    width: 420px;
    padding: 50px 40px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    text-align: center;
    position: relative;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

body.light-mode .login-container {
    box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
}

/* --- Interruptor de Tema --- */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.theme-toggle {
    width: 60px;
    height: 30px;
    background-color: #ccc;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.theme-toggle-slider {
    width: 26px;
    height: 26px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

body.light-mode .theme-toggle {
    background-color: var(--primary-color);
}

body.light-mode .theme-toggle-slider {
    transform: translateX(30px);
}

/* --- Título con Branding Inmutable --- */
.login-container h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--brand-color-start), var(--brand-color-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* --- Formulario con Floating Labels --- */
.login-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    position: relative;
    margin-bottom: 30px;
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 15px 0;
    font-size: 1rem;
    color: var(--text-color);
    border: none;
    border-bottom: 2px solid var(--input-border);
    background: transparent;
    outline: none;
    transition: border-color 0.3s;
}

.form-group label {
    position: absolute;
    top: 15px;
    left: 0;
    font-size: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group input:valid {
    border-bottom-color: var(--primary-color);
}

.form-group input:focus ~ label,
.form-group input:valid ~ label {
    top: -10px;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.login-btn {
    /* ¡CORRECCIÓN FINAL! El botón ahora SIEMPRE usa los colores de la marca. */
    background: linear-gradient(45deg, var(--brand-color-start), var(--brand-color-end));
    color: #ffffff;
    border: none;
    padding: 15px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-top: 20px;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--brand-color-glow);
}

/* --- Mensaje de Error --- */
.error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

/* --- Responsividad --- */
@media (max-width: 480px) {
    .login-container {
        width: 90%;
        padding: 40px 30px;
    }
    .login-container h1 {
        font-size: 1.8rem;
    }
}
