/* =========================
   HTQS – Clean, stable layout
   (Fixes “Live Queue shifted left” + removes duplicate container rules)
   ========================= */

:root{
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #111;
  --muted: #555;
  --border: #e6e6e6;

  /* Section accents (color layers) */
  --driver: #2f7dd1;
  --queue:  #6f42c1;
  --doorman:#c92a2a;

  --shadow: 0 10px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body{
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.toast{
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;

  display: none;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);

  background: #111;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.toast.show{ display: block; }
.toast.ok{ background: #111; }
.toast.warn{ background: #7a4a00; }
.toast.err{ background: #7a1010; }

.netStatus{
  font-size: 12px;
  opacity: 0.7;
  margin: 6px auto 0;
  width: fit-content;
}
.netStatus.offline{
  opacity: 1;
  font-weight: 600;
}

body{
  font-family: Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 500px at 50% 0%, #ffffff 0%, var(--bg) 65%);
}

/* Header */
.header{
  text-align: center;
  padding: 28px 16px 10px;
}
/* Offer Alert */
.offer-alert {
  margin-top: 14px;
  padding: 14px 16px;
  border: 2px solid #d97706;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.95));
  box-shadow: 0 10px 26px rgba(217, 119, 6, 0.18);

  /* ✨ ADD THESE */
  position: relative;
  overflow: hidden;

  opacity: 0;
  transform: translateY(6px) scale(0.98);

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

 .offer-alert.hidden {
  opacity: 0;
  pointer-events: none;
}

.sound-unlock-banner {
  display: block;
  max-width: 640px;
  margin: 16px auto 24px;
  padding: 14px 18px;
  text-align: center;
  border-radius: 12px;
  background: #fff3cd;
  border: 1px solid #f0d98c;
  font-weight: 700;
  cursor: pointer;
}

.sound-unlock-banner.hidden {
  display: none;
}

.hidden {
  display: none;
}

.offer-alert-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400e;
  margin-bottom: 6px;
}

.offer-alert-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #7c2d12;
  margin-bottom: 6px;
}

.offer-alert-countdown {
  font-size: 0.95rem;
  font-weight: 600;
  color: #b45309;
}

.offer-alert.active {
  animation: offerPulse 1.15s ease-in-out infinite;
}
.offer-alert {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.offer-alert.urgent {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 10px 30px rgba(245, 158, 11, 0.18);
}

.offer-alert.final-seconds {
  border-color: #ef4444;
  background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14), 0 12px 34px rgba(239, 68, 68, 0.2);
  animation: offerShake 0.42s ease-in-out infinite;
}

.offer-alert-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.offer-alert-text {
  font-weight: 600;
}

.offer-alert-countdown {
  font-size: 14px;
  font-weight: 700;
}

.offer-alert.urgent .offer-alert-countdown {
  color: #b45309;
}

.offer-alert.final-seconds .offer-alert-countdown {
  color: #b91c1c;
}

@keyframes offerPulse {
  0%, 100% {
    background: #fff3cd;
    border-color: #f0d38a;
    box-shadow: 0 0 0 rgba(255, 193, 7, 0);
  }

  50% {
    background: #ffd84d;
    border-color: #ffb300;
    box-shadow: 0 0 18px rgba(255, 193, 7, 1);
  }
}

@keyframes offerShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-1px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(1px); }
}


.header h1{
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.2px;
}

.subtitle{
  margin: 8px 0 0;
  color: var(--muted);
}

/* ✅ ONE container rule (no duplicates) */
.container{
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 28px;
  display: grid;
  gap: 18px;
}

/* Cards */
.card{
  width: 100%;
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.03);
}

.card h2{
  margin: 0 0 10px;
  font-size: 26px;
}

.hint{
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

/* Section “color layers” (subtle but distinct) */
.section.driver{
  border-left: 7px solid var(--driver);
  background: linear-gradient(90deg, rgba(47,125,209,0.07), rgba(255,255,255,0) 55%);
}

.section.queue{
  border-left: 7px solid var(--queue);
  background: linear-gradient(90deg, rgba(111,66,193,0.07), rgba(255,255,255,0) 55%);
}
.queue-health-card {
  margin-top: 14px;
}

#queueHealthBox {
  line-height: 1.7;
  font-size: 15px;
}
.section.doorman{
  border-left: 7px solid var(--doorman);
  background: linear-gradient(90deg, rgba(201,42,42,0.07), rgba(255,255,255,0) 55%);
}

/* Rows + Inputs */
.row{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.input{
  flex: 1 1 240px;
  min-width: 180px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  background: #fff;
}

.input:focus{
  border-color: #b8b8b8;
}

/* Buttons */
.btn{
  padding: 10px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  white-space: nowrap;
}

.toggle{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  color:#333;
  margin-top:8px;
}
.toggle input{
  width:18px;
  height:18px;
}

.muted{
  color: #666;
  font-size: 14px;
  margin-top: 8px;
}

.btn:hover{ filter: brightness(0.97); }
.btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary{ border-color: #222; }
.btn.danger{
  border: 2px solid var(--doorman);
  color: var(--doorman);
}
.btn.danger:hover{
  background: var(--doorman);
  color: #fff;
}

.btn.is-loading {
  opacity: 0.75;
  cursor: wait;
  transform: translateY(0); /* prevents press jiggle */
}
.btn.is-loading::after {
  content: "…";
}
/* Accept button polish */
#acceptBtn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.12s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease;
}

/* hidden / inactive feel */
#acceptBtn:disabled {
  opacity: 0.45;
}

/* when a real offer is available */
#acceptBtn.is-offered {
  background: linear-gradient(180deg, #1fbf63 0%, #16a34a 100%);
  border-color: #148a3d;
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.28);
}

/* hover / touch-ready feeling */
#acceptBtn.is-offered:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(22, 163, 74, 0.34);
}

/* pressed feel */
#acceptBtn.is-offered:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.22);
}

/* urgent state */
#acceptBtn.is-offered.is-urgent {
  background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%);
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.34);
}

/* final seconds */
#acceptBtn.is-offered.is-final {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  border-color: #b91c1c;
  color: #fff;
  box-shadow: 0 14px 30px rgba(239, 68, 68, 0.38);
  animation: acceptUrgentPulse 0.55s ease-in-out infinite;
}

@keyframes acceptUrgentPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.30);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 18px 36px rgba(239, 68, 68, 0.45);
  }
}


@keyframes acceptPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12), 0 10px 24px rgba(245, 158, 11, 0.18);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18), 0 14px 28px rgba(245, 158, 11, 0.22);
  }
}

@keyframes acceptShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-1px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(1px); }
}
/* Queue list */
.queue{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  min-height: 40px;
}

.queue li{
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px 12px;
}

/* Optional: if your JS renders a richer “queue-item” layout */
.queue-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.queue-item.status-offered {
  animation: offerRowPulse 0.7s infinite;
  border: 2px solid #ffb300;
}

@keyframes offerRowPulse {
  0%, 100% {
    background: #ffffff;
  }

  50% {
    background: #ffd84d;
  }
}
.queue-item .pos{ opacity: 0.7; min-width: 2ch; }
.queue-item .driver{ flex: 1; }
.queue-item .badge{
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  font-weight: 600;
}

.queue-item.status-waiting .badge{ background:#f5f5f5; }
.status-offered .badge {
  background: #fff3cd;
  border-color: #f0d38a;
  animation: offeredBlink 0.8s infinite;
}

@keyframes offeredBlink {
  0%, 100% {
    background: #fff3cd;
    color: #111;
  }

  50% {
    background: #ffb300;
    color: #000;
  }
}
.queue-item.status-accepted .badge{ background:#d1f7d6; border-color:#8fdaa0; }

.queue-item.status-arrived {
  background: #dbeafe;
  border: 1px solid #60a5fa;
}

.queue-item.status-arrived .badge {
  background: #bfdbfe;
  border-color: #60a5fa;
  color: #1e3a8a;
}

/* Small screens */
@media (max-width: 520px){
  .header h1{ font-size: 28px; }
  .card{ padding: 16px; }
  .card h2{ font-size: 22px; }
}

/* ============================
   Premium visual pulse (no sound)
   ============================ */

@keyframes softPulseGlow {
  0%   { box-shadow: 0 0 0 0 rgba(70, 120, 255, 0.0); }
  50%  { box-shadow: 0 0 0 10px rgba(70, 120, 255, 0.14); }
  100% { box-shadow: 0 0 0 0 rgba(70, 120, 255, 0.0); }
}

/* Pulse the Accept button when an offer is for THIS driver */
#acceptBtn.is-offered {
  animation: softPulseGlow 1.6s ease-in-out infinite;
}

/* Add a subtle “ring” around Driver Check-In card */
.card.driver.is-offered {
  position: relative;
}

.card.driver.is-offered::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  pointer-events: none;
  animation: softPulseGlow 1.6s ease-in-out infinite;
}

.sound-hint {
  display: none;                /* hidden by default */
  margin: 12px auto;
  padding: 10px 14px;
  max-width: 360px;
  text-align: center;
  font-size: 14px;
  color: #333;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #acceptBtn.is-offered,
  .card.driver.is-offered::after {
    animation: none;
    box-shadow: 0 0 0 6px rgba(70, 120, 255, 0.12);
  }
}
/* ============================= */
/* Connection Status Badge */
/* ============================= */

.netStatus {
  display: block;
  width: fit-content;
  text-align: center;
  font-weight: 700;
  margin: 8px auto 14px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
}

.netStatus.online {
  color: #2f7d32;
  background: #e8f5e9;
  border: 1px solid #b7dfb9;
}

.netStatus.offline {
  color: #b26a00;
  background: #fff3cd;
  border: 1px solid #f3d27a;
}