/* PWA — bare functional styles. Designer phase will replace this.
 *
 * All rules are scoped under .pwa-shell (set on the body of the PWA layout)
 * because Propshaft serves every file under app/assets/stylesheets/ on every
 * page, so unscoped rules would bleed into the rest of the app.
 */

.pwa-shell, .pwa-shell * { box-sizing: border-box; }

.pwa-shell {
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #f3f4f6;
  background: #1f2937;
  min-height: 100vh;
}

#pwa-root {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#pwa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: #111827;
  border-bottom: 1px solid #374151;
  position: sticky;
  top: 0;
  z-index: 5;
}

.pwa-status { display: flex; gap: 0.4rem; flex-shrink: 0; }

.pwa-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #16a34a;
  color: #fff;
}
.pwa-pill[data-state="offline"] { background: #dc2626; }
.pwa-pill--quiet { background: #4b5563; }
.pwa-pill[hidden] { display: none; }

.pwa-user {
  font-size: 0.75rem;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pwa-shell main { flex: 1; padding: 1rem; }

.pwa-screen { display: block; }
.pwa-screen[hidden] { display: none; }

.pwa-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.pwa-screen-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.pwa-msg { color: #d1d5db; }

.pwa-btn {
  appearance: none;
  border: 0;
  background: #374151;
  color: #f3f4f6;
  padding: 0.75rem 1.1rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-btn:active { transform: translateY(1px); }
.pwa-btn--primary { background: #2563eb; }
.pwa-btn--ghost { background: transparent; color: #9ca3af; padding: 0.4rem 0.6rem; }

#pwa-scanner-container {
  position: relative;
  background: #000;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  margin-bottom: 1rem;
}
#pwa-scanner { width: 100%; height: 100%; }
#pwa-scanner video { width: 100% !important; height: 100% !important; object-fit: cover; }

#pwa-scanner-resume {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(17, 24, 39, 0.92);
  color: #f3f4f6;
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#pwa-scanner-resume[hidden] { display: none; }
.pwa-scanner-resume-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  padding-left: 0.25rem;
}
.pwa-scanner-resume-text {
  font-size: 1.05rem;
  font-weight: 600;
}

.pwa-or {
  text-align: center;
  color: #6b7280;
  margin: 0.6rem 0;
  font-size: 0.85rem;
}

.pwa-manual {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pwa-manual label {
  font-size: 0.85rem;
  color: #9ca3af;
}
.pwa-manual input {
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #374151;
  background: #111827;
  color: #f3f4f6;
  font-size: 1.1rem;
}

.pwa-hint {
  margin-top: 0.5rem;
  color: #fca5a5;
  font-size: 0.9rem;
}

.pwa-meta {
  color: #9ca3af;
  font-size: 0.9rem;
  margin: 0.25rem 0 0.75rem;
}

.pwa-current-banner {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: #111827;
  border: 1px solid #374151;
  border-left: 4px solid #f59e0b;
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}
.pwa-current-banner[data-state="empty"] { border-left-color: #6b7280; }
.pwa-current-label {
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pwa-current-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f3f4f6;
  line-height: 1.2;
}
.pwa-current-time {
  font-size: 0.8rem;
  color: #9ca3af;
}

.pwa-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pwa-pick-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin: 0.4rem 0 0.4rem;
}

.pwa-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pwa-pick-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.5rem;
  background: #374151;
  border: 0;
  color: #f3f4f6;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-pick-tile:active { background: #4b5563; }
.pwa-pick-tile[data-current="true"] { outline: 2px solid #60a5fa; }
.pwa-pick-tile-label {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}
.pwa-pick-tile-meta {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 0.4rem;
}
.pwa-pick-tile--category .pwa-pick-tile-meta { color: #93c5fd; }

.pwa-pick-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
  border-radius: 0.5rem;
  background: #374151;
  border: 0;
  color: #f3f4f6;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-pick-item:active { background: #4b5563; }
.pwa-pick-item[data-current="true"] {
  outline: 2px solid #60a5fa;
}
.pwa-pick-label { font-size: 1.2rem; font-weight: 600; }
.pwa-pick-sub { font-size: 0.85rem; color: #9ca3af; }

.pwa-confirm-card {
  background: #064e3b;
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}
.pwa-confirm-line { margin: 0.25rem 0; font-size: 1.1rem; }
.pwa-confirm-time { font-size: 0.85rem; color: #a7f3d0; }

.pwa-footer {
  text-align: center;
  padding: 0.5rem 0.75rem 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  border-top: 1px solid #1f2937;
}
