/* Dynamic & Sleek Kiosk Design System - Dark Neon Glassmorphism */
:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --qris-red: #ed1c24;
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.4);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.4);
  --glow-qris: 0 0 25px rgba(237, 28, 36, 0.4);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 70%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Header Navbar */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--glow-cyan);
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(90deg, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 30px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-glass);
  font-size: 13px;
  font-weight: 500;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

.pill-dot.offline {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
  animation: pulse 1.2s infinite;
}

/* Offline Warning Banner */
.offline-warning-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.22), rgba(245, 158, 11, 0.18));
  border-bottom: 1px solid rgba(244, 63, 94, 0.5);
  padding: 12px 32px;
  backdrop-filter: blur(12px);
  z-index: 99;
}

.offline-warning-banner.active {
  display: flex;
}

.offline-warning-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.offline-warning-icon {
  font-size: 24px;
}

.offline-warning-title {
  font-size: 14px;
  font-weight: 700;
  color: #fda4af;
}

.offline-warning-sub {
  font-size: 12px;
  color: var(--text-main);
  opacity: 0.9;
}

.offline-retry-btn {
  background: rgba(244, 63, 94, 0.25);
  border: 1px solid rgba(244, 63, 94, 0.6);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.offline-retry-btn:hover {
  background: rgba(244, 63, 94, 0.45);
}

.modal-offline-alert {
  display: none;
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.5);
  color: #fda4af;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.modal-offline-alert.active {
  display: block;
}

.admin-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-fast);
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Layout Container */
.kiosk-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* Filter Tabs */
.category-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  padding: 12px 24px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab-btn.active, .tab-btn:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
  border-color: var(--accent-cyan);
  color: var(--text-main);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), var(--glow-cyan);
}

.slot-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  z-index: 2;
}

.product-img-wrap {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
}

.product-img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  transition: var(--transition-smooth);
}

.product-card:hover .product-img {
  transform: scale(1.08);
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.product-stock {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stock-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

.product-card.out-of-stock .stock-indicator {
  background: var(--accent-rose);
}

.product-card.out-of-stock {
  opacity: 0.55;
  filter: grayscale(0.5);
  pointer-events: none;
}

.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-glass);
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: #38bdf8;
}

.add-btn {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.add-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--glow-cyan);
}

/* Sidebar Cart Panel */
.cart-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: fit-content;
  position: sticky;
  top: 96px;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-glass);
}

.cart-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.clear-cart {
  font-size: 12px;
  color: var(--accent-rose);
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 600;
}

.cart-item-slot {
  font-size: 11px;
  color: var(--accent-cyan);
}

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 8px;
  padding: 2px 6px;
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  height: 20px;
}

.cart-summary {
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.summary-row.total {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px stroke rgba(255, 255, 255, 0.1);
}

.total-amount {
  color: var(--accent-emerald);
}

.checkout-btn {
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  background: linear-gradient(135deg, #ed1c24, #c10d14);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--glow-qris);
  transition: var(--transition-fast);
}

.checkout-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(237, 28, 36, 0.6);
}

.checkout-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* QRIS Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.qris-modal {
  background: #0f172a;
  border: 1px solid rgba(237, 28, 36, 0.4);
  border-radius: 24px;
  width: 90%;
  max-width: 460px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--glow-qris);
  text-align: center;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .qris-modal {
  transform: scale(1);
}

.close-modal {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.2);
}

.qris-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.qris-badge {
  background: #ffffff;
  color: #000;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 6px;
  letter-spacing: 1px;
  font-size: 18px;
}

.qris-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.qr-box {
  background: #ffffff;
  padding: 18px;
  border-radius: 16px;
  display: inline-block;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
}

#qrisCanvas {
  width: 220px !important;
  height: 220px !important;
  display: block;
}

.payment-amount {
  font-size: 26px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 8px;
}

.timer-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--accent-amber);
  margin-bottom: 20px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-amber);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.simulator-bar {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 14px;
  margin-top: 16px;
}

.sim-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 10px;
}

.sim-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sim-btn:hover {
  box-shadow: var(--glow-emerald);
  transform: translateY(-1px);
}

/* Dispensing Modal Animation */
.dispense-modal {
  background: #0f172a;
  border: 1px solid var(--accent-cyan);
  border-radius: 24px;
  width: 90%;
  max-width: 480px;
  padding: 32px;
  text-align: center;
}

.dispense-animation-box {
  width: 120px;
  height: 120px;
  margin: 20px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gear-spinner {
  width: 100px;
  height: 100px;
  border: 4px dashed var(--accent-cyan);
  border-radius: 50%;
  animation: spin 3s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.dispense-icon {
  position: absolute;
  font-size: 40px;
  animation: bounce 1s ease infinite alternate;
}

@keyframes bounce {
  0% { transform: translateY(-8px); }
  100% { transform: translateY(8px); }
}

.status-log {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 12px;
  color: var(--accent-cyan);
  text-align: left;
  max-height: 100px;
  overflow-y: auto;
  margin-top: 16px;
}
