/* ═══════════════════════════════════════════════════════════
   PrelevementChecker — Premium Mobile-First Design System
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties (Design Tokens) ─── */
:root {
  /* Colors — Dark Theme (Default) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(30, 41, 59, 0.6);
  --bg-input: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --accent-light: rgba(59, 130, 246, 0.15);

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --success-border: rgba(34, 197, 94, 0.3);

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

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

  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.12);

  --border: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(148, 163, 184, 0.25);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

  /* Typography */
  --font-ar: 'Cairo', 'Segoe UI', sans-serif;
  --font-en: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Layout */
  --header-height: 60px;
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  overflow: hidden;
  height: 100%;
}

body {
  font-family: var(--font-ar);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  direction: rtl;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(30, 41, 59, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-md);
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
  animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    filter: drop-shadow(0 0 8px var(--accent-glow));
  }

  50% {
    filter: drop-shadow(0 0 16px var(--accent-glow));
  }
}

.header-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.icon-btn:hover,
.icon-btn:active {
  background: var(--accent);
  color: white;
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD STATS
   ═══════════════════════════════════════════════════════════ */
.dashboard {
  padding: var(--space-md) var(--space-md) var(--space-sm);
  flex-shrink: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  max-width: 600px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-xs);
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-fast);
}

.stat-card:active {
  transform: scale(0.96);
}

.stat-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-en);
  line-height: 1.1;
}

.stat-total .stat-value {
  color: var(--accent);
}

.stat-match .stat-value {
  color: var(--success);
}

.stat-mismatch .stat-value {
  color: var(--danger);
}

.stat-pending .stat-value {
  color: var(--warning);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   PAGE CONTAINER
   ═══════════════════════════════════════════════════════════ */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--space-md) var(--space-md);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.page-container>.page {
  max-width: 600px;
  margin: 0 auto;
  animation: page-in 0.3s ease;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════════ */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(to top, var(--bg-secondary) 0%, rgba(30, 41, 59, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-ar);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav-item svg {
  transition: var(--transition-fast);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active svg {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-en);
  color: white;
  background: var(--danger);
  border-radius: var(--radius-full);
  padding: 0 4px;
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

/* ═══════════════════════════════════════════════════════════
   CARDS & SECTIONS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-fast);
}

.card+.card {
  margin-top: var(--space-md);
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title .emoji {
  font-size: 20px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ar);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: white;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-ghost {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--border-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* Capture button — big circular */
.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 6px 30px var(--accent-glow), inset 0 0 0 4px rgba(255, 255, 255, 0.2);
  font-size: 28px;
  padding: 0;
  border: none;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
}

.btn-capture::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.btn-capture:active {
  transform: scale(0.9);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-capture.pulsing {
  animation: capture-pulse 1.5s infinite;
}

@keyframes capture-pulse {

  0%,
  100% {
    box-shadow: 0 6px 30px var(--accent-glow), inset 0 0 0 4px rgba(255, 255, 255, 0.2);
  }

  50% {
    box-shadow: 0 6px 50px var(--accent-glow), 0 0 0 8px rgba(59, 130, 246, 0.2), inset 0 0 0 4px rgba(255, 255, 255, 0.3);
  }
}

/* ═══════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════ */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 14px;
  transition: var(--transition-fast);
  direction: rtl;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder {
  color: var(--text-muted);
}

textarea.input {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
}

/* ═══════════════════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════════════════ */
.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--space-lg));
  padding: 0 var(--space-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  z-index: 1;
}

.data-table td {
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
}

.data-table tr {
  transition: var(--transition-fast);
}

.data-table tr:active {
  background: var(--accent-light);
}

.data-table tr.row-match {
  border-right: 3px solid var(--success);
}

.data-table tr.row-mismatch {
  border-right: 3px solid var(--danger);
}

.data-table tr.row-warning {
  border-right: 3px solid var(--warning);
}

.data-table tr.row-checking {
  background: var(--accent-light);
  animation: row-pulse 1s infinite;
}

@keyframes row-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Mobile-friendly record cards (alternative to table) */
.record-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.record-card::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.record-card.status-pending::before {
  background: var(--text-muted);
}

.record-card.status-match::before {
  background: var(--success);
}

.record-card.status-mismatch::before {
  background: var(--danger);
}

.record-card.status-warning::before {
  background: var(--warning);
}

.record-card.status-checking::before {
  background: var(--accent);
  animation: row-pulse 1s infinite;
}

.record-card:active {
  transform: scale(0.98);
  background: var(--bg-glass);
}

.record-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.record-details {
  display: flex;
  gap: var(--space-md);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.record-status-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
}

/* ═══════════════════════════════════════════════════════════
   VERIFICATION RESULTS
   ═══════════════════════════════════════════════════════════ */
.result-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  transition: var(--transition-fast);
}

.result-item.result-match {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.result-item.result-mismatch {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}

.result-item.result-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
}

.result-item.result-missing {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
}

.result-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.result-values {
  font-size: 12px;
  font-family: var(--font-mono);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.result-expected {
  color: var(--text-muted);
}

.result-found {
  color: var(--text-primary);
  font-weight: 600;
}

.result-note {
  font-size: 10px;
  color: var(--warning);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   CAMERA / CAPTURE PAGE (FULLSCREEN)
   ═══════════════════════════════════════════════════════════ */
.fullscreen-camera {
  position: fixed;
  top: var(--header-height);
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  background: #000;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.fullscreen-camera video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
}

.camera-guide {
  width: 95%;
  height: 90%;
  border: 3px dashed rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
  /* Dim the rest of the screen */
  position: relative;
}

.camera-guide::before {
  content: 'ضع الورقة داخل الإطار كاملاً';
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.camera-floating-controls {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-xl);
  padding: 10px;
}

.float-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.floating-results-layer {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 120px);
  left: 12px;
  right: 12px;
  z-index: 40;
  pointer-events: none;
  /* Let clicks pass to the camera controls normally */
}

.floating-results-layer>* {
  pointer-events: auto;
}

.results-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  pointer-events: auto;
}

.camera-preview-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
}

/* File input styled */
.file-input-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.file-input-label:hover,
.file-input-label:active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.file-input-label svg {
  opacity: 0.6;
}

.file-input-label input[type="file"] {
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   ARCHIVE
   ═══════════════════════════════════════════════════════════ */
.search-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.search-bar .input {
  flex: 1;
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
  -webkit-overflow-scrolling: touch;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.chip:active {
  transform: scale(0.95);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.archive-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.archive-card:active {
  transform: scale(0.97);
}

.archive-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.archive-info {
  padding: var(--space-sm);
}

.archive-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-date {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-en);
}

.archive-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}

.archive-status.s-match {
  background: var(--success-bg);
  color: var(--success);
}

.archive-status.s-mismatch {
  background: var(--danger-bg);
  color: var(--danger);
}

.archive-status.s-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ═══════════════════════════════════════════════════════════
   QUEUE STATUS
   ═══════════════════════════════════════════════════════════ */
.queue-status {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.queue-progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.queue-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  position: relative;
}

.queue-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

.queue-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.queue-text strong {
  color: var(--text-primary);
  font-family: var(--font-en);
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-sm));
  left: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: 600px;
  margin: 0 auto;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
  font-size: 13px;
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

.toast-success {
  border-color: var(--success-border);
}

.toast-error {
  border-color: var(--danger-border);
}

.toast-warning {
  border-color: var(--warning-border);
}

.toast-info {
  border-color: rgba(59, 130, 246, 0.3);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  animation: fade-in 0.2s ease;
}

.modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  overflow-y: auto;
  animation: modal-up 0.3s ease;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  text-align: center;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-up {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes modal-down {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(100%);
  }
}

/* ═══════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════ */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.action-card:active {
  transform: scale(0.96);
  background: var(--accent-light);
  border-color: var(--accent);
}

.action-icon {
  font-size: 32px;
  line-height: 1;
}

.action-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.action-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Activity Feed */
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  font-size: 16px;
}

.activity-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-en);
}

/* ═══════════════════════════════════════════════════════════
   PROCESSING OVERLAY
   ═══════════════════════════════════════════════════════════ */
.processing-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.processing-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  margin-bottom: var(--space-lg);
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-mono {
  font-family: var(--font-mono);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.gap-sm {
  gap: var(--space-sm);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.hidden {
  display: none !important;
}

.ltr {
  direction: ltr;
  text-align: left;
}

/* Image zoom */
.zoomable-img {
  width: 100%;
  border-radius: var(--radius-md);
  cursor: zoom-in;
  transition: var(--transition-fast);
}

.img-zoomed {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fade-in 0.2s ease;
}

.img-zoomed img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.badge-match {
  background: var(--success-bg);
  color: var(--success);
}

.badge-mismatch {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}