/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #06101a;
  --surface:   #0d1b2a;
  --card:      #112236;
  --border:    rgba(255,255,255,0.08);
  --accent:    #00c6ff;
  --accent2:   #0072ff;
  --success:   #00e676;
  --success2:  #00c853;
  --error:     #ff5252;
  --warning:   #ffd740;
  --text:      #e8f4fd;
  --text-muted:#7a9ab5;
  --radius:    14px;
  --shadow:    0 8px 32px rgba(0,0,0,0.5);
  --trans:     0.28s ease;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ── Screen System ────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans);
  z-index: 1;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-xl {
  padding: 20px 44px;
  font-size: 1.2rem;
  border-radius: 60px;
}
.btn-full { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,114,255,0.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(0,198,255,0.6);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success2), var(--success));
  color: #003820;
  box-shadow: 0 4px 20px rgba(0,230,118,0.35);
}
.btn-success:hover {
  box-shadow: 0 6px 28px rgba(0,230,118,0.55);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }

.btn-ghost-white {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
  backdrop-filter: blur(4px);
}
.btn-ghost-white:hover { background: rgba(255,255,255,0.2); }

.btn-icon { flex-shrink: 0; }
.mt-auto { margin-top: auto; }

/* ── Welcome Screen ───────────────────────────────────────── */
#screen-welcome {
  background: var(--bg);
  overflow: hidden;
  align-items: stretch;
  justify-content: stretch;
}

.welcome-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 15% 55%, rgba(0,114,255,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 95% 15%, rgba(0,198,255,0.1) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 85% 90%, rgba(0,114,255,0.07) 0%, transparent 50%);
  pointer-events: none;
}

.welcome-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 48px 80px;
}

/* Brand logo */
.brand-bar {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.brand-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

/* Main content area — no max-width, fill the TV */
.welcome-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 56px;
}

.welcome-text-block { line-height: 1; }

.welcome-heading {
  font-size: 9rem;
  font-weight: 800;
  letter-spacing: -4px;
  line-height: 0.95;
  background: linear-gradient(135deg, #fff 50%, rgba(255,255,255,0.5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-tagline {
  font-size: 2.2rem;
  color: var(--text-muted);
  margin-top: 20px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

/* ── Info cards row ──────────────────────────────────────── */
.info-cards {
  display: flex;
  gap: 32px;
}

.info-cards .delivery-card {
  flex: 1;
}

/* ── Delivery instructions card — big and attention-grabbing ── */
.delivery-card {
  display: flex;
  align-items: center;
  gap: 48px;
  /* Accent-tinted background with a strong left border */
  background: rgba(0, 198, 255, 0.06);
  border: 1px solid rgba(0, 198, 255, 0.22);
  border-left: 6px solid var(--accent);
  border-radius: 24px;
  padding: 52px 64px;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 80px rgba(0, 198, 255, 0.07),
    0 2px 0 rgba(255,255,255,0.04) inset;
}

/* Assistance card — warm amber accent instead of cyan */
.delivery-card--assist {
  background: rgba(255, 215, 64, 0.05);
  border-color: rgba(255, 215, 64, 0.22);
  border-left-color: var(--warning);
  box-shadow:
    0 0 80px rgba(255, 215, 64, 0.05),
    0 2px 0 rgba(255,255,255,0.04) inset;
}

.delivery-card-icon {
  font-size: 110px;
  line-height: 1;
  flex-shrink: 0;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(0,198,255,0.35));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.delivery-card-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: #fff;
}

.delivery-card-text {
  font-size: 1.85rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  font-weight: 400;
}

/* Call for assistance button */
.btn-call {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding: 18px 40px;
  background: linear-gradient(135deg, #d97706, #fbbf24);
  color: #1c0f00;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(251,191,36,0.35);
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s, color 0.2s;
}
.btn-call:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px rgba(251,191,36,0.55);
}
.btn-call:active { transform: scale(0.97); }
.btn-call:disabled { cursor: default; transform: none; }

.btn-call--calling {
  background: rgba(255,255,255,0.12);
  color: var(--text-muted);
  box-shadow: none;
}
.btn-call--success {
  background: linear-gradient(135deg, var(--success2), var(--success));
  color: #003820;
  box-shadow: 0 4px 24px rgba(0,230,118,0.35);
}
.btn-call--error {
  background: rgba(255,82,82,0.15);
  color: var(--error);
  border: 1.5px solid var(--error);
  box-shadow: none;
}

/* Footer with staff scan button */
.welcome-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 32px;
}

.btn-scan-staff {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-scan-staff:hover {
  background: rgba(0,198,255,0.12);
  border-color: rgba(0,198,255,0.4);
  color: var(--accent);
}

/* ── Camera Screen ────────────────────────────────────────── */
#screen-camera {
  flex-direction: column;
  background: #000;
  padding: 0;
  gap: 0;
}

.camera-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
  width: 100%;
}

.topbar-label {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

.camera-viewport-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 30%),
    linear-gradient(to top,    rgba(0,0,0,0.4) 0%, transparent 30%);
}

.scan-frame {
  position: relative;
  width: 70%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
}

.corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--accent);
  border-style: solid;
}
.corner.tl { top: 0; left: 0;  border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.scan-hint {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.45);
  padding: 6px 16px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.camera-bottombar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  width: 100%;
}

.capture-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  padding: 6px;
}
.capture-btn:active { transform: scale(0.92); }

.capture-btn-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: background 0.15s;
}
.capture-btn:hover .capture-btn-inner { background: var(--accent); }

/* ── Processing / Submitting Screens ─────────────────────── */
.centered-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 40px;
  max-width: 480px;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner--accent { border-top-color: var(--accent); }

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

.processing-title { font-size: 1.6rem; font-weight: 700; }
.processing-sub   { color: var(--text-muted); font-size: 1rem; }

/* ── Confirmation Screen ──────────────────────────────────── */
#screen-confirmation {
  background: var(--bg);
  align-items: stretch;
  padding: 0;
}

.confirmation-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.confirmation-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
  gap: 16px;
}

.confirmation-heading {
  font-size: 1.5rem;
  font-weight: 700;
}
.confirmation-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.captured-image-wrap {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.captured-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.confirmation-form-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px 40px;
  gap: 0;
}

/* ── Form ─────────────────────────────────────────────────── */
#package-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.form-group--half { flex: 1; }
.form-group--city  { flex: 3; }
.form-group--state { flex: 1.2; }
.form-group--zip   { flex: 1.5; }

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  opacity: 0.6;
}

input, select {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  padding: 13px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}
input::placeholder { color: var(--text-muted); opacity: 0.5; }

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,198,255,0.15);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a9ab5' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: var(--surface); }

.confirmation-actions {
  padding-top: 24px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Success Screen ───────────────────────────────────────── */
.success-circle {
  width: 100px;
  height: 100px;
}

.success-circle-bg {
  stroke: rgba(0,230,118,0.2);
  stroke-width: 2;
  animation: circle-grow 0.5s ease forwards;
}

.success-checkmark {
  stroke: var(--success);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw-check 0.5s 0.2s ease forwards;
}

@keyframes circle-grow {
  from { stroke-dasharray: 0 160; }
  to   { stroke-dasharray: 160 0; }
}
@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

.success-title { font-size: 2rem; font-weight: 800; color: var(--success); }
.success-sub   { color: var(--text-muted); font-size: 1.05rem; }

.auto-return-bar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auto-return-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}
.auto-return-text strong { color: var(--text); }

.auto-return-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.countdown-fill {
  height: 100%;
  background: var(--success);
  width: 100%;
  transform-origin: left;
  transition: transform 1s linear;
}

/* ── Error Screen ─────────────────────────────────────────── */
.error-icon  { font-size: 64px; }
.error-title { font-size: 1.7rem; font-weight: 700; color: var(--error); }
.error-msg   { color: var(--text-muted); font-size: 1rem; line-height: 1.5; max-width: 380px; }
.error-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ── PIN Modal ────────────────────────────────────────────── */
.pin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans);
  backdrop-filter: blur(8px);
}
.pin-modal.active {
  opacity: 1;
  pointer-events: all;
}
.pin-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px;
  width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  box-shadow: var(--shadow);
}
.pin-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.pin-dots {
  display: flex;
  gap: 18px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}
.pin-dot.error {
  background: var(--error);
  border-color: var(--error);
}
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-family: inherit;
}
.pin-key:active { background: rgba(0,198,255,0.2); }
.pin-key--cancel { font-size: 0.8rem; color: var(--text-muted); }
.pin-key--delete { font-size: 1.1rem; }

/* ── Mobile staff welcome ─────────────────────────────────── */
.mobile-staff-main {
  display: none; /* shown only on mobile */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex: 1;
}
.mobile-staff-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Show/hide desktop vs mobile sections */
  .desktop-only { display: none !important; }
  .mobile-only  { display: flex !important; }

  /* Welcome */
  .welcome-layout {
    padding: 32px 24px;
    align-items: center;
    justify-content: space-between;
  }

  .welcome-heading {
    font-size: 2.8rem;
    letter-spacing: -1px;
    line-height: 1;
  }
  .welcome-tagline {
    font-size: 1.05rem;
    margin-top: 8px;
  }
  .brand-logo-img { height: 36px; }

  /* Cards stack vertically */
  .info-cards { flex-direction: column; gap: 16px; }
  .info-cards .delivery-card { flex: none; }

  .delivery-card { padding: 24px 24px; gap: 20px; }
  .delivery-card-icon { font-size: 52px; }
  .delivery-card-title { font-size: 1.25rem; margin-bottom: 8px; }
  .delivery-card-text  { font-size: 0.95rem; }

  .btn-call {
    font-size: 1rem;
    padding: 13px 24px;
    margin-top: 14px;
  }

  /* Confirmation — stack sidebar above form */
  .confirmation-layout { flex-direction: column; }

  .confirmation-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
  }
  .confirmation-sidebar .confirmation-heading { font-size: 1.1rem; flex: 1; }
  .confirmation-sidebar .confirmation-sub     { display: none; }

  .captured-image-wrap {
    width: 80px;
    height: 56px;
    flex: none;
    flex-shrink: 0;
  }
  #btn-rescan {
    width: auto;
    flex-shrink: 0;
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  .confirmation-form-area { padding: 16px 16px 24px; }

  /* Reduce centered-content padding on small screens */
  .centered-content { padding: 32px 24px; }
}
