/* ==========================================================================
   BARRIT - DESIGN SYSTEM & VISUAL STYLE
   Vanilla CSS Styling with Rich Aesthetics, Glassmorphism, and Animations
   ========================================================================== */

/* --- CSS VARIABLES & TOKENS --- */
:root {
  /* Harmonious Dark Palette */
  --bg-app: #070a13;
  --bg-surface: rgba(22, 30, 47, 0.7);
  --bg-surface-solid: #161e2f;
  --bg-surface-glow: rgba(99, 102, 241, 0.08);
  
  /* Vibrant Accents */
  --color-primary: #6366f1;       /* Indigo Neon */
  --color-primary-hover: #4f46e5;
  --color-primary-glow: rgba(99, 102, 241, 0.4);
  
  --color-success: #10b981;       /* Emerald Green */
  --color-success-hover: #059669;
  --color-success-glow: rgba(16, 185, 129, 0.3);
  
  --color-warning: #f59e0b;       /* Amber Orange */
  --color-warning-hover: #d97706;
  --color-warning-glow: rgba(245, 158, 11, 0.3);

  --color-danger: #ef4444;        /* Crimson Red */
  --color-danger-hover: #dc2626;
  --color-danger-glow: rgba(239, 68, 68, 0.3);

  /* Typography Colors */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Borders & Shadows */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.2);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-neon: 0 0 25px rgba(99, 102, 241, 0.25);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  
  /* Transitions */
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- RESET & FOUNDATION --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- DECORATIVE GLOW BACKGROUNDS --- */
.decor-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  transition: var(--transition-smooth);
}

.glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 80%);
  top: -150px;
  right: -100px;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 85%);
  bottom: -100px;
  left: -150px;
}

/* --- APP CONTAINER & STRUCTURE --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 600px; /* Centered mobile container style on desktop */
  margin: 0 auto;
  background-color: rgba(7, 10, 19, 0.8);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  position: relative;
}

/* --- HEADER --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: rgba(13, 18, 30, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  color: var(--color-primary);
  filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- STATUS BADGES --- */
.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
}

.status-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.online {
  color: var(--color-success);
}
.status-badge.online .badge-dot {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-badge.offline {
  color: var(--color-danger);
}
.status-badge.offline .badge-dot {
  background-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
}

.status-badge.api-native {
  color: var(--color-primary);
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
}
.status-badge.api-native span {
  font-size: 14px;
}

.status-badge.api-simulated {
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}
.status-badge.api-simulated span {
  font-size: 14px;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-bounce);
  text-decoration: none;
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-neon);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: white;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7477f8 0%, #5d55eb 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 15px var(--color-success-glow);
}
.btn-success:hover {
  background: linear-gradient(135deg, #1bd296 0%, #06a977 100%);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-text {
  font-family: inherit;
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  padding: 4px 8px;
}
.btn-text:hover {
  color: #f87171;
  text-decoration: underline;
}

.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
  border: none;
  padding: 5px 12px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3);
  transition: var(--transition-bounce);
}
.btn-install-pwa:hover {
  transform: scale(1.05);
}
.btn-install-pwa span {
  font-size: 13px;
}

.disabled, :disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

.hidden {
  display: none !important;
}

/* --- VIEWS --- */
.app-view {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 24px;
  animation: viewFadeIn 0.3s ease-out forwards;
}

.app-view.active {
  display: flex;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   VIEW: GALLERY & DASHBOARD
   ========================================================================== */
.dashboard-banner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  background: linear-gradient(135deg, rgba(22, 30, 47, 0.4) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid var(--border-glow);
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  box-shadow: var(--shadow-premium);
}

@media (min-width: 480px) {
  .dashboard-banner {
    grid-template-columns: 1.8fr 1fr;
    align-items: center;
  }
}

.banner-content h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.banner-content p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 18px;
}

.stats-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(13, 18, 30, 0.6);
  border: 1px solid var(--border-light);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stats-icon {
  font-size: 32px;
  color: var(--color-primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.stats-data {
  display: flex;
  flex-direction: column;
}

.stats-value {
  font-size: 28px;
  font-weight: 800;
  color: white;
  line-height: 1.1;
}

.stats-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- GALLERY GRID & SECTION --- */
.gallery-section {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 380px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* --- GALLERY ITEM CARD --- */
.gallery-card {
  position: relative;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-bounce);
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 25px -10px rgba(99, 102, 241, 0.2);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #000;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-card:hover .card-img-wrapper img {
  transform: scale(1.05);
}

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 5;
}

.btn-card-delete {
  background: rgba(239, 68, 68, 0.85);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.btn-card-delete span {
  font-size: 16px;
}
.btn-card-delete:hover {
  background: var(--color-danger);
  transform: scale(1.1);
}

.card-info {
  padding: 12px;
}

.card-barcode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--color-success);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  max-width: 100%;
}

.card-barcode-badge span.material-symbols-rounded {
  font-size: 13px;
}

.card-barcode-badge span.barcode-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-barcode-val {
  font-size: 13px;
  font-weight: 800;
  color: white;
  word-break: break-all;
  line-height: 1.2;
}

.card-date {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 4px;
}

/* --- EMPTY GALLERY STATE --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  flex: 1;
}

.empty-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 40px;
}

.empty-state h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
}

/* ==========================================================================
   VIEW: CAMERA SCREEN
   ========================================================================== */
#view-camera {
  padding: 0; /* Full Bleed */
  background: black;
  position: relative;
  display: none;
}

#view-camera.active {
  display: flex;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: black;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* --- SHUTTER FLASH EFFECT --- */
.camera-flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  z-index: 80;
  pointer-events: none;
  transition: opacity 0.05s ease-out;
}

.camera-flash-overlay.flash {
  opacity: 1;
  transition: none; /* Instant white out */
}

/* --- CAMERA HUD OVERLAY --- */
.camera-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 10;
  pointer-events: none;
}

.btn-hud-close {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
}

.btn-hud-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
}

/* --- SCANNING TARGET BOX --- */
.scanner-aiming-box {
  width: 260px;
  height: 260px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); /* Dimming background outer regions */
}

.scanner-aiming-box .corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--color-primary);
  border-style: solid;
  pointer-events: none;
}

.scanner-aiming-box .top-left {
  top: -2px;
  left: -2px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 8px;
}
.scanner-aiming-box .top-right {
  top: -2px;
  right: -2px;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 8px;
}
.scanner-aiming-box .bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 8px;
}
.scanner-aiming-box .bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 8px;
}

/* Moving scanning light bar */
.scanner-line {
  position: absolute;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  left: 0;
  top: 10%;
  box-shadow: 0 0 10px var(--color-primary);
  animation: scannerLineMove 3.5s infinite ease-in-out;
}

@keyframes scannerLineMove {
  0%, 100% {
    top: 5%;
  }
  50% {
    top: 95%;
  }
}

.hud-instructions {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 12px;
  border-radius: 50px;
  letter-spacing: 0.2px;
}

/* --- CAMERA FOOTER CONTROLS --- */
.camera-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 85%, transparent 100%);
  padding: 20px 24px 34px 24px; /* extra bottom padding for mobile safe-areas */
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 15;
}

/* --- THUMBNAIL STRIP --- */
.thumbnail-strip-container {
  position: relative;
  width: 100%;
  height: 60px;
}

.badge-count {
  position: absolute;
  top: -8px;
  left: -2px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: white;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.thumbnail-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  padding: 2px;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.thumbnail-strip::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.thumbnail-item {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  animation: thumbPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes thumbPopIn {
  from {
    transform: scale(0.6) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-shutter-row {
  display: none !important;
}

.btn-done {
  min-width: 90px;
  padding: 10px 16px;
  font-size: 13px;
}

/* ==========================================================================
   ========================================================================== */
#view-processing {
  background-color: var(--bg-app);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.loader-container {
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader-spinner {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 28px;
}

.spinner-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.03);
  border-top-color: var(--color-primary);
  border-bottom-color: #3b82f6;
  animation: spinSlow 1.2s linear infinite;
}

.spinner-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-core span {
  font-size: 44px;
  color: var(--color-primary);
  filter: drop-shadow(0 0 10px var(--color-primary-glow));
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#view-processing h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.processing-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  height: 20px; /* Fix heights to prevent layout jumping */
}

/* --- LOADING PROGRESS BAR --- */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #3b82f6);
  box-shadow: 0 0 8px var(--color-primary-glow);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   VIEW: REVIEW & RESHOOT FOR FAILED SCANS
   ========================================================================== */
#view-review {
  background-color: var(--bg-app);
}

.review-header {
  text-align: center;
  margin-bottom: 24px;
}

.warning-header-icon {
  font-size: 48px;
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.12);
  padding: 12px;
  border-radius: 50%;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px var(--color-warning-glow));
}

#view-review h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

#view-review p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* --- REVIEW IMAGES LIST --- */
.review-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  margin-bottom: 28px;
}

.review-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface-solid);
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-premium);
  position: relative;
}

.review-card.resolved {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(22, 30, 47, 0.4);
}

.review-card-img {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  overflow: hidden;
  background: black;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.review-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-card-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.review-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.review-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.review-card-badge.fail {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

.review-card-badge.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.btn-card-reshoot {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--color-warning);
  color: var(--bg-app);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
  transition: var(--transition-smooth);
}

.btn-card-reshoot:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

.btn-card-reshoot.resolved-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

.btn-card-reshoot.resolved-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.review-footer {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 18px;
}

.review-footer button {
  flex: 1;
}

/* ==========================================================================
   VIEW: SUCCESS REWARD SCREEN
   ========================================================================== */
#view-success {
  background-color: var(--bg-app);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.success-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
}

.success-icon-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  filter: drop-shadow(0 0 15px var(--color-success-glow));
}

.success-check {
  font-size: 64px;
  color: var(--color-success);
}

@keyframes successPop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#view-success h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

#view-success p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   MODAL: MANUAL HELPER & SIMULATOR
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  animation: modalFadeIn 0.25s ease-out forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(20px);
  animation: cardSlideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes cardSlideUp {
  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.text-warning {
  color: var(--color-warning);
  font-size: 26px;
  filter: drop-shadow(0 0 6px var(--color-warning-glow));
}

.text-neon {
  color: var(--color-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-info {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-preview-wrapper {
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: black;
  border: 1px solid var(--border-light);
  position: relative;
}

.modal-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-index-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* --- FORMS --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.form-group input {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-light);
  color: white;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.modal-instruction {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
}

.modal-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-footer button {
  flex: 1;
  font-size: 12px;
  padding: 10px 14px;
}

.btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--color-danger);
}

/* --- PULSE & ROTATE ANIMATIONS --- */
.animate-pulse {
  animation: pulsePulse 1.8s infinite ease-in-out;
}

@keyframes pulsePulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* --- DUAL-MODE SCAN & LOOKUP FOOTER STYLES --- */
.lookup-footer-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  animation: viewFadeIn 0.3s ease-out;
}

.lookup-help-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
  text-shadow: 0 0 8px var(--color-success-glow);
  text-align: center;
  animation: pulsePulse 1.5s infinite ease-in-out;
}

/* --- MATCH MODAL CUSTOM STYLING --- */
.match-card {
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.15), var(--shadow-premium) !important;
}

.match-header {
  border-bottom: 1px solid rgba(16, 185, 129, 0.15) !important;
}

.match-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.match-barcode-format {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.match-barcode-value {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-success);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.match-preview-wrapper {
  border: 2px solid rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.match-date-row {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
  font-weight: 500;
}

/* --- PREMIUM TOAST OVERLAY --- */
.toast-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translate(-50%, 50px);
  background: rgba(16, 185, 129, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(16, 185, 129, 0.25);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-container.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-icon {
  font-size: 20px;
  color: white;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.toast-text {
  letter-spacing: -0.1px;
}

/* --- FULLSCREEN IMERSIVE THEATER MATCH VIEWER --- */
.fullscreen-viewer {
  background: rgba(0, 0, 0, 0.96) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  padding: 0 !important;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  overflow: hidden;
  display: none;
  align-items: center;
  justify-content: center;
}

.fullscreen-viewer:not(.hidden) {
  display: flex;
}

.fullscreen-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
}

.fullscreen-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* displays whole picture with black gutters, preserving aspect ratio */
  max-width: 100vw;
  max-height: 100vh;
  transition: transform 0.4s ease;
}

.fullscreen-hud-top {
  position: absolute;
  top: 24px;
  left: 0;
  width: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  z-index: 10000;
}

.fullscreen-hud-top button {
  pointer-events: auto;
}

.fullscreen-hud-title {
  font-size: 14px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 6px 16px;
  border-radius: 50px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fullscreen-hud-bottom {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 420px;
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10000;
}

@media (max-height: 550px) {
  .fullscreen-hud-bottom {
    bottom: 16px;
    padding: 12px;
  }
}

/* --- CAMERA STATE HUD OVERRIDES --- */
.camera-wrapper.mode-scan .scanner-aiming-box {
  display: block;
}

.camera-wrapper.mode-capture .scanner-aiming-box {
  display: none !important;
}

.camera-wrapper.mode-scan .scan-instruction {
  display: block;
}

.camera-wrapper.mode-scan .capture-instruction {
  display: none !important;
}

.camera-wrapper.mode-capture .scan-instruction {
  display: none !important;
}

.camera-wrapper.mode-capture .capture-instruction {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.camera-wrapper.mode-capture #camera-capture-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(16, 185, 129, 0.4);
}

.camera-wrapper.mode-capture #camera-capture-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.camera-wrapper.mode-scan #camera-lookup-row {
  display: flex !important;
}

.camera-wrapper.mode-scan #camera-capture-row {
  display: none !important;
}

.camera-wrapper.mode-capture #camera-lookup-row {
  display: none !important;
}

.camera-wrapper.mode-capture #camera-capture-row {
  display: flex !important;
}

/* --- VERIFY MATCH / "IS THIS IT?" VIEW --- */
#view-verify-match {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#view-verify-match.active {
  display: flex;
}

.verify-match-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface-solid);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.25), var(--shadow-premium);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.verify-match-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.verify-match-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: white;
}

.verify-match-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.verify-badge-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.verify-preview-wrapper {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid rgba(16, 185, 129, 0.4);
  background: #000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(0,0,0,0.8);
  margin: 12px 0;
}

.verify-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.verify-date-row {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.verify-match-footer {
  display: flex;
  gap: 12px;
  width: 100%;
}

.verify-match-footer button {
  flex: 1;
}

/* --- SCAN SUCCESS ALERT OVERLAY --- */
.scan-success-alert {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  backdrop-filter: blur(12px);
  padding: 1.5rem 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.scan-success-alert.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.scan-success-alert.hidden {
  display: none !important;
}

.alert-icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #10b981;
}

.alert-icon-wrapper .material-symbols-rounded {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.6));
  animation: success-bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.alert-icon-wrapper .alert-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

@keyframes success-bounce {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- SAVE SUCCESS ALERT OVERLAY --- */
.save-success-alert {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  backdrop-filter: blur(12px);
  padding: 1.5rem 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.save-success-alert.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.save-success-alert.hidden {
  display: none !important;
}

.save-success-alert .alert-icon-wrapper {
  color: #818cf8; /* Light Indigo */
}

.save-success-alert .alert-icon-wrapper .material-symbols-rounded {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.6));
  animation: success-bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
