/**
 * Field Worker View Mobile Styles (Phone Browser & Mobile PWA)
 */

.worker-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  background: var(--bg-main);
  position: relative;
  overflow: hidden;
}

/* Worker Header */
.worker-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}
.worker-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
}
.worker-brand img {
  width: 26px;
  height: 26px;
}
.sync-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
}
.sync-badge-btn.has-pending {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  animation: pulseAmber 2s infinite;
}
@keyframes pulseAmber {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Worker Content */
.worker-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  padding-bottom: 5rem;
  -webkit-overflow-scrolling: touch;
}

/* Worker Bottom Navigation Bar */
.worker-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 20;
}
.worker-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 0.35rem 0.8rem;
}
.worker-nav-item.active {
  color: var(--primary);
  font-weight: 600;
}
.worker-nav-item svg,
.worker-nav-item .material-symbols-rounded {
  width: 22px;
  height: 22px;
  font-size: 22px;
}

/* Hide Desktop button on phones & screens where desktop version cannot fit properly */
@media (max-width: 860px), (max-height: 500px) and (orientation: landscape) {
  #worker-nav-desktop,
  .worker-nav-desktop {
    display: none !important;
  }
}

/* Meter List for Field Workers */
.meter-card-worker {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}
.meter-card-worker:active {
  background: var(--bg-surface-elevated);
  transform: scale(0.99);
}
.meter-card-worker.recorded-today {
  border-left: 4px solid var(--accent-green);
}
.meter-serial {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.meter-location {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Rapid Reading Input View */
.reading-entry-header {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}

/* Dual Tariff Register Toggle Buttons */
.register-toggle-container {
  display: flex;
  gap: var(--space-sm, 0.75rem);
  margin-bottom: var(--space-sm, 0.75rem);
  width: 100%;
}
.register-toggle-btn {
  flex: 1 1 0% !important;
  width: 0 !important;
  min-width: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}

.reading-display-box {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  text-align: right;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reading-display-box.is-warning {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px #f59e0b, inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.reading-display-box.is-spike {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px #ef4444, inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.reading-display-unit {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dim);
}
.reading-display-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.04em;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

/* On-Screen Keypad - Tactile Daylight Buttons */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.numpad-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-size: 1.5rem;
  font-weight: 700;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.numpad-btn:active {
  background: #e2e8f0;
  transform: scale(0.97);
}
.numpad-btn.numpad-action {
  background: #f1f5f9;
  font-size: 1.15rem;
  color: #334155;
}

/* Camera Photo Shutter / Capture Area */
.photo-capture-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  text-align: center;
  margin-bottom: 1rem;
  cursor: pointer;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.photo-capture-box.has-photo {
  border-style: solid;
  border-color: var(--accent-green);
  padding: 0.35rem;
}
.photo-preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* QR Camera Viewfinder */
.scanner-container {
  width: 100%;
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}
.scanner-video {
  width: 100%;
  height: 280px;
  object-fit: cover;
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scanner-laser-target {
  width: 200px;
  height: 200px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  position: relative;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
}
.scanner-laser-target::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
  animation: scanLaser 2s infinite ease-in-out;
}
@keyframes scanLaser {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

/* Anomaly Warning Box - Helpful Guidance */
.anomaly-warning-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  color: #92400e;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ==========================================================================
   Standardized Mobile Worker Layout System
   ========================================================================== */
.worker-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.worker-toolbar {
  margin-bottom: var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.worker-progress-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-xs);
}

.worker-progress-bar-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.worker-progress-bar-fill {
  height: 100%;
  background: var(--accent-green);
  transition: width 0.3s ease;
}

.worker-net-status {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.worker-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-xs);
}

.worker-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.worker-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

