/* WWF driver mobile UI (loads after wwf-avenir + wwf-pod-ui) */

body.driver-ui {
  padding: 0.75rem;
  padding-top: 0.5rem;
}

/* —— PF1 PWA: connection status + install —— */
.wwf-conn-status {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: -0.5rem -0.75rem 0.65rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}
.wwf-conn-status.is-online {
  background: #e8f5e9;
  color: #1b5e20;
  border-bottom: 1px solid #c8e6c9;
}
.wwf-conn-status.is-offline {
  background: #ffebee;
  color: #b71c1c;
  border-bottom: 1px solid #ffcdd2;
}

.wwf-pwa-install,
.wwf-pwa-update {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--wwf-border, #dde1e6);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(26, 35, 126, 0.18);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
}
.wwf-pwa-install-msg {
  margin: 0.35rem 0 0.65rem;
  color: var(--wwf-muted, #5f6368);
  font-size: 0.85rem;
}
.wwf-pwa-install-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.wwf-pwa-btn {
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
}
.wwf-pwa-btn.primary {
  background: var(--wwf-navy-light, #3949ab);
  color: #fff;
}
.wwf-pwa-btn.sec {
  background: #f5f6f8;
  color: var(--wwf-navy, #1a237e);
  border: 1px solid var(--wwf-border, #dde1e6);
}
.wwf-pwa-update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  bottom: auto;
  top: 2.5rem;
}

.driver-install-guide {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--wwf-border, #dde1e6);
}
.driver-install-title {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}
.driver-install-steps {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--wwf-muted, #5f6368);
}
.driver-install-steps li {
  margin-bottom: 0.35rem;
}

.driver-offline-card h1 {
  font-size: 1.25rem;
}
.wwf-conn-inline {
  font-weight: 600;
  font-size: 0.9rem;
}
.wwf-conn-inline.ok { color: #1b5e20; }
.wwf-conn-inline.bad { color: #b71c1c; }

/* PF3 paper POD fallback */
.paper-fallback-card {
  border-left: 4px solid #e65100;
}
.paper-fallback-toggle {
  width: 100%;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.paper-fallback-toggle:hover {
  background: #ffe0b2;
}
.paper-fallback-panel {
  margin-top: 0.75rem;
}
.paper-fallback-panel select,
.paper-fallback-panel input[type="datetime-local"],
.paper-fallback-panel input[type="text"],
.paper-fallback-panel textarea {
  width: 100%;
  margin: 0.25rem 0 0.65rem;
  padding: 0.5rem;
  border: 1px solid var(--wwf-border, #dde1e6);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
.photo-chip {
  display: inline-block;
  background: #e8eaf6;
  color: var(--wwf-navy, #1a237e);
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.driver-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.driver-top h1 {
  font-size: 1.1rem;
  margin: 0;
}

.driver-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.driver-logout {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Manual route refresh (ops item #5) */
.btn-driver-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  color: #1565c0;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.btn-driver-refresh:hover:not(:disabled) {
  background: #bbdefb;
}
.btn-driver-refresh:disabled,
.btn-driver-refresh.is-loading {
  opacity: 0.75;
  cursor: wait;
}
.btn-driver-refresh.is-loading .driver-refresh-icon {
  display: inline-block;
  animation: driver-refresh-spin 0.8s linear infinite;
}
@keyframes driver-refresh-spin {
  to { transform: rotate(360deg); }
}
.driver-refresh-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.driver-stops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.btn-driver-refresh--inline {
  min-height: 32px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}
.driver-refresh-status {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}

.card.next-stop {
  border-left: 5px solid var(--wwf-navy-light);
}

.card.next-stop .label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--wwf-navy-light);
  text-transform: uppercase;
  font-weight: 700;
}

.note {
  color: #e65100;
  font-weight: 600;
  font-size: 0.85rem;
}

.driver-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.btn-driver {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-driver.primary {
  background: var(--wwf-navy-light);
  color: #fff;
}

.btn-driver.maps {
  background: #fff;
  color: var(--wwf-navy-light);
  border: 2px solid var(--wwf-navy-light);
}

.route-map-card {
  padding: 0.75rem 1rem;
}

.btn-route-map {
  display: block;
  text-align: center;
  background: #2e7d32;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.driver-stops {
  list-style: none;
  padding: 0;
  margin: 0;
}

.driver-stop {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
  align-items: flex-start;
}

.driver-stop.done {
  opacity: 0.55;
}

.stop-ord {
  background: #37474f;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.stop-info {
  flex: 1;
  font-size: 0.9rem;
}

.stop-act {
  font-size: 0.8rem;
  white-space: nowrap;
}

.stop-act a {
  font-weight: 600;
}

.tag-delivered {
  color: #2e7d32;
  font-weight: 600;
}

.driver-login-card {
  max-width: 420px;
  margin: 2rem auto;
}

.driver-login-card .driver-login-help {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.35rem 0;
}

.driver-login-card input {
  width: 100%;
  margin: 0.25rem 0 0.75rem;
  font-size: 1rem;
}

.driver-login-card button {
  width: 100%;
  padding: 0.7rem;
}

/* Complete blockers — why delivery/pickup cannot finish yet */
.complete-blockers {
  margin: 0.75rem 0 0.25rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fff3e0;
  border: 1px solid #ffb74d;
  font-size: 0.9rem;
  line-height: 1.4;
}
.complete-blockers.ready {
  background: #e8f5e9;
  border-color: #81c784;
}
.complete-blockers .blockers-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: #e65100;
}
.complete-blockers.ready .ok-line {
  margin: 0;
  font-weight: 700;
  color: #2e7d32;
}
.complete-blockers ul {
  margin: 0;
  padding-left: 1.15rem;
}
.complete-blockers li {
  margin: 0.2rem 0;
}
#btn-complete.not-ready {
  opacity: 0.92;
  background: #78909c;
}
#btn-complete.not-ready:active {
  opacity: 1;
}

/* Delivery / scan page */
.delivery-progress {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--wwf-navy-light);
}

.delivery-progress.done {
  color: #2e7d32;
}

#reader {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
}

.scan-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.scan-row input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 0.65rem;
  font-size: 1rem;
}

.scan-row button {
  padding: 0.65rem 1rem;
  font-size: 1rem;
}

button.sec {
  background: #546e7a;
}

#scan-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

#scan-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

#scan-list li.ok::before {
  content: "✓ ";
  color: #2e7d32;
  font-weight: bold;
}

#scan-list li.pending::before {
  content: "○ ";
  color: #999;
}

.alert {
  padding: 0.65rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  display: none;
}

.alert.err {
  display: block;
  background: #ffebee;
  color: #b71c1c;
  font-weight: 600;
}

.alert.ok {
  display: block;
  background: #e8f5e9;
  color: #1b5e20;
}

.gps-status {
  font-size: 0.8rem;
  color: var(--wwf-muted);
  margin-top: 0.35rem;
}

.hint {
  background: #fff8e1;
  border-left: 4px solid #ffa000;
  padding: 0.6rem;
  font-size: 0.85rem;
}

#wrong-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(183, 28, 28, 0.92);
  z-index: 9999;
  color: #fff;
  text-align: center;
  padding: 2rem 1rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#wrong-overlay.show {
  display: flex;
}

#wrong-overlay h2 {
  font-size: 1.8rem;
  margin: 0 0 1rem;
}

#wrong-overlay p {
  font-size: 1.1rem;
  max-width: 320px;
  line-height: 1.5;
}

#wrong-overlay button {
  margin-top: 1.5rem;
  background: #fff;
  color: #b71c1c;
  font-size: 1.1rem;
  padding: 0.8rem 2rem;
}

.check-banner {
  background: #e3f2fd;
  border-left: 4px solid var(--wwf-navy-light);
  padding: 0.6rem;
  font-size: 0.85rem;
}

.gps-banner {
  padding: 0.65rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.gps-banner.pass {
  background: #e8f5e9;
  color: #1b5e20;
  border-left: 4px solid #2e7d32;
}

.gps-banner.warn {
  background: #fff8e1;
  color: #e65100;
  border-left: 4px solid #ffa000;
}

.gps-banner.block {
  background: #ffebee;
  color: #b71c1c;
  border-left: 4px solid #c62828;
}

.gps-banner.neutral {
  background: #f5f5f5;
  color: #555;
  border-left: 4px solid #9e9e9e;
}

.driver-ui label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.driver-ui input[type="file"] {
  width: 100%;
  font-size: 0.9rem;
}

.driver-ui textarea {
  width: 100%;
  min-height: 3rem;
  resize: vertical;
}

.photo-previews {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.photo-previews img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--wwf-muted);
  margin-top: 0.2rem;
}

#override-box,
#confirm-box {
  display: none;
  margin-top: 0.5rem;
}

#success-card {
  display: none;
  text-align: center;
}

#success-card h2 {
  color: #2e7d32;
}

.leg-badge {
  display: inline-block;
  background: #e8eaf6;
  color: #1a237e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.35rem;
}

.pkg-total {
  font-size: 0.95rem;
  margin: 0.25rem 0;
}

.job-loc-title {
  font-size: 0.9rem;
  margin: 0.75rem 0 0.25rem;
  color: #1a237e;
}

.job-loc-block p {
  margin: 0.2rem 0;
}

.job-notes {
  margin-top: 0.65rem;
  padding: 0.5rem;
  background: #fff8e1;
  border-radius: 6px;
  font-size: 0.88rem;
}

.sig-canvas {
  width: 100%;
  max-width: 360px;
  border: 2px solid #c5cae9;
  border-radius: 6px;
  background: #fff;
  touch-action: none;
}

.accept-banner {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.driver-stop.pending-accept {
  border-left: 3px solid #ff9800;
}

.btn-accept,
.btn-driver.accept {
  background: #ff9800;
  color: #fff;
  border: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-weight: 600;
}

.inline-form {
  display: inline;
}

.btn-tiny {
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  margin: 0 0.1rem;
}

.reorder-btns {
  display: block;
  margin-bottom: 0.25rem;
}