/* ============================================
   SWEET CASHIER - Customer QR Order App
   Mobile-first, minimal, fast
   ============================================ */

:root {
  --primary: #FF6B35;
  --primary-dark: #E55A2B;
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --text: #333333;
  --text-light: #777777;
  --border: #E0E0E0;
  --success: #4CAF50;
  --danger: #F44336;
  --warning: #FF9800;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ============================================
   PAGES
   ============================================ */

.page {
  display: none;
  min-height: 100dvh;
}
.page.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   LOADING / CENTER CONTENT
   ============================================ */

.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.icon-large {
  font-size: 64px;
  margin-bottom: 16px;
}

.center-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.center-content p {
  color: var(--text-light);
  font-size: 15px;
  margin-bottom: 24px;
  max-width: 280px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

#page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 100dvh;
}
#page-loading p {
  color: var(--text-light);
  margin-top: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.97);
}
.btn-primary:disabled {
  background: #CCC;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-secondary:active {
  background: #FFF5F0;
}

.btn-lg {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  border-radius: 16px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   MENU HEADER
   ============================================ */

.menu-header {
  background: white;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ============================================
   CATEGORIES BAR
   ============================================ */

.categories-bar {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 68px;
  z-index: 9;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.categories-bar::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.cat-tab.active {
  background: var(--primary);
  color: white;
}

/* ============================================
   PRODUCTS LIST
   ============================================ */

.products-list {
  flex: 1;
  padding: 12px 16px 100px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s;
}
.product-card:active {
  transform: scale(0.98);
}

.product-img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-allergens {
  font-size: 11px;
  color: var(--warning);
  margin-top: 2px;
}

.product-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.product-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.product-add-btn:active {
  transform: scale(0.9);
}

.category-section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 16px 0 8px;
  padding-left: 4px;
  color: var(--text);
}

/* ============================================
   CART FAB
   ============================================ */

.cart-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 28px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255,107,53,0.4);
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fabPulse 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.cart-fab:active {
  transform: scale(0.95);
}

@keyframes fabPulse {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   CART PAGE
   ============================================ */

.cart-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.cart-header h2 {
  font-size: 18px;
}

.cart-items {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.cart-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.cart-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-item-name {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
}

.cart-item-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 15px;
  margin-left: 8px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.qty-btn:active {
  background: var(--bg);
}
.qty-btn.remove {
  border-color: var(--danger);
  color: var(--danger);
}

.qty-value {
  font-size: 16px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.cart-item-note {
  margin-top: 8px;
}
.cart-item-note input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.cart-item-note input:focus {
  border-color: var(--primary);
}

.cart-empty {
  text-align: center;
  color: var(--text-light);
  padding: 60px 20px;
  font-size: 15px;
}

.cart-note {
  padding: 0 16px 12px;
}
.cart-note label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  display: block;
  margin-bottom: 6px;
}
.cart-note textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  resize: none;
  outline: none;
  font-family: inherit;
}
.cart-note textarea:focus {
  border-color: var(--primary);
}

.cart-footer {
  padding: 16px;
  background: white;
  border-top: 1px solid var(--border);
}

.cart-total {
  text-align: center;
  font-size: 18px;
  margin-bottom: 12px;
}
.cart-total strong {
  color: var(--primary);
  font-size: 22px;
}

/* ============================================
   ORDER STATUS
   ============================================ */

.status-box {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
}

.status-pending {
  background: #FFF3E0;
  color: var(--warning);
}
.status-confirmed {
  background: #E8F5E9;
  color: var(--success);
}
.status-rejected {
  background: #FFEBEE;
  color: var(--danger);
}

#order-status-reason {
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

/* ============================================
   SENDING OVERLAY
   ============================================ */

.sending-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.sending-overlay .sending-box {
  background: white;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.sending-overlay .loading-spinner {
  margin: 0 auto 12px;
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
  display: none !important;
}
