/* =========================================
   VARIABLES (Light / Dark)
   ========================================= */
:root {
    /* DEFAULT (LIGHT) */
    --bg-base: #f0f2f5;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --primary: #3b82f6;
    --accent: #06b6d4;
    
    /* Glass Effect Light */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    
    /* Inputs */
    --input-bg: rgba(255, 255, 255, 0.5);
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus: #ffffff;
    
    /* Partículas */
    --particle-color: rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] {
    /* DARK MODE */
    --bg-base: #020617; /* Slate 950 (Casi negro pero azulado) */
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --primary: #6366f1; /* Indigo */
    --accent: #ec4899; /* Pink */
    
    /* Glass Effect Dark */
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    /* Inputs */
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: rgba(0, 0, 0, 0.4);
    
    /* Partículas */
    --particle-color: rgba(255, 255, 255, 0.2);
}

/* =========================================
   FONDO GLOBAL (Corrección del problema)
   ========================================= */
/* Esto fuerza al fondo a cubrir TODO, ignorando márgenes del layout */
#background-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0; /* Detrás de todo */
    background: var(--bg-base);
    overflow: hidden;
    transition: background 0.5s ease;
}

#particleCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* Blobs atmosféricos GIGANTES y muy borrosos */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px); /* Desenfoque extremo */
    opacity: 0.5;
    z-index: 0;
    animation: float 20s infinite alternate;
}

.blob-1 {
    top: -20%; left: -20%;
    width: 80vw; height: 80vw; /* Usamos VW para tamaño relativo a pantalla */
    background: var(--primary);
}
.blob-2 {
    bottom: -20%; right: -20%;
    width: 70vw; height: 70vw;
    background: var(--accent);
    animation-delay: -5s;
}
.blob-3 {
    top: 40%; left: 30%;
    width: 50vw; height: 50vw;
    background: #8b5cf6; /* Violeta */
    opacity: 0.3;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -50px) scale(1.05); }
}

/* =========================================
   WRAPPER DE CONTENIDO (Sobre el fondo)
   ========================================= */
.auth-content-wrapper {
    position: relative;
    z-index: 10; /* Encima del fondo */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Inter', system-ui, sans-serif;
}

/* =========================================
   TARJETA GLASS
   ========================================= */
.glass-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    color: var(--text-main);
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }

/* Logo */
.logo-box {
    width: 70px; height: 70px; margin: 0 auto;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.logo-icon { color: white; z-index: 2; }
.logo-spin {
    position: absolute; inset: -4px;
    border-radius: 24px;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.8), transparent);
    z-index: 1;
    animation: spinBorder 3s linear infinite;
}
@keyframes spinBorder { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.title-text { color: var(--text-main); letter-spacing: -0.5px; }
.subtitle-text { color: var(--text-sub); letter-spacing: 1px; }

/* =========================================
   INPUTS PERSONALIZADOS
   ========================================= */
.input-group-custom { position: relative; }

.custom-input {
    width: 100%;
    padding: 16px 16px 16px 45px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.custom-input:focus, .custom-input:not(:placeholder-shown) {
    background: var(--input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.custom-label {
    position: absolute; left: 45px; top: 50%; transform: translateY(-50%);
    color: var(--text-sub);
    pointer-events: none;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.custom-input:focus ~ .custom-label,
.custom-input:not(:placeholder-shown) ~ .custom-label {
    top: 0; left: 20px;
    font-size: 0.75rem;
    padding: 0 8px;
    background: var(--glass-bg); /* Truco visual */
    border-radius: 4px;
    color: var(--primary);
    font-weight: 600;
}

.btn-reveal {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
    border: none; background: none; color: var(--text-sub);
}
.btn-reveal:hover { color: var(--primary); }

/* =========================================
   CONTROLES & BOTÓN
   ========================================= */
/* Toggle Switch */
.toggle-switch { display: flex; align-items: center; cursor: pointer; }
.toggle-switch input { display: none; }
.slider {
    width: 36px; height: 20px; background: rgba(120,120,120,0.3);
    border-radius: 20px; position: relative; transition: 0.3s;
}
.slider::before {
    content: ""; position: absolute; height: 16px; width: 16px;
    left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider::before { transform: translateX(16px); }
.label-text { font-size: 0.85rem; color: var(--text-sub); }

.forgot-link { color: var(--primary); font-size: 0.85rem; text-decoration: none; font-weight: 500; }
.forgot-link:hover { text-decoration: underline; }

/* Botón Principal */
.btn-login-pulse {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; border: none;
    padding: 16px; border-radius: 14px;
    font-weight: 700; letter-spacing: 1px;
    position: relative; overflow: hidden;
    transition: transform 0.2s;
}
.btn-login-pulse:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4); }

.btn-shine {
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s infinite;
}
@keyframes shine { 20% { left: 100%; } 100% { left: 100%; } }

/* Botón Tema */
.theme-toggle-container { position: absolute; top: 20px; right: 20px; }
.btn-glass-icon {
    width: 45px; height: 45px; border-radius: 50%;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    color: var(--text-main); font-size: 1.2rem;
    display: grid; place-items: center;
    transition: 0.3s;
}
.btn-glass-icon:hover { transform: rotate(15deg) scale(1.1); background: var(--primary); color: white; }

.footer-version { text-align: center; color: var(--text-sub); font-size: 0.75rem; opacity: 0.7; }