:root {
    --bg-dark: #050505;
    --bg-card: rgba(20, 20, 23, 0.95);
    --logo-cyan: #00f0ff; 
    --neon-primary: #8b5cf6; 
    --text-main: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.08);
    --danger: #ef4444;
    --success: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    padding-bottom: 90px;
}

/* HEADER */
header {
    position: sticky; top: 0; padding: 0 4%; height: 70px;
    background: rgba(5, 5, 5, 0.95); backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center; z-index: 100;
    padding-top: env(safe-area-inset-top);
}
.brand-logo { font-family: 'Orbitron', sans-serif; font-size: 1.4rem; font-weight: 900; letter-spacing: 1px; }
.user-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: #fff;
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s; font-size: 0.9rem;
}
.icon-btn:active { transform: scale(0.95); background: var(--logo-cyan); color: #000; }

/* SIDEBAR STYLES */
.sidebar {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100%;
    background: rgba(10, 10, 10, 0.98); backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border); z-index: 2000;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; padding-top: 60px;
}
.sidebar.active { left: 0; }
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1999; display: none;
    backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

.sidebar-header {
    position: absolute; top: 0; width: 100%; height: 60px;
    display: flex; align-items: center; padding-left: 20px;
    font-family: 'Orbitron'; font-size: 1.2rem; border-bottom: 1px solid #222;
}
.sidebar-link {
    position: relative;
    padding: 15px 20px; color: #ccc; text-decoration: none; font-size: 0.95rem;
    display: flex; align-items: center; gap: 15px; border-left: 3px solid transparent;
}
.sidebar-link i { width: 20px; text-align: center; }
.sidebar-link:active, .sidebar-link:hover { background: rgba(255,255,255,0.03); color: white; }
.sidebar-link.highlight { color: var(--logo-cyan); border-left-color: var(--logo-cyan); background: rgba(0, 240, 255, 0.05); }

/* BADGE STYLES */
.nav-badge {
    background: var(--danger); color: white; font-size: 0.65rem; font-weight: bold;
    padding: 2px 6px; border-radius: 10px; margin-left: auto;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.points-badge {
    background: linear-gradient(135deg, var(--neon-primary), #6366f1);
    padding: 4px 10px; border-radius: 6px; font-weight: 800; font-size: 0.7rem;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); display: none; align-items: center;
}
.vip-status { display: inline-block; border: 1px solid var(--logo-cyan); color: var(--logo-cyan); padding: 4px 10px; font-size: 0.65rem; font-weight: 700; border-radius: 50px; display: none; }

/* HERO */
.hero { padding: 25px 5%; text-align: center; margin-top: 10px; }
.hero h1 { font-family: 'Orbitron'; font-size: 1.8rem; margin-bottom: 5px; line-height: 1.2; }
.hero h1 span { color: var(--logo-cyan); text-shadow: 0 0 15px rgba(0, 240, 255, 0.4); }
.hero p { color: #94a3b8; font-size: 0.85rem; }

/* BRAND TABS */
.category-scroll {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    padding: 10px 5px; margin-bottom: 15px; overflow-x: visible; 
}
.category-scroll::-webkit-scrollbar { display: none; }

.cat-btn {
    flex: 1 0 auto; max-width: 150px; text-align: center;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    color: #aaa; padding: 10px 20px; border-radius: 50px; 
    font-size: 0.8rem; font-family: 'Outfit', sans-serif; font-weight: 600;
    cursor: pointer; transition: all 0.3s; letter-spacing: 0.5px;
}
.cat-btn.active {
    background: linear-gradient(135deg, var(--logo-cyan), #06b6d4);
    color: #000; font-weight: 800; border-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4); transform: translateY(-2px);
}
@media (hover: hover) {
    .cat-btn:hover { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.3); }
    .cat-btn.active:hover { background: linear-gradient(135deg, var(--logo-cyan), #06b6d4); color: black; }
}

/* GRID */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 2%; max-width: 900px; margin: 0 auto; }
.product-card {
    background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 12px; padding: 6px;
    position: relative; overflow: hidden; display: flex; flex-direction: column; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.product-card:active { transform: scale(0.98); border-color: var(--logo-cyan); }
.badge-new {
    position: absolute; top: 5px; left: 5px;
    background: #ef4444; color: white;
    font-size: 0.6rem; font-weight: bold;
    padding: 2px 6px; border-radius: 4px;
    z-index: 5; box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.product-image { 
    width: 100%; aspect-ratio: 1/1; background: #ffffff; 
    border-radius: 8px; margin-bottom: 6px; 
    display: flex; align-items: center; justify-content: center; 
    overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,0.1); 
}
.product-image img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.product-info h3 { font-size: 0.75rem; font-weight: 600; margin-bottom: 2px; line-height: 1.1; height: 28px; overflow: hidden; }
.current-price { font-size: 0.95rem; font-weight: 800; color: #fff; font-family: 'Rajdhani', sans-serif; }
.member-price { color: var(--logo-cyan); text-shadow: 0 0 8px rgba(0, 240, 255, 0.4); }

.admin-edit-btn {
    position: absolute; top: 5px; right: 5px; z-index: 10;
    background: rgba(0,0,0,0.8); color: var(--logo-cyan); border: 1px solid var(--logo-cyan);
    padding: 4px 6px; font-size: 0.7rem; border-radius: 6px; cursor: pointer;
}

/* --- FIXED MODAL SCROLLING FOR MOBILE --- */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); 
    backdrop-filter: blur(15px); 
    z-index: 999; 
    opacity: 0; 
    transition: opacity 0.2s ease;
    
    /* Key change for scrolling: Start flex items from TOP */
    align-items: flex-start; 
    justify-content: center;
    overflow-y: auto; 
    padding-top: 50px; 
    padding-bottom: 50px; 
    -webkit-overflow-scrolling: touch; 
}
.modal.show { opacity: 1; }

.modal-box { 
    background: #111; border: 1px solid #333; padding: 25px; 
    width: 95%; 
    max-width: 450px; 
    border-radius: 20px; 
    text-align: center; position: relative; 
    
    /* Allow growing height */
    height: auto;
    max-height: none; 
    
    margin: 0 auto 50px auto; 
    box-shadow: 0 0 40px rgba(0,0,0,0.8); 
}
.modal.show .modal-box { transform: scale(1); }

.close-icon-top {
    position: absolute; top: 15px; right: 15px;
    background: rgba(255,255,255,0.1); width: 30px; height: 30px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; cursor: pointer; z-index: 20;
}
.close-icon-top:active { background: var(--danger); }

/* CINEMATIC ANIMATIONS */
.success-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 50; border-radius: 20px;
    display: none; align-items: center; justify-content: center; flex-direction: column;
}
.spinner {
    width: 50px; height: 50px; border: 5px solid rgba(255,255,255,0.1);
    border-top: 5px solid var(--logo-cyan); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 20px;
}
.check-icon { font-size: 4rem; color: var(--success); transform: scale(0); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.check-icon.show { transform: scale(1); }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* FORMS */
.auth-header { font-family: 'Orbitron'; font-size: 1.5rem; color: white; margin-bottom: 20px; letter-spacing: 2px; }
.input-group { position: relative; margin-bottom: 12px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #666; font-size: 0.9rem; }
.input-group .toggle-pass { left: auto; right: 15px; cursor: pointer; color: var(--logo-cyan); }
.auth-input { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: white; padding: 14px 14px 14px 40px; border-radius: 10px; outline: none; font-family: 'Outfit'; font-size: 16px; transition: 0.3s; }
.auth-input:focus { border-color: var(--logo-cyan); }
.checkbox-container { display: flex; align-items: flex-start; gap: 10px; margin: 15px 0; text-align: left; font-size: 0.8rem; color: #aaa; }
.checkbox-container input { margin-top: 3px; accent-color: var(--logo-cyan); }

/* ADMIN INPUTS */
.admin-input-container { text-align: left; margin-bottom: 10px; }
.input-label { color: var(--logo-cyan); font-size: 0.75rem; font-weight: bold; margin-left: 5px; margin-bottom: 2px; display: block; }
.admin-input { background: #080808; border: 1px solid #333; color: white; padding: 12px; width: 100%; border-radius: 10px; outline: none; font-size: 16px; }
.admin-select { background: #080808; border: 1px solid #333; color: white; padding: 12px; width: 100%; border-radius: 10px; outline: none; font-size: 16px; -webkit-appearance: none; }
.admin-flavor-row { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.05); padding: 8px 12px; border-radius: 6px; margin-bottom: 5px; text-align: left;}
.checkbox-group { display: flex; align-items: center; gap: 10px; margin: 12px 0; text-align: left; padding: 10px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.checkbox-group input { width: 20px; height: 20px; accent-color: var(--logo-cyan); }

.delete-btn { color: #ef4444; background: none; border: none; margin-left: 5px; cursor: pointer; font-size: 0.9rem; padding: 5px; }
.edit-btn { color: var(--logo-cyan); background: none; border: none; margin-left: 5px; cursor: pointer; font-size: 0.9rem; padding: 5px; }
.edit-btn:hover, .delete-btn:hover { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* FLAVORS */
.flavor-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 15px 0; }
.flavor-tag { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; color: #ddd; transition:0.2s;}
.flavor-tag.selectable:active { background: var(--logo-cyan); color:black; transform:scale(0.95); }
.flavor-tag.selected { background: var(--logo-cyan); color:black; border-color:var(--logo-cyan); }
.flavor-stock { border-color: var(--success); color: var(--success); background: rgba(16,185,129,0.1); }
.flavor-oos { border-color: var(--danger); color: var(--danger); text-decoration: line-through; background: rgba(239,68,68,0.1); opacity: 0.6; pointer-events: none;}

/* LISTS & UI COMPONENTS */
#qrcode-container { display: flex; justify-content: center; margin: 20px 0; padding: 15px; background: white; border-radius: 12px; width: fit-content; margin: 0 auto; border: 4px solid var(--logo-cyan); }
.list-card { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.03); padding: 12px; margin-bottom: 8px; border-radius: 8px; border-left: 3px solid #555; text-align: left; }
.list-card.earn { border-left-color: var(--success); }
.list-card.redeem { border-left-color: var(--danger); }
.list-info h4 { font-size: 0.85rem; margin: 0 0 2px 0; color: #fff; }
.list-info p { font-size: 0.65rem; color: #888; margin: 0; }
.list-val { font-family: 'Rajdhani'; font-weight: bold; font-size: 1rem; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-cyan { color: var(--logo-cyan); }
.text-gold { color: gold; }

/* PAGINATION & BUTTONS */
.pagination-controls { display: flex; justify-content: center; gap: 10px; margin-top: 15px; align-items: center; }
.page-btn { background: #222; border: 1px solid #444; color: white; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
#page-indicator { font-size: 0.8rem; color: #888; }

.btn-add, .btn-primary { width: 100%; background: linear-gradient(90deg, #22d3ee, #0ea5e9); border: none; color: #000; padding: 14px; font-size: 0.95rem; font-weight: 800; border-radius: 10px; cursor: pointer; text-transform: uppercase; margin-top: 15px; letter-spacing: 1px; box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3); }
.btn-redeem, .btn-danger { background: linear-gradient(90deg, #ef4444, #b91c1c); color: white; margin-top: 10px; box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }
.btn-claim-elegant { width: 100%; background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(139, 92, 246, 0.2)); border: 1px solid var(--logo-cyan); color: var(--logo-cyan); padding: 16px; border-radius: 12px; font-family: 'Orbitron'; font-weight: 700; cursor: pointer; margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; text-transform: uppercase; font-size: 0.9rem; }
.btn-close { margin-top: 20px; font-size: 0.85rem; color: #777; padding: 10px; cursor: pointer; }
.btn-back { width: 100%; background: transparent; border: 1px solid #444; color: #ccc; padding: 10px; border-radius: 8px; cursor: pointer; margin-bottom: 10px; font-size: 0.8rem; display: none;}

/* Search & Inputs */
.search-bar-container { display: flex; gap: 5px; margin-bottom: 10px; }
.search-input { flex: 1; background: #222; border: 1px solid #444; padding: 10px; color: white; border-radius: 8px; font-family: 'Outfit'; }

.flavor-add-group { display: flex; gap: 5px; margin-bottom: 10px; }
.flavor-add-input { flex: 1; background: #222; border: 1px solid #333; padding: 10px; border-radius: 8px; color: white; }
.flavor-qty-input { width: 80px; background: #222; border: 1px solid #333; padding: 10px; border-radius: 8px; color: white; text-align: center; }
.btn-small-add { background: var(--logo-cyan); color: black; border: none; padding: 0 15px; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* DASHBOARD COMPONENTS */
.history-balance-card { background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(139, 92, 246, 0.1)); border: 1px solid var(--logo-cyan); padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.history-balance-card h3 { color: #aaa; font-size: 0.8rem; text-transform: uppercase; margin-bottom: 5px; }
.history-balance-card .balance-val { font-size: 2rem; font-family: 'Rajdhani'; font-weight: bold; color: white; }

.sales-tabs { display: flex; gap: 10px; margin-bottom: 15px; }
.tab-btn { flex: 1; background: transparent; border: 1px solid #444; color: #888; padding: 8px; border-radius: 8px; cursor: pointer; }
.tab-btn.active { border-color: var(--logo-cyan); color: white; background: rgba(0,240,255,0.1); }
.sales-summary { display: flex; justify-content: space-around; margin-bottom: 15px; background: #1a1a1a; padding: 10px; border-radius: 8px; }
.sum-box h5 { font-size: 0.7rem; color: #888; }
.sum-box span { font-size: 1.1rem; color: var(--logo-cyan); font-weight: bold; }

#scan-status-msg { background: rgba(139, 92, 246, 0.2); border: 1px solid var(--neon-primary); padding: 12px; border-radius: 8px; color: white; font-size: 0.85rem; margin-bottom: 15px; display: none; }
#reader { width: 100%; border-radius: 12px; overflow: hidden; border: 2px solid var(--logo-cyan); margin-bottom: 20px; }

/* --- UPDATED DASHBOARD BUTTONS --- */
.branch-btn {
    flex: 1; 
    padding: 15px; 
    border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 12px;
    font-family: 'Orbitron'; 
    font-size: 0.9rem; 
    font-weight: bold;
    cursor: pointer;
    background: rgba(255,255,255,0.03); 
    color: #666; 
    transition: all 0.3s ease;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.branch-btn:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

/* ACTIVE: MAIN (Purple/Cyan Glow) */
.branch-btn.active-main { 
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(0, 240, 255, 0.2));
    color: white; 
    border: 1px solid var(--neon-primary); 
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), inset 0 0 10px rgba(139, 92, 246, 0.2);
    text-shadow: 0 0 5px var(--neon-primary);
}

/* ACTIVE: BAROBO (Gold Glow) */
.branch-btn.active-barobo { 
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
    color: #ffda44; 
    border: 1px solid gold; 
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.2);
    text-shadow: 0 0 5px gold;
}

.branch-btn i { font-size: 1.2rem; }

/* --- DASHBOARD STATS & TABLE --- */
.stat-card {
    background: rgba(255,255,255,0.03); border: 1px solid #333;
    padding: 15px; border-radius: 10px; text-align: center;
}
.stat-card p { font-size: 0.65rem; color: #888; margin-bottom: 5px; letter-spacing: 1px; }
.stat-card h3 { font-family: 'Rajdhani'; font-size: 1.8rem; color: white; }

.report-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.report-table th { text-align: left; font-size: 0.7rem; color: #666; padding: 10px; border-bottom: 1px solid #333; }
.report-table td { padding: 12px 10px; font-size: 0.85rem; border-bottom: 1px solid #222; color: #ddd; }
.report-table tr:last-child td { border-bottom: none; }