/* 1. RESET Y ESTRUCTURA BASE */
* { box-sizing: border-box; }

body { 
    margin: 0; 
    padding: 0;
    font-family: 'Roboto', sans-serif; 
    background-color: #021024; 
    overflow: hidden; /* Evita scroll doble: el scroll debe ser solo de la tabla o el main */
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden; 
    /* width: 100vw; */
}

/* 2. SIDEBAR (Se mantiene tu estilo azul profundo) */
.sidebar {
    width: 280px;
    background-color: #0d1b2a;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 25px;
    flex-shrink: 0; /* Evita que la sidebar se comprima */
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    z-index: 10;
}

/* 3. CONTENIDO PRINCIPAL (Aquí corregimos el espacio) */
.main-content {
    flex: 1;
    display: flex;
    background-color: #0b132b;
    padding: 30px;
    display: flex;
    flex-direction: column;
    /* flex-direction: column; */
    /* background-color: #0b132b; */
    /* padding: 20px; */
    /* overflow-x: hidden; /* Evita que la tabla empuje el layout */ */
    /* min-width: 0;       /* Truco crítico para que Flexbox no se desalinee */ */
}

/* 4. CONTENEDOR DE LA TABLA (EL ANCLA DE ALINEACIÓN) */
.tabla-container {
    width: 100%;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden; /* Corta cualquier cosa que quiera salirse */
    background: white;

    /* background: white; */
    /* border-radius: 12px; */
    /* padding: 0;          /* Quitamos padding para que los ejes toquen el borde */ */
    /* box-shadow: 0 10px 30px rgba(0,0,0,0.5); */
    /* flex: 1;             /* Hace que la tabla ocupe el espacio sobrante */ */
    /* position: relative;  /* ANCLA LOS EJES AQUÍ */ */
    /* overflow: hidden; */
    /* margin-top: 10px; */
}

/* 5. HANDSONTABLE - AJUSTES DE PRECISIÓN */
.handsontable {
    font-family: 'Roboto', sans-serif !important;
}

/* Forzar alineación de cabeceras A, B, C... */
.handsontable th {
    background-color: #61accf !important;
    color: white !important;
    font-weight: bold;
    text-align: center;
    padding: 8px 0 !important;
    border: 1px solid #fff !important;
}

/* Quitar márgenes viejos que movían la tabla de su eje */
#hot {
    margin: 0 !important; /* Eliminamos el '20px auto' que tenías antes */
    width: 100% !important;
    height: 100% !important;
}

/* 6. BOTONES Y HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    margin-bottom: 15px;
}

.header-controls {
    background: rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: 50px;
    display: flex;
    align-items: center;
}

/* Estilo para los botones de la sidebar que pediste mover */
.btn-side {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.05);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

.btn-side:hover {
    background: #00d4ff;
    color: #000;
    transform: translateX(5px);
}

.btn-primary-side {
    background: #00d4ff;
    color: #000;
    font-weight: bold;
}

/* Asegura que la sidebar no se deje empujar por la tabla */
.sidebar {
    width: 280px;
    min-width: 280px; /* Crucial: para que no se encoja */
    background-color: #0d1b2a;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100vh;
    position: sticky; /* Se queda fija mientras haces scroll */
    top: 0;
    z-index: 100; /* Para que la tabla no pase por encima */
}

/* Control total del logo para que no crezca */
.logo-sidebar {
    width: 120px !important; /* Ajusta este valor al tamaño que quieras */
    height: auto;
    margin: 0 auto 15px auto;
    display: block;
    object-fit: contain;
}

.sidebar-brand {
    text-align: center;
    padding: 10px 0;
}

.app-container {
    display: flex;
    width: 100%;
    overflow: hidden; /* Evita scrolls raros en el body */
}

.main-content {
    flex: 1;
    min-width: 0; /* Esto obliga a la tabla a quedarse dentro de su cuadro */
    background-color: #0b132b;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.tabla-container {
    width: 100%;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden; /* Corta cualquier cosa que quiera salirse */
    background: white;
}

/* Capa que bloquea la pantalla */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(11, 19, 43, 0.85); /* Fondo oscuro translúcido */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Por encima de todo */
    backdrop-filter: blur(5px);
}

.loader-content {
    text-align: center;
    color: #00d4ff;
    font-family: 'Kanit', sans-serif;
}

/* El Spinner animado */
.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 212, 255, 0.2);
    border-top: 5px solid #00d4ff;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
