@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #d97706; /* Spiritual Saffron Amber */
  --primary-dark: #b45309;
  --primary-light: #fef3c7;
  --secondary: #10b981;
  --danger: #ef4444;
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.25);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.temple-badge {
  background: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  opacity: 0.9;
  font-weight: 500;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-tag {
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Navigation Tabs */
.app-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 62px;
  z-index: 40;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-container::-webkit-scrollbar { display: none; }

.nav-btn {
  flex: 1;
  min-width: 90px;
  padding: 12px 10px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fffbeb;
}

/* Layout Container */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

/* Tab Sections */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}

/* TVS Barcode Input Box (PC Scanner wedge) */
.tvs-wedge-box {
  background: #1e293b;
  color: #f8fafc;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
}

.tvs-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tvs-input-group {
  display: flex;
  gap: 8px;
}

.tvs-input {
  flex: 1;
  background: #0f172a;
  border: 2px solid #334155;
  color: #38bdf8;
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.tvs-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Camera Scanner Container */
.camera-box {
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 2px solid var(--border);
}

#qr-reader {
  width: 100% !important;
  border: none !important;
}

.scanner-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Guest Detail Popover Card */
.guest-result-card {
  border-left: 6px solid var(--primary);
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.guest-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* Grid stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--secondary); color: white; }
.btn-danger  { background: var(--danger); color: white; }
.btn-secondary { background: #f1f5f9; color: #334155; }

.btn-block { width: 100%; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.active { display: flex; }

.modal-body {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Centered Popup Dialog Modal */
.scan-flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scan-popup-dialog {
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 24px 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: popupSlide 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupSlide {
  from { opacity: 0; transform: scale(0.92) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 30px;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.popup-badge-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.popup-badge-duplicate {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.popup-badge-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.popup-guest-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 8px;
}

.popup-token-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #b45309;
  border: 1px solid #e2e8f0;
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.popup-details-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 18px;
}

.scan-continue-btn {
  background: #d97706;
  color: #ffffff;
  border: none;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, background 0.2s ease;
}

.scan-continue-btn:hover {
  background: #b45309;
}

.scan-continue-btn:active {
  transform: scale(0.97);
}
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.toast-success { border-left: 5px solid #10b981; }
.toast.toast-error   { border-left: 5px solid #ef4444; }
.toast.toast-warn    { border-left: 5px solid #f59e0b; }
