/* Flipkart Package Pickup Verification System - Ultra-Modern Mobile-First UI/UX */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  /* Theme Colors */
  --bg-app: #090d16;
  --bg-card: #131b2e;
  --bg-card-elevated: #1e293b;
  --bg-glass: rgba(19, 27, 46, 0.85);
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --fk-blue: #2874f0;
  --fk-blue-glow: rgba(40, 116, 240, 0.4);
  --fk-yellow: #ffc200;
  --fk-orange: #fb641b;

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-border: rgba(16, 185, 129, 0.35);

  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-danger-border: rgba(239, 68, 68, 0.35);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: rgba(245, 158, 11, 0.35);

  --color-purple: #8b5cf6;
  --color-purple-bg: rgba(139, 92, 246, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px var(--fk-blue-glow);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-elevated: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.9);
  
  --border-glass: #e2e8f0;
  --border-focus: #2874f0;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(40, 116, 240, 0.2);
}

/* Reset & Mobile Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding-bottom: 84px; /* clearance for mobile dock */
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: var(--fk-blue);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  text-decoration: underline;
}

/* Mobile App Layout Container */
.app-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.app-navbar {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 80;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--fk-blue), #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: var(--shadow-glow);
}

.brand-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-pill {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--fk-orange);
  color: #fff;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}
.icon-btn:hover, .icon-btn:active {
  background: var(--fk-blue);
  color: #fff;
  transform: scale(0.95);
}

/* Glass Card Component */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

/* Stat HUD - Mobile Optimized Segmented Pill Counters */
.hud-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .hud-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

.hud-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.hud-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.hud-pill.hud-total::before { background: var(--fk-blue); }
.hud-pill.hud-verified::before { background: var(--color-success); }
.hud-pill.hud-remaining::before { background: var(--color-warning); }
.hud-pill.hud-canceled::before { background: var(--color-danger); }

.hud-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.hud-total .hud-icon { background: rgba(40, 116, 240, 0.15); color: var(--fk-blue); }
.hud-verified .hud-icon { background: var(--color-success-bg); color: var(--color-success); }
.hud-remaining .hud-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.hud-canceled .hud-icon { background: var(--color-danger-bg); color: var(--color-danger); }

.hud-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.hud-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Progress Tracker */
.progress-bar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 1.25rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background: var(--bg-card-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-active {
  height: 100%;
  background: linear-gradient(90deg, var(--fk-blue), var(--color-success));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Mobile-First Camera Viewfinder */
.scanner-viewport-card {
  background: #000;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(40, 116, 240, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
  margin-bottom: 1.25rem;
}

.scanner-video-container {
  width: 100%;
  min-height: 240px;
  max-height: 50vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#reader {
  width: 100% !important;
  border: none !important;
}

#reader video {
  width: 100% !important;
  object-fit: cover;
}

/* Viewfinder Laser & Reticles */
.viewfinder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.viewfinder-box {
  width: 88%;
  max-width: 440px;
  height: 150px;
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  transition: all 0.25s ease;
}

.viewfinder-flash {
  animation: flashGreen 0.35s ease-out;
}

@keyframes flashGreen {
  0% { box-shadow: 0 0 0 9999px rgba(16, 185, 129, 0.7), 0 0 35px #10b981; }
  100% { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); }
}

.reticle-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #38bdf8;
  border-style: solid;
}
.reticle-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-top-left-radius: 6px; }
.reticle-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-top-right-radius: 6px; }
.reticle-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-bottom-left-radius: 6px; }
.reticle-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-bottom-right-radius: 6px; }

.laser-beam {
  position: absolute;
  top: 10%;
  left: 4%;
  width: 92%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #2874f0, #38bdf8, transparent);
  box-shadow: 0 0 14px #38bdf8, 0 0 28px #2874f0;
  animation: scanLaser 2s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 12;
}

@keyframes scanLaser {
  0% { top: 12%; }
  100% { top: 88%; }
}

.laser-pulse {
  animation: laserPulseEffect 0.35s ease-out;
}

@keyframes laserPulseEffect {
  0% { background: #10b981; box-shadow: 0 0 30px #10b981; height: 5px; }
  100% { height: 2px; }
}

/* Floating Camera Toolbar */
.camera-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(10px);
}

/* Barcode Quick Input Field */
.input-tray {
  position: relative;
  margin-bottom: 1.25rem;
}

.barcode-hero-input {
  width: 100%;
  height: 56px;
  background: var(--bg-card);
  border: 2px solid var(--fk-blue);
  border-radius: var(--radius-md);
  padding: 0 54px 0 50px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  box-shadow: 0 0 20px rgba(40, 116, 240, 0.25);
  outline: none;
  transition: var(--transition);
}

.barcode-hero-input:focus {
  box-shadow: 0 0 25px rgba(40, 116, 240, 0.5);
  border-color: #60a5fa;
}

.input-icon-lead {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fk-blue);
  font-size: 1.25rem;
  pointer-events: none;
}

.input-btn-trail {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--fk-blue);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dynamic Live Alert Banner */
.scan-alert-popup {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInDown 0.2s ease-out;
  border: 1px solid transparent;
}

.scan-alert-verified {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: #34d399;
}

.scan-alert-canceled {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: #f87171;
}

.scan-alert-duplicate {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: #fbbf24;
}

/* Last Scanned Card */
.last-scanned-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-left: 5px solid var(--color-success);
}

.last-scanned-card.card-canceled {
  border-left-color: var(--color-danger);
}

.last-scanned-card.card-duplicate {
  border-left-color: var(--color-warning);
}

/* Mobile Card List Items */
.order-card-row {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}

.order-card-row:active {
  transform: scale(0.98);
}

.order-primary-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.order-code-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs */
.segmented-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-card-elevated);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.seg-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.seg-tab-btn.active {
  background: var(--fk-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(40, 116, 240, 0.4);
}

.seg-count-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.96);
}

.btn-primary { background: var(--fk-blue); color: #fff; box-shadow: 0 4px 14px rgba(40, 116, 240, 0.4); }
.btn-success { background: var(--color-success); color: #fff; box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-secondary { background: var(--bg-card-elevated); color: var(--text-main); border: 1px solid var(--border-glass); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-verified { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-missing { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.badge-canceled { background: var(--color-danger-bg); color: #f87171; border: 1px solid var(--color-danger-border); }
.badge-cod { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-prepaid { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }

/* Mobile Floating Bottom Dock */
.mobile-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: 8px 12px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
}

.dock-item-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  text-decoration: none;
}

.dock-item-btn i {
  font-size: 1.25rem;
}

.dock-item-btn.active, .dock-item-btn:hover {
  color: var(--fk-blue);
}

.dock-hero-btn {
  background: linear-gradient(135deg, var(--fk-blue), #1d4ed8);
  color: #fff !important;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 4px 16px var(--fk-blue-glow);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

/* Print Manifest Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    padding-bottom: 0 !important;
  }
  .app-navbar, .mobile-dock, .no-print, .btn {
    display: none !important;
  }
  .glass-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .data-table th, .data-table td {
    color: #000 !important;
    border: 1px solid #ccc !important;
    padding: 6px 8px !important;
  }
}
