/* =========================================
   Genzosim - Glassmorphism Theme (Merged with Bakery Engine)
========================================= */

:root {
    --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #2563eb;
    --accent: #10b981;
    --danger: #ef4444; 
    --warning: #f59e0b;
    
    --panel-bg: rgba(255, 255, 255, 0.85); 
    --border: rgba(226, 232, 240, 0.6); 
    --top-bg: rgba(15, 23, 42, 0.95); 
    --top-text: #f8fafc;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-glow: 0 0 12px rgba(59, 130, 246, 0.5);
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    margin: 0; 
    background: var(--bg-gradient); 
    color: var(--text-main); 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
}

/* Background Blurs */
body::before, body::after { content: ''; position: fixed; border-radius: 50%; z-index: -1; }
body::before { top: -10%; left: -10%; width: 500px; height: 500px; background: rgba(59, 130, 246, 0.12); filter: blur(100px); }
body::after { bottom: -10%; right: -10%; width: 600px; height: 600px; background: rgba(16, 185, 129, 0.08); filter: blur(100px); }

/* Layout Structure */
.sidebar { width: 350px; background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-right: 1px solid var(--glass-border); overflow-y: auto; display: flex; flex-direction: column; z-index: 10; flex-shrink: 0;}
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Top Financial Bar */
.top-dashboard { background: var(--top-bg); color: var(--top-text); padding: 15px 25px; display: flex; gap: 15px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; backdrop-filter: blur(20px);}
.top-stat { display: flex; flex-direction: column; background: rgba(255,255,255,0.05); padding: 10px 15px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); min-width: 125px; position: relative; backdrop-filter: blur(10px);}
.top-stat .label { font-size: 0.70rem; color: #94a3b8; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 4px;}
.top-stat .value { font-size: 1.25rem; font-weight: 700; color: white; }
.top-stat .value.positive { color: #34d399; }
.top-stat .value.negative { color: #f87171; }
.top-stat .value.warning { color: #fcd34d; }

.clickable-stat { cursor: pointer; transition: all 0.2s ease; border: 1px solid rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.1);}
.clickable-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); background: rgba(59, 130, 246, 0.2); }
.clickable-stat::after { content: '↗ Run 100 Days'; position: absolute; top: -10px; right: -10px; background: var(--warning); color: #0f172a; font-weight:bold; font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; opacity: 0; transition: opacity 0.2s;}
.clickable-stat:hover::after { opacity: 1; }

.top-charts-wrapper { display: flex; gap: 15px; margin-left: auto; }
.mini-chart-card { background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; gap: 10px; }
.mini-chart-info { display: flex; flex-direction: column; }
.mini-chart-title { font-size: 0.75rem; font-weight: 600; color: white; text-transform: uppercase; letter-spacing: 0.5px;}
.mini-chart-sub { font-size: 0.65rem; color: #94a3b8; margin-top: 2px;}
.mini-canvas-container { position: relative; width: 50px; height: 50px; }

/* Content Split */
.content-split { display: flex; flex: 1; overflow: hidden; }
.center-pane { flex: 1.2; display: flex; flex-direction: column; position: relative; background: transparent; overflow: hidden; }
.right-pane { flex: 1; background: var(--glass-bg); backdrop-filter: blur(16px); border-left: 1px solid var(--glass-border); overflow-y: auto; display: flex; flex-direction: column; padding: 25px; }

/* Sidebar Controls */
.header { padding: 20px; background: rgba(15, 23, 42, 0.9); color: white; font-weight: 600; font-size: 1.1rem; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; backdrop-filter: blur(10px);}
details { border-bottom: 1px solid var(--border); }
summary { padding: 12px 20px; font-weight: 600; cursor: pointer; user-select: none; background: rgba(255,255,255,0.4); transition: background 0.2s; font-size: 0.9rem; color: #334155;}
summary:hover { background: rgba(255,255,255,0.7); }
.control-group { padding: 15px 20px; background: rgba(255,255,255,0.3); }
.control-item { margin-bottom: 15px; }
.control-header { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 6px; color: var(--text-muted); font-weight: 600;}
input[type="range"] { width: 100%; cursor: pointer; accent-color: var(--primary); }

.toggle-btn { width: 100%; padding: 10px; background: rgba(255,255,255,0.6); border: 1px solid var(--glass-border); border-radius: 6px; font-weight: bold; cursor: pointer; transition: 0.3s; color: #334155; }
.toggle-btn.active { background: var(--warning); color: white; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); border-color: transparent;}

/* Floor UI */
.sim-header { padding: 15px 25px; background: var(--glass-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); z-index: 5; display: flex; justify-content: space-between; align-items: center;}
.sim-status { font-weight: 700; font-size: 1.2rem; color: var(--text-main); }
.sim-time { font-size: 1.5rem; color: var(--primary); font-weight: 800; display: flex; align-items: center; }

@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }

.bakery-floor { flex: 1; position: relative; margin: 20px; background: rgba(248, 250, 252, 0.6); backdrop-filter: blur(8px); border-radius: 12px; box-shadow: var(--shadow-md); border: 1px solid var(--glass-border); overflow: hidden; background-image: radial-gradient(rgba(203, 213, 225, 0.5) 1px, transparent 1px); background-size: 20px 20px; }
.zone { position: absolute; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; box-shadow: var(--shadow-sm); z-index: 1;}
.kitchen-area { top: 0; left: 0; width: 100%; height: 20%; background: rgba(226, 232, 240, 0.7); border-bottom: 2px solid rgba(148, 163, 184, 0.5); backdrop-filter: blur(4px);}
.pos-counter { top: 20%; left: 0; width: 100%; height: 8%; background: rgba(203, 213, 225, 0.7); border-bottom: 2px solid rgba(100, 116, 139, 0.5); display: flex; justify-content: space-around; align-items: center; z-index: 2; backdrop-filter: blur(4px);}
.register { width: 30px; height: 20px; background: #334155; border-radius: 3px; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.5rem;}

.display-racks { top: 35%; right: 5%; width: 25%; height: 50%; display: flex; flex-direction: column; gap: 10px; background: transparent; box-shadow: none; z-index: 1;}
.rack { flex: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight:bold; box-shadow: var(--shadow-sm); border: 1px solid var(--glass-border); text-align: center; backdrop-filter: blur(6px);}
.rack.pretzel { background: rgba(255, 237, 213, 0.8); border-color: rgba(249, 115, 22, 0.4); color: #c2410c; }
.rack.bread { background: rgba(254, 243, 199, 0.8); border-color: rgba(245, 158, 11, 0.4); color: #b45309; }
.rack.cake { background: rgba(224, 242, 254, 0.8); border-color: rgba(56, 189, 248, 0.4); color: #0369a1; }

.seating-area { bottom: 5%; right: 35%; width: 30%; height: 35%; border: 2px dashed rgba(203, 213, 225, 0.8); border-radius: 8px; background: rgba(255,255,255,0.4); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; box-sizing: border-box; backdrop-filter: blur(4px);}
.table { background: rgba(241, 245, 249, 0.8); border: 1px solid rgba(203, 213, 225, 0.6); border-radius: 50%; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 0.6rem;}
.queue-path { bottom: 5%; left: 5%; width: 25%; height: 55%; border-left: 2px dashed rgba(148, 163, 184, 0.6); border-right: 2px dashed rgba(148, 163, 184, 0.6); border-top: none; background: rgba(241, 245, 249, 0.3); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 20px; color: #94a3b8; writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: 2px;}

.doorway { bottom: 0; left: 17.5%; transform: translateX(-50%); width: 80px; height: 8px; background: #38bdf8; position: absolute; border-radius: 4px 4px 0 0;}
.mat { bottom: 0; left: 17.5%; transform: translateX(-50%); width: 100px; height: 20px; background: #334155; position: absolute; color: #94a3b8; font-size: 0.5rem; display: flex; align-items: center; justify-content: center; letter-spacing: 2px;}

/* Entities */
.dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; transition: all 0.5s ease-in-out; box-shadow: 0 2px 4px rgba(0,0,0,0.3); z-index: 5;}
.staff-baker { background: #3b82f6; border: 2px solid #eff6ff; } 
.staff-cashier { background: #8b5cf6; border: 2px solid #f5f3ff; } 
.customer.served { background: var(--accent); border: 1px solid #fff; }
.customer.queued { background: var(--danger); border: 1px solid #fff; }

.closed-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(4px); color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: 800; display: none; z-index: 20; letter-spacing: 2px;}
.closed-sub { font-size: 1rem; color: #94a3b8; font-weight: 500; margin-top: 10px; letter-spacing: 0px;}

/* Right Pane Metrics */
.section-title { margin-top:0; color:var(--text-main); font-size:0.9rem; text-transform:uppercase; letter-spacing: 0.5px; border-bottom:1px solid rgba(0,0,0,0.1); padding-bottom:8px; margin-bottom: 12px;}
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.kpi-card { background: rgba(255,255,255,0.6); padding: 12px; border-radius: 12px; border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: center; backdrop-filter: blur(10px);}
.kpi-title { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 5px; font-weight: 600;}
.kpi-value { font-size: 1.4rem; font-weight: 800; color: var(--text-main); }
.kpi-value.positive { color: var(--accent); }
.kpi-value.negative { color: var(--danger); }
.kpi-highlight { background: rgba(239, 246, 255, 0.7); border-color: rgba(191, 219, 254, 0.5); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease;}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 16px; width: 90%; max-width: 1000px; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); position: relative; transform: translateY(20px); transition: transform 0.3s ease; border: 1px solid var(--glass-border);}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 15px;}
.modal-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin: 0; }
.close-btn { background: rgba(241, 245, 249, 0.8); border: none; font-size: 1.5rem; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: #64748b; display: flex; align-items: center; justify-content: center; transition: background 0.2s;}
.close-btn:hover { background: #e2e8f0; color: #0f172a; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px;}
.chart-container { height: 250px; width: 100%; position: relative; background: rgba(248, 250, 252, 0.6); border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 12px; padding: 15px; box-sizing: border-box; backdrop-filter: blur(5px);}

.modal-kpi-row { display: flex; gap: 15px; margin-bottom: 20px;}
.modal-kpi { flex: 1; background: rgba(15, 23, 42, 0.95); color: white; padding: 15px; border-radius: 12px; text-align: center; border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px);}
.modal-kpi .title { font-size: 0.8rem; color: #94a3b8; text-transform: uppercase; margin-bottom: 5px; font-weight: 600;}
.modal-kpi .val { font-size: 1.6rem; font-weight: bold; color: #38bdf8;}
.modal-kpi .val.pos { color: #34d399; }
.modal-kpi .val.neg { color: #f87171; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(203, 213, 225, 0.8); border-radius: 10px; }