:root {
    --bg: #0b0f1a;
    --primary: #00e5ff;
    --accent: #00ff9d;
    --danger: #ff4757;
    --glass: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   THEME TOGGLE (LIGHT MODE)
   ========================================== */
body.light-mode {
    --bg: #f4f7fe;
    --glass: #ffffff;
    --border: #e2e8f0;
    color: #1e293b;
}

body.light-mode input, 
body.light-mode select { 
    background: #f8fafc; 
    color: #1e293b; 
    border-color: #cbd5e1; 
}

body.light-mode .retail-panel { box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
body.light-mode th { color: #64748b; }
body.light-mode .qty-btn { color: #fff; }
body.light-mode .quick-btn { color: #1e293b; }
body.light-mode .terminal-title, 
body.light-mode .brand { color: #0f172a; }

/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

body {
    background: var(--bg);
    color: #fff;
    height: 100vh;
    overflow: hidden; /* Keeps the main app shell locked */
    transition: background 0.3s, color 0.3s;
}

/* ==========================================
   LAYOUT FIX: ALLOW SCROLLING FOR TALL SCREENS
   ========================================== */
.main-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-viewport {
    flex-grow: 1;
    overflow-y: auto; /* This makes all your other screens scrollable! */
    padding-bottom: 50px; 
}

/* Custom sleek scrollbar for the viewport */
.content-viewport::-webkit-scrollbar {
    width: 8px;
}
.content-viewport::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.content-viewport::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* ==========================================
   STRICT ROLE VISIBILITY CONTROL
   ========================================== */

/* 1. Cashier Role: Hide all management sections safely */
.is-cashier .admin-only, 
.is-cashier .owner-only,
.is-cashier .owner-only-option { 
    display: none !important; 
}

/* 2. Staff Role: Show management tools but hide Owner tools */
.is-staff .admin-only { display: table-cell !important; }
.is-staff button.admin-only { display: inline-block !important; }
.is-staff .owner-only, .is-staff .owner-only-option { display: none !important; }

/* 3. Admin Role: Admins automatically see elements. */

/* ==========================================
   DRAG AND DROP NAV STYLES
   ========================================== */
.side-nav button {
    cursor: grab;
}
.side-nav button:active {
    cursor: grabbing;
}
.side-nav button.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border: 1px dashed var(--primary);
    background: rgba(0,0,0,0.5);
}

/* Navigation & Layout */
.main-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; /* Prevents header from shrinking */
}

.brand { font-family: 'Orbitron'; font-size: 1.5rem; font-weight: 700; color: inherit; }
.brand span { color: var(--primary); }

.header-right { display: flex; align-items: center; gap: 20px; }
.exit-btn { background: var(--danger); border: none; padding: 6px 12px; border-radius: 6px; color: white; cursor: pointer; }

.side-nav { padding: 15px 40px; display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.side-nav button {
    background: var(--glass);
    border: 1px solid var(--border);
    color: inherit;
    padding: 10px 20px;
    border-radius: 12px;
    transition: 0.3s;
}

.side-nav button:hover { background: var(--primary); color: #000; }

/* Dashboard Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 0 40px;
}

.retail-panel {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 25px;
    backdrop-filter: blur(15px);
}

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.center-panel { max-width: 600px; margin: 40px auto; }
.form-stack { display: flex; flex-direction: column; gap: 15px; }

/* Components & Inputs */
.search-bar-row { display: flex; gap: 15px; margin-bottom: 20px; }
.search-container { flex-grow: 1; position: relative; }

.dropdown-results {
    position: absolute;
    top: 55px;
    left: 0;
    width: 100%;
    background: #1a2236;
    border: 1px solid var(--primary);
    border-radius: 12px;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.dropdown-item:hover { background: var(--glass); color: var(--primary); }

input, .method-select, select {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 10px;
    color: inherit;
    width: 100%;
    margin-bottom: 10px;
    outline: none;
}

input:focus { border-color: var(--primary); }
.inline-form { display: flex; gap: 10px; margin-bottom: 20px; }

.price-display {
    font-family: 'Orbitron';
    font-size: 3.5rem;
    color: var(--accent);
    text-align: right;
    margin: 20px 0;
}

.balance-indicator {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 15px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 8px;
}

/* Button Styles */
.login-btn, .confirm-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: 0.3s;
}

.confirm-btn:disabled { opacity: 0.2; cursor: not-allowed; filter: grayscale(1); }
.action-btn { background: var(--primary); border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: #000; margin-right: 5px; }
.del-btn { background: var(--danger); border: none; padding: 6px 12px; color: #fff; border-radius: 6px; cursor: pointer; }

/* Qty Controls */
.qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 5px;
    border-radius: 8px;
    width: fit-content;
}

.qty-btn {
    background: var(--primary);
    border: none;
    color: #000;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.qty-btn:hover { transform: scale(1.1); box-shadow: 0 0 10px var(--primary); }
.qty-val { min-width: 20px; text-align: center; font-weight: 600; }

/* Tables */
.table-frame { max-height: 60vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 15px;
    color: #8892b0;
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

td { padding: 15px; border-bottom: 1px solid var(--border); }

/* Utilities */
.hidden { display: none !important; }

.login-overlay {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #1a2236, #0b0f1a);
}

.login-card {
    width: 400px;
    padding: 40px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 30px;
    text-align: center;
}

.terminal-title { font-family: 'Orbitron'; color: inherit; font-size: 2.5rem; margin-bottom: 5px; }
.terminal-title span { color: var(--primary); }
.terminal-subtitle { color: #8892b0; font-size: 0.8rem; letter-spacing: 4px; margin-bottom: 30px; }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 99999;
}

/* Live Dashboard Sync Animation */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(0, 255, 157, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0); }
}