/* EkronTech Platform — Shared Styles
   White-labeled per tenant via the --primary CSS variable set in header.php */

:root {
  --primary: #1a73e8;
  --primary-dark: #0f4fb0;
  --green: #1e8e3e;
  --red: #d93025;
  --amber: #f9ab00;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1b1f23;
  --muted: #6b7280;
  --border: #e2e5ea;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.app-shell { min-height: 100%; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 16px; max-width: 980px; margin: 0 auto; width: 100%; }

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: #fff; }
.topbar-logo { height: 32px; width: auto; max-width: 140px; object-fit: contain; border-radius: 6px; background: rgba(255,255,255,0.95); padding: 2px; }
.logo-contain, .brand-logo-contain, .event-logo, .tenant-logo, img[src*="logo"], img[alt*="Logo"], img[alt*="Fair Share"] {
  object-fit: contain !important;
}
.topbar-event { font-size: 0.85rem; opacity: 0.9; margin-left: 8px; }

.topbar-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-link:hover { background: rgba(255,255,255,0.18); }
.nav-link.active { background: rgba(255,255,255,0.25); }

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.mobile-nav {
  display: none;
  background: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-bottom: 2px solid var(--primary);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block;
  color: #f1f5f9;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.mobile-nav a:hover { background: rgba(255,255,255,0.1); }
.mobile-nav .nav-group-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 10px 0 4px 8px;
  font-weight: 700;
}

.app-footer { text-align: center; padding: 14px; color: var(--muted); font-size: 0.8rem; }

h1, h2, h3 { line-height: 1.25; }
a { color: var(--primary); }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: transform 0.05s ease, opacity .15s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn.btn-lg { padding: 20px 24px; font-size: 1.15rem; width: 100%; }
.btn.btn-green { background: var(--green); }
.btn.btn-red { background: var(--red); }
.btn.btn-amber { background: var(--amber); color: #3a2a00; }
.btn.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn.btn-pulse { animation: pulse 1.6s infinite; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(30,142,62,0.55); }
  70% { box-shadow: 0 0 0 14px rgba(30,142,62,0); }
  100% { box-shadow: 0 0 0 0 rgba(30,142,62,0); }
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 6px; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: .04em; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-green { background: #e6f4ea; color: var(--green); }
.badge-red { background: #fce8e6; color: var(--red); }
.badge-amber { background: #fef7e0; color: #8a6100; }
.badge-grey { background: #eef0f3; color: var(--muted); }

/* ---------------- POS product tiles ---------------- */
.pos-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card-bg); border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 12px; box-shadow: var(--shadow); flex-wrap: wrap; gap: 10px;
}
.tile {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover {
  border-color: var(--primary);
}
.tile-top { display: flex; justify-content: space-between; align-items: baseline; }
.tile-name { font-weight: 700; font-size: 1.05rem; }
.tile-price { color: var(--muted); font-weight: 600; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 12px; border: none;
  font-size: 1.6rem; font-weight: 700; background: var(--bg); color: var(--primary);
  cursor: pointer;
}
.stepper button.plus { background: var(--primary); color: #fff; }
.stepper .count { flex: 1; text-align: center; font-size: 1.4rem; font-weight: 800; }

.cart-bar {
  position: sticky; bottom: 0; background: var(--card-bg);
  border-top: 2px solid var(--border); padding: 12px 16px; box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  border-radius: var(--radius) var(--radius) 0 0; margin-top: 16px;
}
.cart-total { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; display: flex; justify-content: space-between; }

/* ---------------- Scanner ---------------- */
#qr-reader { width: 100%; max-width: 480px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
.scan-flash-green { animation: flashGreen 0.6s ease; }
.scan-flash-blue { animation: flashBlue 0.6s ease; }
@keyframes flashGreen { 0% { background: #34d178; } 100% { background: transparent; } }
@keyframes flashBlue { 0% { background: #4aa3ff; } 100% { background: transparent; } }

/* ---------------- Card / pass print sheet ---------------- */
.pass-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.pass-card {
  width: 85mm; height: 50mm; border: 1px dashed #999; padding: 4mm;
  display: flex; flex-direction: column; justify-content: space-between; font-family: Arial, sans-serif;
}

/* ---------------- Thermometer / display screen ---------------- */
.thermo-wrap { background: #0b1220; color: #fff; border-radius: var(--radius); padding: 26px; text-align: center; }
.thermo-track { background: #1f2b45; border-radius: 999px; height: 34px; width: 100%; overflow: hidden; margin: 14px 0; }
.thermo-fill { background: linear-gradient(90deg, #34d178, #1e8e3e); height: 100%; transition: width 1s ease; }
.leaderboard-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }

/* ---------------- Venue map grid ---------------- */
.venue-grid {
  display: grid;
  gap: 2px;
  background: #cbd3dd;
  border: 2px solid #cbd3dd;
}
.venue-cell {
  background: #fff;
  min-height: 34px;
  position: relative;
}
.venue-stall {
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  cursor: grab;
  padding: 2px;
}

.flex-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 0.85rem; }

/* ---------------- Emoji Picker Grid ---------------- */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 8px;
}
.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  transition: transform 0.1s, background 0.15s;
  user-select: none;
}
.emoji-item:hover {
  background: #e2e8f0;
  transform: scale(1.15);
}

/* ---------------- Visitor Goal Bar & Live Stats Modal ---------------- */
.visitor-goal-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.visitor-goal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
.visitor-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.goal-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stats-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 999;
  overflow-y: auto;
  padding: 16px;
}
.stats-modal-content {
  background: #0f172a;
  color: #f8fafc;
  max-width: 680px;
  margin: 30px auto;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ---------------- Graphical Command Center Dashboard ---------------- */
.dash-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.dash-card {
  background: #111827;
  color: #f9fafb;
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.dash-card h3 {
  margin-top: 0;
  font-size: 1.15rem;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 10px;
}
.dash-metric {
  font-size: 2.2rem;
  font-weight: 800;
  color: #34d178;
  margin: 8px 0;
}

@media (max-width: 860px) {
  .topbar-nav { display: none; }
  .nav-toggle { display: block; }
}

@media (max-width: 640px) {
  .app-main { padding: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .dash-container { grid-template-columns: 1fr; }
}

/* Universal Floating QR Scanner Modal Overlay */
.qr-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: qrFadeIn 0.15s ease-out;
}
@keyframes qrFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.qr-modal-dialog {
  background: #ffffff;
  width: 100%;
  max-width: 460px;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  animation: qrModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes qrModalPop {
  0% { opacity: 0; transform: scale(0.92) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.qr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.qr-modal-body {
  padding: 16px;
}

