/**
 * dev-handheld-scanner.css — Handheld Scanner Device Widget Stylesheet (Stage 4b)
 * 
 * Styled as a sleek, modern, Flutter-inspired handheld scanning device prop.
 * Uses strictly locked tokens from dev-styles.css.
 * WCAG 2.1 AA Contrast compliant (>= 4.5:1).
 */

/* Device Container & Wrapper */
.handheld-device-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.handheld-device-chassis {
  width: 360px;
  max-width: 100%;
  background: linear-gradient(180deg, var(--navy-3) 0%, var(--navy-2) 100%);
  border: 4px solid var(--navy);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.1);
  border-radius: 36px;
  padding: 16px 14px 20px 14px;
  position: relative;
  box-sizing: border-box;
  font-family: var(--sans);
  color: var(--paper);
}

/* Hardware Details on Chassis */
.handheld-top-sensor-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.handheld-camera-lens {
  width: 8px;
  height: 8px;
  background-color: var(--navy);
  border-radius: 50%;
  border: 1px solid var(--line-dk-strong);
}

.handheld-speaker-slit {
  width: 44px;
  height: 4px;
  background-color: var(--navy);
  border-radius: 2px;
  border: 1px solid var(--line-dk);
}

/* Physical Hardware Side Scan Button */
.scanner-hardware-trigger {
  position: absolute;
  right: -20px;
  top: 140px;
  width: 18px;
  height: 80px;
  background: linear-gradient(90deg, var(--teal-bright) 0%, var(--teal) 100%);
  border: 2px solid var(--navy);
  border-left: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, filter 0.15s ease;
  z-index: 10;
}

.scanner-hardware-trigger:hover {
  filter: brightness(1.15);
}

.scanner-hardware-trigger:active, .scanner-hardware-trigger.pressed {
  transform: translateX(-4px);
  filter: brightness(0.9);
}

.scanner-trigger-label-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.1em;
  user-select: none;
}

/* Screen Bezel & Display Area */
.handheld-screen-bezel {
  background-color: var(--navy);
  border: 2px solid var(--line-dk-strong);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  height: 520px;
  max-height: 520px;
}

/* Status Bar */
.handheld-status-bar {
  background-color: var(--navy-3);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-lt-dim);
  border-bottom: 1px solid var(--line-dk);
}

.status-bar-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--teal-bright);
}

/* App Header */
.handheld-app-bar {
  background: var(--navy-2);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dk);
}

.app-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-handheld-back {
  background: transparent;
  border: none;
  color: var(--teal-bright);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.btn-handheld-back:hover {
  background-color: var(--navy-3);
}

.app-bar-title {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--paper);
  margin: 0;
}

.app-bar-depot-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--navy-3);
  color: var(--teal-bright);
  border: 1px solid var(--teal);
}

/* Screen Main Content Area */
.handheld-content-viewport {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  background-color: var(--navy);
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) var(--navy-3);
}

.handheld-content-viewport::-webkit-scrollbar {
  width: 5px;
}

.handheld-content-viewport::-webkit-scrollbar-track {
  background: var(--navy-3);
  border-radius: 3px;
}

.handheld-content-viewport::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 3px;
}

.handheld-content-viewport::-webkit-scrollbar-thumb:hover {
  background: var(--teal-bright);
}

/* Home Menu Tiles */
.handheld-home-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.handheld-menu-tile {
  background: linear-gradient(135deg, var(--navy-2) 0%, var(--navy-3) 100%);
  border: 1px solid var(--line-dk);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
  color: var(--paper);
}

.handheld-menu-tile:hover {
  border-color: var(--teal-bright);
  transform: translateY(-1px);
}

.handheld-menu-tile:active {
  transform: scale(0.98);
}

.tile-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--navy);
  border: 1px solid var(--line-dk-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.tile-info {
  flex: 1;
  margin-left: 10px;
}

.tile-title {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
}

.tile-sub {
  font-size: 0.7rem;
  color: var(--ink-lt-dim);
}

.tile-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background-color: var(--navy);
  color: var(--teal-bright);
  border: 1px solid var(--teal);
}

/* Active Mode View Cards */
.handheld-task-card {
  background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy-3) 100%);
  border: 1px solid var(--line-dk-strong);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.task-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-progress-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--teal-bright);
}

.task-uin-hero {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--paper);
  background-color: var(--navy);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-dk-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-item-name {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
  margin: 0;
}

.task-location-box {
  background-color: var(--navy);
  border: 1px solid var(--line-dk);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-location-val {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--neon);
}

.task-destination-box {
  font-size: 0.72rem;
  color: var(--ink-lt-dim);
  background-color: var(--navy-2);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-dk);
}

/* Big Interactive Scanner Action Button */
.btn-handheld-scan-action {
  width: 100%;
  background: linear-gradient(135deg, var(--teal-bright) 0%, var(--teal) 100%);
  color: var(--navy);
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, filter 0.15s ease;
  margin-top: 6px;
}

.btn-handheld-scan-action:hover {
  filter: brightness(1.1);
}

.btn-handheld-scan-action:active {
  transform: scale(0.97);
}

.btn-handheld-flag-issue {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  transition: all 0.15s ease;
}

.btn-handheld-flag-issue:hover {
  background-color: var(--accent);
  color: var(--paper);
}

/* Laser Scan Animation Pulse */
.laser-scan-beam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--teal-bright) 50%, transparent 100%);
  box-shadow: 0 0 10px var(--teal-bright);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}

.laser-scan-beam.animating {
  animation: scanSweep 0.5s ease-in-out forwards;
}

@keyframes scanSweep {
  0% { top: 10%; opacity: 1; }
  50% { top: 90%; opacity: 1; }
  100% { top: 10%; opacity: 0; }
}

/* Success Pulse Feedback */
.scan-success-pill {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--teal);
  color: var(--navy);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 25;
}

.scan-success-pill.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

/* Complete / Empty State */
.handheld-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-lt-dim);
  height: 100%;
  gap: 8px;
}

.empty-icon-lg {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

/* Return & Damage Check Workflow */
.damage-check-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.btn-damage-pass {
  background: linear-gradient(135deg, var(--teal-bright) 0%, var(--teal) 100%);
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-damage-flag {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-damage-flag:hover {
  background-color: var(--accent);
  color: var(--paper);
}

/* Pick Exception: Missing / Damaged / Other Issue Screen */
.issue-type-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.btn-issue-type {
  background: var(--navy-2);
  color: var(--paper-2);
  border: 1px solid var(--line-dk);
  border-radius: 8px;
  padding: 10px 6px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-issue-type .issue-type-icon {
  font-size: 1.1rem;
}

.btn-issue-type:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.issue-substitute-found {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 210, 255, 0.12);
  border: 1px solid var(--teal-bright);
  color: var(--paper);
  font-size: 0.75rem;
  line-height: 1.4;
}

.issue-no-substitute {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(210, 96, 28, 0.15);
  border: 1px solid var(--accent);
  color: var(--paper);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ==========================================================================
   MOBILE (<768px)
   ========================================================================== */
@media (max-width: 767.98px) {
  .handheld-device-wrapper {
    padding: 0;
    width: 100%;
    margin: 0;
    align-items: stretch;
  }

  .handheld-device-chassis {
    width: 100%;
    max-width: 100%;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .handheld-top-sensor-bar,
  .handheld-camera-lens,
  .handheld-speaker-slit,
  .scanner-hardware-trigger {
    display: none !important;
  }

  .handheld-screen-bezel {
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    max-height: 100dvh;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .handheld-content-viewport {
    flex: 1;
    min-height: 0;
    padding: 12px;
  }

  .btn-handheld-back {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 12px;
  }

  .btn-handheld-scan-action {
    min-height: 48px;
    box-sizing: border-box;
  }

  .btn-handheld-flag-issue,
  .btn-damage-pass,
  .btn-damage-flag,
  .btn-issue-type {
    min-height: 44px;
    box-sizing: border-box;
  }

  .hh-menu-tile {
    min-height: 48px;
  }
}

