:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --bg-light: #f4f6f9;
    --sidebar-width: 280px;
    --admin-panel-width: 350px;
    --header-height: 60px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.brand { display: flex; align-items: center; gap: 15px; color: var(--primary); }
.brand .material-icons { font-size: 32px; color: var(--accent); }
.brand input { border: none; font-size: 1.1rem; font-weight: bold; color: var(--primary); background: transparent; min-width: 250px; }
.brand input:focus { outline: 1px solid var(--accent); background: white; padding: 2px 5px; }

.controls { display: flex; gap: 15px; align-items: center; }
.btn-icon { background: #f1f2f6; border: none; padding: 8px 12px; border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; color: #555; transition: 0.2s; }
.btn-icon:hover { background: #e1e2e6; }

.btn-save { background: var(--accent); color: white; border: none; padding: 8px 20px; border-radius: 4px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: bold; box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3); }
.btn-save:hover { background: #2980b9; transform: translateY(-1px); }

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #2c3e50;
    color: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-item:hover { background: rgba(255,255,255,0.1); }
.menu-item.active { background: var(--accent); border-left: 5px solid #ecf0f1; }
.menu-item .material-icons { font-size: 20px; opacity: 0.8; }

/* Admin Panel (Input) */
.admin-panel {
    width: var(--admin-panel-width);
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.3s ease, padding 0.3s ease;
    z-index: 10;
}

.panel-header { padding: 20px; background: #ecf0f1; border-bottom: 1px solid #ddd; font-weight: bold; color: var(--primary); font-size: 1.1rem; }
.panel-content { padding: 20px; }

.input-group { margin-bottom: 15px; background: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #eee; }
.input-group label { display: block; font-size: 0.9rem; font-weight: bold; margin-bottom: 8px; color: var(--primary); border-bottom: 1px solid #eee; padding-bottom: 5px; }
.input-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.input-row span { font-size: 0.9rem; flex: 1; color: #555; }
.input-row input { width: 90px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; text-align: right; font-weight: bold; }
.input-row input:focus { border-color: var(--accent); outline: none; }

/* Stage Area (Visualization) */
.stage-area {
    flex: 1;
    background: #e0e5ec;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: padding 0.3s;
}

.slide-container {
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 16/9;
    background: white;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    padding: 40px;
    position: relative;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

.slide-header { border-bottom: 3px solid var(--accent); padding-bottom: 15px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: flex-end; }
.slide-header h1 { margin: 0; font-size: 2rem; color: var(--primary); letter-spacing: -0.5px; }
.slide-breadcrumbs { color: #95a5a6; font-weight: 600; font-size: 1rem; text-transform: uppercase; }

.slide-content { flex: 1; display: flex; gap: 30px; min-height: 0; }
.chart-wrapper { flex: 2; position: relative; }
.stats-grid { flex: 1; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; padding-right: 5px; }

.stat-card { background: #ffffff; padding: 15px 20px; border-radius: 8px; border: 1px solid #eee; border-left: 5px solid var(--accent); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.stat-card h4 { margin: 0 0 5px; color: #7f8c8d; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card div { font-size: 1.8rem; font-weight: 800; color: var(--primary); }

.slide-footer { margin-top: auto; border-top: 1px solid #eee; padding-top: 15px; text-align: center; font-size: 0.85rem; color: #bdc3c7; display: flex; justify-content: space-between; }

/* ============================ */
/* ROLE: USER MODE MODIFICATIONS */
/* ============================ */
body.mode-user .admin-panel { display: none; }
body.mode-user .admin-only-flex { display: none; }
body.mode-user .brand input { pointer-events: none; border-bottom: none; }
body.mode-user .stage-area { padding: 0; background: #2c3e50; }

/* Fullscreen Slide in User Mode */
body.mode-user .slide-container { 
    max-width: 100%; 
    height: 100%; 
    aspect-ratio: auto; 
    box-shadow: none; 
    border-radius: 0; 
    padding: 50px;
}

/* User Mode Sidebar (Collapsed/Icon Only) */
body.mode-user .sidebar { width: 70px; transition: width 0.3s; z-index: 200; }
body.mode-user .sidebar:hover { width: 300px; }
body.mode-user .menu-item span:last-child { display: none; } /* Hide text initially */
body.mode-user .sidebar:hover .menu-item span:last-child { display: inline; }
body.mode-user .menu-item { justify-content: center; }
body.mode-user .sidebar:hover .menu-item { justify-content: flex-start; }