/* --- THEME & COLORS (v1.63 LIVE) --- */
:root {
    --space-indigo: #1E2741;
    --stormy-teal: #307785;
    --white-smoke: #F5F5F6;
    --golden-bronze: #CB9832;
    --white: #FFFFFF;
    --bg-app: var(--white-smoke);
    --text-dark: #333333;
    --danger: #c0392b;
    --success: #27ae60; 
    --barista-purple: #8e44ad;
    --clock-orange: #f39c12;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Open Sans', sans-serif; background-color: var(--bg-app); color: var(--text-dark); height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

/* PRINT STYLES */
@media print {
    body > * { display: none !important; }
    #modal-receipt { display: flex !important; }
    #modal-receipt .modal-content { box-shadow: none; border: none; padding: 0; width: 100%; max-width: 100%; }
    #receipt-content { display: block !important; border: none; padding: 20px; font-family: 'Courier New', Courier, monospace; }
    .no-print { display: none !important; }
}

/* LOGIN OVERLAY */
#login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--space-indigo); z-index: 9000; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--white); }
.login-box { background: var(--white); padding: 40px; border-radius: 12px; text-align: center; width: 90%; max-width: 850px; color: var(--text-dark); box-shadow: 0 10px 30px rgba(0,0,0,0.3); border-top: 8px solid var(--golden-bronze); position: relative; max-height: 90vh; overflow-y: auto; }
.login-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 25px; margin-top: 30px; margin-bottom: 30px; }
.login-btn-wrap { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: transform 0.2s; }
.login-btn-wrap:hover { transform: scale(1.05); }
.login-btn-img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 4px solid var(--golden-bronze); margin-bottom: 10px; background: #eee; }
.login-btn-name { font-weight: 700; color: var(--space-indigo); font-size: 1.1rem; }
.admin-buttons-row { display: flex; justify-content: center; gap: 20px; }
.admin-login-btn { background: #f8f9fa; border: 2px solid #e9ecef; padding: 12px 30px; border-radius: 50px; font-weight: 700; color: var(--space-indigo); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.admin-login-btn:hover { background: var(--space-indigo); color: white; border-color: var(--space-indigo); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.admin-divider { display: flex; align-items: center; text-align: center; margin: 30px 0 20px 0; color: #999; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }
.admin-divider::before, .admin-divider::after { content: ''; flex: 1; border-bottom: 1px solid #ddd; }
.admin-divider span { padding: 0 15px; }

/* LAYOUT */
.app-wrapper { display: flex; flex: 1; height: 100%; overflow: hidden; }
.sidebar { width: var(--sidebar-width); background-color: var(--space-indigo); color: var(--white); display: flex; flex-direction: column; padding: 20px; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
.logo-area { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-img { max-width: 100%; height: auto; max-height: 80px; }
.nav-links { list-style: none; flex-grow: 1; }
.nav-links li { padding: 15px; margin-bottom: 8px; border-radius: 6px; cursor: pointer; font-size: 1.1rem; font-weight: 600; transition: all 0.2s; border-left: 4px solid transparent; }
.nav-links li:hover { background-color: rgba(255,255,255,0.05); }
.nav-links li.active { background-color: rgba(255,255,255,0.1); border-left-color: var(--golden-bronze); color: var(--golden-bronze); }
.nav-links li i { margin-right: 12px; width: 25px; text-align: center; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); text-align: center;}
.top-bar { background-color: var(--stormy-teal); color: var(--white); padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 10; }
.current-cashier-display { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; }
.cashier-avatar { width: 35px; height: 35px; border-radius: 50%; margin-right: 10px; border: 2px solid var(--golden-bronze); object-fit: cover; }
#cloud-status { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; background: rgba(0,0,0,0.2); padding: 5px 12px; border-radius: 20px; cursor: default; pointer-events: none; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background-color: #ccc; }
.status-dot.online { background-color: #2ecc71; box-shadow: 0 0 5px #2ecc71; }
.status-dot.syncing { background-color: #f1c40f; animation: pulse 1s infinite; }
.status-dot.error { background-color: #e74c3c; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

.main-content { flex-grow: 1; background-color: var(--bg-app); overflow-y: hidden; position: relative; display: flex; flex-direction: column; }
.view { display: none; height: 100%; padding: 25px; overflow-y: auto; }
.view.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* POS COMPONENTS */
.pos-layout { display: flex; gap: 20px; height: 100%; }
.product-section { flex: 2; display: flex; flex-direction: column; overflow: hidden; }
.category-tabs { display: flex; gap: 10px; padding-bottom: 10px; overflow-x: auto; flex-shrink: 0; }
.cat-tab { background: var(--white); color: var(--space-indigo); padding: 12px 20px; border-radius: 25px; border: 2px solid #ddd; cursor: pointer; font-weight: 600; white-space: nowrap; }
.cat-tab.active { background: var(--space-indigo); color: var(--white); border-color: var(--space-indigo); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; overflow-y: auto; padding: 5px; padding-bottom: 80px; }
.product-card { background: var(--white); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.08); cursor: pointer; transition: transform 0.1s; border: 1px solid #eee; display: flex; flex-direction: column;}
.product-card:active { transform: scale(0.96); }
.p-image { height: 100px; width: 100%; background-color: #eee; background-size: cover; background-position: center; }
.p-info { padding: 10px; text-align: center; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between;}
.p-name { font-weight: 700; font-size: 0.95rem; color: var(--space-indigo); margin-bottom: 4px; }
.p-price { color: var(--golden-bronze); font-weight: bold; }
.cart-panel { flex: 1; min-width: 340px; background: var(--white); border-radius: 10px; display: flex; flex-direction: column; box-shadow: -2px 0 15px rgba(0,0,0,0.05); border-top: 5px solid var(--golden-bronze); }
.cart-header { padding: 15px; border-bottom: 1px solid #eee; background: #fcfcfc; border-radius: 10px 10px 0 0;}
.cart-items { flex-grow: 1; overflow-y: auto; padding: 0 15px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.item-info h4 { font-size: 0.95rem; color: var(--space-indigo); }
.item-info .opts { font-size: 0.75rem; color: #777; font-style: italic; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.btn-qty { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #ddd; background: #f9f9f9; cursor: pointer; color: var(--space-indigo); }
.btn-del { color: var(--danger); background: none; border: none; cursor: pointer; margin-left: 5px;}
.cart-totals { padding: 15px; background: #fafafa; border-top: 1px solid #eee; }
.total-row { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 1rem; }
.grand-total { font-size: 1.4rem; font-weight: 800; color: var(--space-indigo); margin-top: 10px; border-top: 1px solid #ddd; padding-top: 10px; }
.cart-actions { padding: 15px; display: grid; gap: 10px; }
.btn-pay { padding: 15px; border: none; border-radius: 6px; font-size: 1.1rem; font-weight: bold; color: var(--white); cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; }
.btn-cash { background-color: var(--success); }
.btn-card { background-color: var(--space-indigo); }
.btn-train { background-color: #95a5a6; }
.btn-gold { background-color: var(--golden-bronze); }
#customer-name { font-size: 1.2rem; padding: 15px; border: 2px solid var(--golden-bronze); border-radius: 8px; background: #fffdf8; color: var(--space-indigo); font-weight: 600; width: 100%; box-sizing: border-box;}
.input-error { border-color: var(--danger) !important; background-color: #fff0f0 !important; }

.barista-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.order-card { background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.1); border: 1px solid #eee; }
.oc-header { background: var(--barista-purple); color: white; padding: 15px; }
.oc-title { display: flex; justify-content: space-between; font-weight: bold; font-size: 1.1rem; }
.oc-customer { font-size: 0.9rem; margin-top: 5px; opacity: 0.9; }
.oc-body { padding: 15px; min-height: 150px; }
.oc-item { margin-bottom: 10px; border-bottom: 1px dashed #eee; padding-bottom: 5px; }
.oc-item-name { font-weight: bold; font-size: 1.1rem; color: var(--space-indigo); }
.oc-opts { display: inline-block; background: #fff3cd; color: #856404; font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }
.oc-footer { padding: 15px; border-top: 1px solid #eee; }
.btn-ready { width: 100%; background: var(--success); color: white; border: none; padding: 12px; border-radius: 6px; font-weight: bold; cursor: pointer; }

.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--white); padding: 25px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 15px; border-left: 5px solid var(--stormy-teal); }
.stat-icon { font-size: 2rem; color: var(--stormy-teal); }
.stat-data h3 { font-size: 0.9rem; color: #777; text-transform: uppercase; }
.stat-data p { font-size: 1.5rem; font-weight: bold; color: var(--space-indigo); }
.recent-orders { background: var(--white); border-radius: 10px; padding: 20px; }
.ro-header { font-size: 1.2rem; margin-bottom: 15px; color: var(--space-indigo); border-bottom: 2px solid var(--golden-bronze); padding-bottom: 5px; display: inline-block;}
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px; background: #f8f9fa; color: #666; font-size: 0.9rem; }
td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; border-radius: 4px; background: var(--stormy-teal); color: var(--white); border: none; cursor: pointer; }
.btn-danger-sm { background: var(--danger); }
.status-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; }
.status-badge.stock-ok { background: #d4edda; color: #155724; }
.status-badge.stock-low { background: #f8d7da; color: #721c24; }

.clock-header { background: var(--clock-orange); color: white; padding: 40px; border-radius: 12px; text-align: center; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3); }
.clock-time { font-size: 4rem; font-weight: 700; margin-bottom: 10px; text-shadow: 1px 1px 3px rgba(0,0,0,0.2); }
.clock-date { font-size: 1.2rem; opacity: 0.9; }
.clock-controls { background: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; display: flex; gap: 20px; align-items: center; }
.clock-select { flex: 1; padding: 12px; font-size: 1.1rem; border: 1px solid #ddd; border-radius: 6px; }
.btn-clock { padding: 12px 30px; border: none; border-radius: 6px; font-size: 1.1rem; font-weight: bold; cursor: pointer; color: white; }
.active-workers { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.worker-pill { background: #d4edda; color: #155724; padding: 8px 15px; border-radius: 20px; font-weight: bold; display: flex; align-items: center; gap: 8px; border: 1px solid #c3e6cb;}

.manager-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
    gap: 20px; 
    align-items: start;
}
.manager-box { background: white; padding: 20px; border-radius: 10px; border-top: 4px solid var(--golden-bronze); position: relative; }
.it-left-panel { border-top-color: #8e44ad; }
.it-right-panel { border-top-color: var(--golden-bronze); }
.bug-form textarea { width: 100%; height: 80px; resize: vertical; margin-bottom: 10px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
.github-notes-box { background: #f1f1f1; padding: 15px; border-radius: 8px; font-size: 0.85rem; max-height: 200px; overflow-y: auto; white-space: pre-wrap; margin-bottom: 20px; border: 1px solid #ccc; font-family: monospace; }
.expandable-section details { margin-bottom: 10px; border: 1px solid #eee; border-radius: 5px; background: #fafafa; }
.expandable-section summary { padding: 10px; cursor: pointer; font-weight: bold; outline: none; }
.expandable-section ul { list-style: disc; margin: 10px 0 10px 30px; font-size: 0.9rem; }

/* MODALS */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(30, 39, 65, 0.9); z-index: 100000; display: none; justify-content: center; align-items: center; }
.modal.open { display: flex; }
.modal-content { background: var(--white); padding: 25px; border-radius: 12px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.opt-group-title { margin-top: 15px; font-weight: bold; color: var(--stormy-teal); }
.opt-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; }
.opt-btn { padding: 8px 15px; border: 1px solid #ddd; background: #f9f9f9; border-radius: 20px; cursor: pointer; transition: all 0.2s; }
.opt-btn.selected { background: var(--golden-bronze); color: var(--white); border-color: var(--golden-bronze); }
.custom-note-input { width: 100%; padding: 10px; margin-top: 10px; border: 1px solid #ddd; border-radius: 6px; }

.total-display-large { background: var(--space-indigo); color: white; padding: 10px; text-align: center; border-radius: 8px 8px 0 0; font-size: 1.2rem; }
.calc-display { background: var(--white-smoke); padding: 15px; text-align: right; font-size: 2rem; font-weight: bold; border-radius: 0 0 8px 8px; margin-bottom: 20px; color: var(--space-indigo); border: 1px solid #ddd; }
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.calc-btn { padding: 15px; font-size: 1.2rem; background: var(--white); border: 1px solid #ddd; border-radius: 6px; cursor: pointer; color: var(--space-indigo); }
.change-result { background: #dff0d8; color: #3c763d; padding: 15px; text-align: center; font-size: 1.5rem; font-weight: bold; border-radius: 8px; margin-bottom: 20px; display: none; }
.receipt-paper { font-family: 'Courier New', Courier, monospace; border: 1px solid #ddd; padding: 20px; background: #fff; margin-bottom: 20px; font-size: 0.9rem; }
.r-center { text-align: center; margin-bottom: 10px; }
.r-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.r-line { border-bottom: 1px dashed #000; margin: 10px 0; }
.r-total { font-weight: bold; font-size: 1.1rem; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--space-indigo); }
.form-control { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 1rem; }
.emp-thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--stormy-teal); }
.hidden { display: none !important; }

/* PIN PAD */
#pin-pad-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 15px; }
.pin-btn { padding: 20px; font-size: 1.5rem; border-radius: 10px; border: 1px solid #ddd; background: white; cursor: pointer; color: var(--space-indigo); font-weight: bold; }
.pin-btn:active { background: #eee; }
#pin-display { font-size: 2rem; letter-spacing: 10px; text-align: center; margin-bottom: 10px; height: 50px; background: #f0f0f0; border-radius: 8px; line-height: 50px;}
.pin-msg { color: var(--danger); text-align: center; height: 20px; margin-top: 5px; font-weight: bold; }

.upload-options { display: flex; gap: 10px; margin-top: 5px; flex-wrap: wrap;}
.img-preview-box { width: 100%; height: 150px; border: 1px dashed #ccc; border-radius: 8px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; background: #f9f9f9; overflow: hidden; }
.img-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.inv-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; box-shadow: 0 2px 6px rgba(0,0,0,0.18); }
.data-table-inventory th { cursor: pointer; user-select: none; }
.data-table-inventory th:first-child { cursor: default; }
.sort-icon { font-size: 0.75rem; margin-left: 4px; opacity: 0.5; }
.sort-icon.active { opacity: 1; }
.sort-icon.asc::after { content: "↑"; margin-left: 2px; }
.sort-icon.desc::after { content: "↓"; margin-left: 2px; }
.prod-img-preview { margin-top: 8px; width: 120px; height: 80px; border-radius: 8px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
