/**
 * ==========================================================================
 * GESTOR - HOJA DE ESTILOS UNIFICADA (FRONTEND CLIENTE)
 * Versión: 1.5.7 (Unificación Estética de Tablas, Pestañas y Scrolls)
 * Arquitectura: CSS3 Nativo Estricto (Tema Oscuro)
 * ==========================================================================
 */

:root {
    --bg-main: #000000;
    --bg-panel: #1c1c1e;
    --bg-input: #2c2c2e;
    --border-color: #3a3a3c;
    --text-primary: #ffffff;
    --text-muted: #aeaeb2;
    --accent-blue: #0a84ff;
    --accent-orange: #ff9f0a;
    --accent-green: #30d158;
    --accent-red: #ff453a;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

body { 
    background-color: var(--bg-main); 
    color: var(--text-primary); 
    min-height: 100vh; 
    width: 100vw; 
    display: flex;
    flex-direction: column;
    overflow-x: hidden; 
}

.global-session-bar {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background-color: var(--bg-panel); 
    border-bottom: 1px solid var(--border-color);
    padding: 8px 15px; 
    flex: 0 0 45px; 
    font-size: 0.85rem; 
}

.fullscreen-view {
    flex: 1; 
    min-height: 0;
    width: 100vw;
    display: flex;
}

/* UNIFICACIÓN DE CONTENEDORES DE REPORTES Y DASHBOARD */
.admin-dashboard-layout { 
    display: flex; 
    width: 100%; 
    height: 100%; 
    min-height: 0;
}

.sidebar-tabs { 
    width: 220px; 
    background-color: var(--bg-panel); 
    border-right: 1px solid var(--border-color); 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.sidebar-tabs h3 { font-size: 1rem; margin-bottom: 10px; color: var(--text-muted); }

/* CLASE DE BOTÓN DE PESTAÑA UNIFICADA v1.5.7 */
.tab-side-btn { 
    background: none; 
    color: var(--text-muted); 
    padding: 10px 16px; 
    border-radius: 6px; 
    font-size: 0.88rem; 
    border: none; 
    cursor: pointer; 
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.tab-side-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}
.tab-side-btn.active { 
    background-color: rgba(10, 132, 255, 0.1); 
    color: var(--accent-blue); 
    font-weight: 700; 
}

.content-tab-master { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.sub-panel-adm { display: flex; flex-direction: column; gap: 15px; width: 100%; }

.pos-container { 
    display: flex; 
    width: 100%; 
    height: 100%; 
}

.panel-izquierdo { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    padding: 15px; 
    border-right: 1px solid var(--border-color); 
    overflow-y: auto; 
}

.panel-derecho { 
    width: 350px; 
    min-width: 350px;
    background-color: var(--bg-panel); 
    display: flex; 
    flex-direction: column; 
    padding: 15px; 
    position: relative;
    border-left: 1px solid var(--border-color);
}

input[type="text"], input[type="number"], select { background-color: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary); padding: 10px; border-radius: 8px; font-size: 0.9rem; outline: none; }
input:focus, select:focus { border-color: var(--accent-blue); }
button { border: none; border-radius: 8px; padding: 10px 16px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: background 0.2s ease, opacity 0.2s ease; }
.btn-primario { background-color: var(--accent-blue); color: #fff; }
.btn-secundario { background-color: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-advertencia { background-color: var(--accent-orange); color: #000; }
.btn-peligro { background-color: var(--accent-red); color: #fff; }

.carritos-grid { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; min-height: 65px; flex-shrink: 0; }
.carrito-remoto-card { background-color: var(--bg-panel); border: 1px solid var(--border-color); padding: 10px; border-radius: 8px; min-width: 140px; cursor: pointer; font-size: 0.8rem; text-align: center;}
.carrito-remoto-card.activo { border-color: var(--accent-blue); background-color: rgba(10, 132, 255, 0.05); }

.categorias-bar { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; flex-shrink: 0; padding-bottom: 4px; }
.btn-categoria { background-color: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 12px; font-size: 0.75rem; border-radius: 20px; white-space: nowrap; cursor: pointer; }
.btn-categoria.active { background-color: rgba(10, 132, 255, 0.1); border-color: var(--accent-blue); color: var(--accent-blue); font-weight: 600; }

.productos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }

.producto-card { 
    background-color: var(--bg-panel); 
    border: 1px solid var(--border-color); 
    padding: 12px; 
    border-radius: 8px; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    height: 110px; 
    cursor: pointer; 
}
.producto-card .nombre { font-size: 0.85rem; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.producto-card .precio { font-size: 1rem; font-weight: 700; color: #ffffff; }
.producto-card .stock { font-size: 0.72rem; color: var(--text-muted); margin-top: auto; display: block !important; }

/* CONTENEDOR DE SCROLL Y ESTILIZACIÓN DE BARRAS DE SCROLL GRIS MINERAL v1.5.7 */
.tabla-scroll-container { 
    width: 100%; 
    overflow-x: auto; 
    overflow-y: auto;
    margin-top: 10px; 
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}

.tabla-scroll-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.tabla-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-main);
}
.tabla-scroll-container::-webkit-scrollbar-thumb {
    background: #4a4a4c; /* Gris Mineral plano */
    border-radius: 3px;
}
.tabla-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #5a5a5c;
}

/* SANEAMIENTO Y UNIFICACIÓN DE LA TABLA ADMINISTRATIVA v1.5.7 */
.table-admin { 
    width: 100%; 
    border-collapse: collapse; 
    text-align: left; 
    font-size: 0.9rem; /* Tamaño de fuente unificado */
    background-color: var(--bg-panel);
}
.table-admin th, .table-admin td { 
    padding: 12px; /* Padding consistente de 12px */
    border-bottom: 1px solid var(--border-color); 
    vertical-align: middle;
}
.table-admin th { 
    background-color: var(--bg-panel); /* Fondo oscuro plano */
    color: var(--text-muted); /* Texto atenuado estructurado */
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}
.table-admin tr:last-child td {
    border-bottom: none;
}
.table-admin tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.carrito-body { 
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.item-linea { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.carrito-vacio { text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 20px 0; }

.carrito-footer { 
    margin-top: 20px;
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    background-color: var(--bg-panel);
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    width: 100%;
}
.carrito-footer button { width: 100%; display: block; padding: 12px; font-size: 0.9rem; }
.total-linea { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.badge-status { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); }

.login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--bg-main); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.login-box { background-color: var(--bg-panel); border: 1px solid var(--border-color); padding: 30px; border-radius: 12px; width: 100%; max-width: 350px; text-align: center; }
.admin-modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); display:flex; justify-content:center; align-items:center; z-index: 1000; }
.admin-modal-box { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; width: 100%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }

/* SECCIÓN DE ADAPTABILIDAD */
@media (max-width: 768px) {
    .fullscreen-view { flex-direction: column; height: auto; }
    .pos-container { flex-direction: column; }
    .panel-izquierdo { border-right: none; border-bottom: 1px solid var(--border-color); overflow-y: visible; }
    .panel-derecho { width: 100%; min-width: 0; border-left: none; }
    .carritos-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .carrito-remoto-card { min-width: 0; width: 100%; }
    .productos-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .admin-dashboard-layout { flex-direction: column; }
    .sidebar-tabs { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); flex-direction: row; overflow-x: auto; }
    .tab-side-btn { white-space: nowrap; width: auto; text-align: center; }
}