@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0f172a;    
    --accent: #3b82f6;     
    --success: #10b981;    
    --danger: #ef4444;     
    --warning: #f59e0b;    
    
    /* Variables Base (Modo Claro) */
    --bg-body: #f8fafc;    
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --radius: 12px;        
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* PALETA MODO OSCURO - Aplicado a html y body para evitar bugs al recargar */
html.dark-mode, body.dark-mode {
    --bg-body: #0f172a;    
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    margin: 0; 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
    transition: background-color 0.3s ease, color 0.3s ease; 
}

/* --- SIDEBAR EXPANDIBLE --- */
.sidebar { width: 70px; background: var(--primary); display: flex; flex-direction: column; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; flex-shrink: 0; box-shadow: 4px 0 15px rgba(0,0,0,0.05); overflow: hidden; white-space: nowrap; }
.sidebar:hover { width: 240px; }
.sidebar-logo { position: relative; height: 40px; margin: 20px 0 30px 0; display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; letter-spacing: 1px; }
.logo-short { position: absolute; font-size: 28px; transition: 0.3s opacity; opacity: 1; }
.logo-full { position: absolute; font-size: 28px; transition: 0.3s opacity; opacity: 0; }
.sidebar:hover .logo-short { opacity: 0; }
.sidebar:hover .logo-full { opacity: 1; transition-delay: 0.1s; }
.nav-item { color: #94a3b8; text-decoration: none; padding: 16px 0; width: 100%; display: flex; align-items: center; transition: background 0.2s, color 0.2s; cursor: pointer; border-left: 4px solid transparent; box-sizing: border-box; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.08); color: #fff; border-left-color: var(--accent); }
.nav-icon { min-width: 70px; text-align: center; font-size: 20px; display: flex; justify-content: center; align-items: center; }
.nav-text { font-size: 15px; opacity: 0; transition: opacity 0.3s ease; font-weight: 500; }
.sidebar:hover .nav-text { opacity: 1; transition-delay: 0.1s; }

/* --- LAYOUT --- */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar { height: 64px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; transition: 0.3s; }
.top-bar h3 { margin: 0; font-weight: 600; font-size: 18px; }
.main-view { flex: 1; display: flex; overflow: hidden; padding: 20px; gap: 20px; }
.left-panel { flex: 1; overflow-y: auto; padding-right: 5px; }
.right-panel { width: 380px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; transition: 0.3s; }

/* --- GRID & CARDS --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card-base { background: var(--bg-card); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; border: 1px solid var(--border); box-shadow: var(--shadow); transition: all 0.2s; position: relative; height: 110px; text-align: center; }
.card-base:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); }
.card-base h3, .card-base h4 { margin: 0 0 5px 0; font-size: 16px; color: var(--text-main); }
.card-base small { color: var(--text-muted); font-size: 13px; }

/* Estados de Mesas en Dark Mode */
.status-available { border-bottom: 4px solid var(--success); }
.status-occupied { border-bottom: 4px solid var(--danger); background: rgba(239, 68, 68, 0.05); }
.status-reserved { border-bottom: 4px solid var(--warning); background: rgba(245, 158, 11, 0.05); }

/* --- FORMULARIOS Y CAJAS --- */
.box { background: var(--bg-card); padding: 24px; border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); transition: 0.3s; }
input, select, textarea { width: 100%; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; font-family: inherit; font-size: 14px; transition: 0.2s; background: var(--bg-body); color: var(--text-main); }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }

/* --- BOTONES --- */
.btn { padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-body); color: var(--text-main); }
.btn-full { width: 100%; }

/* --- UTILIDADES --- */
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.text-center { text-align: center; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.bg-red { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.bg-green { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
html:not(.dark-mode) body:not(.dark-mode) .bg-red { background: #fee2e2; color: #991b1b; }
html:not(.dark-mode) body:not(.dark-mode) .bg-green { background: #d1fae5; color: #065f46; }

/* --- MODALES --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.8); display: flex; justify-content: center; align-items: center; z-index: 2000; visibility: hidden; opacity: 0; transition: 0.2s; backdrop-filter: blur(4px); }
.modal-overlay.active { visibility: visible; opacity: 1; }
.modal-content { background: var(--bg-card); padding: 32px; border-radius: 16px; width: 420px; max-width: 90%; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); transform: translateY(20px); transition: 0.3s; border: 1px solid var(--border); }
.modal-overlay.active .modal-content { transform: translateY(0); }

/* ============================================================
   CORRECCIONES PROFUNDAS DE MODO OSCURO (UI FIXES)
   ============================================================ */

/* 1. Corregir el resaltado blanco de las filas (hover) en las tablas */
html.dark-mode .table-recent tr:hover,
body.dark-mode .table-recent tr:hover,
html.dark-mode tr:hover,
body.dark-mode tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important; /* Gris muy sutil, no blanco */
    color: var(--text-main) !important;
}

/* 2. Personalización del Scrollbar para que sea oscuro */
html.dark-mode ::-webkit-scrollbar,
body.dark-mode ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background-color: var(--bg-body);
}

html.dark-mode ::-webkit-scrollbar-track,
body.dark-mode ::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 10px;
}

html.dark-mode ::-webkit-scrollbar-thumb,
body.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--border); /* Color del scroll acorde al borde oscuro */
    border-radius: 10px;
    border: 2px solid var(--bg-body);
}

html.dark-mode ::-webkit-scrollbar-thumb:hover,
body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 3. Overrides adicionales para paneles y componentes */
html.dark-mode .right-panel > div,
body.dark-mode .right-panel > div {
    background-color: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

html.dark-mode th,
body.dark-mode th {
    background-color: var(--bg-body) !important;
    color: var(--text-muted) !important;
    border-bottom-color: var(--border) !important;
}

html.dark-mode .box,
body.dark-mode .box {
    background-color: var(--bg-card) !important;
    border-color: var(--border) !important;
}

/* Botones de filtro específicos de reportes.html */
html.dark-mode .btn-filter,
body.dark-mode .btn-filter {
    background-color: transparent !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}