/* ============================================
   BARCODE MANAGER — Design System & Styles
   ============================================ */

/* ---------- CSS Variables / Tokens ---------- */
:root {
  /* Colors — Dark Theme */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: rgba(22, 22, 35, 0.85);
  --bg-card-hover: rgba(30, 30, 50, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(99, 102, 241, 0.3);

  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-tertiary: #606078;
  --text-accent: #a5b4fc;

  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --accent-sky: #38bdf8;

  --gradient-primary: linear-gradient(135deg, #6366f1, #a855f7);
  --gradient-active: linear-gradient(135deg, #34d399, #38bdf8);
  --gradient-danger: linear-gradient(135deg, #fb7185, #f472b6);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Screens ---------- */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ---------- LOGIN ---------- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.login-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse-glow 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  animation: card-enter 0.6s var(--transition-slow) both;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.input-date {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  color-scheme: dark;
}

.input-date:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.error-message {
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.2);
  color: var(--accent-rose);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.hidden {
  display: none !important;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.05);
}

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

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

.btn-accent {
  background: var(--gradient-active);
  color: #0a0a0f;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(52, 211, 153, 0.2);
}

.btn-accent:hover {
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.3);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--gradient-danger);
  color: #fff;
  box-shadow: 0 2px 12px rgba(251, 113, 133, 0.2);
}

.btn-danger:hover {
  box-shadow: 0 4px 20px rgba(251, 113, 133, 0.3);
}

.btn-ghost {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 1rem;
}

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

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

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

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

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- Stats ---------- */
.stats-section {
  padding: 24px 28px 0;
  position: relative;
  z-index: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-highlight {
  border-color: var(--border-accent);
  background: rgba(99, 102, 241, 0.05);
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.stat-icon-total { background: rgba(99, 102, 241, 0.12); color: var(--accent-indigo); }
.stat-icon-available { background: rgba(52, 211, 153, 0.12); color: var(--accent-emerald); }
.stat-icon-used { background: rgba(251, 191, 36, 0.12); color: var(--accent-amber); }
.stat-icon-active { background: rgba(56, 189, 248, 0.12); color: var(--accent-sky); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- Toolbar ---------- */
.toolbar-section {
  padding: 20px 28px;
  position: relative;
  z-index: 1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.date-input-wrapper .input-date {
  padding-right: 32px;
  min-width: 160px;
}

.date-clear-btn {
  position: absolute;
  right: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-tertiary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
}

.date-clear-btn:hover {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-rose);
}

.date-clear-btn.hidden {
  display: none;
}

.search-date-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Custom checkbox */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-medium);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
}

.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Search Info ---------- */
.search-info {
  margin: 0 28px;
  padding: 12px 20px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slide-down 0.3s ease;
  position: relative;
  z-index: 1;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-info-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-accent);
  font-size: 0.88rem;
}

/* ---------- Barcodes Grid ---------- */
.barcodes-section {
  padding: 8px 28px 40px;
  position: relative;
  z-index: 1;
}

.barcodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ---------- Barcode Card ---------- */
.barcode-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-normal);
  animation: card-fade-in 0.4s ease both;
}

.barcode-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.barcode-card.is-used {
  opacity: 0.65;
}

.barcode-card.is-used:hover {
  opacity: 0.85;
}

.barcode-card.is-active {
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.08);
}

@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.barcode-image-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary);
}

.barcode-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.barcode-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.6));
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.barcode-image-wrapper:hover .barcode-image-overlay {
  opacity: 1;
}

.barcode-image-overlay span {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-available {
  background: rgba(52, 211, 153, 0.2);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-used {
  background: rgba(251, 191, 36, 0.2);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-active {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
}

.barcode-body {
  padding: 16px;
}

.barcode-birthday {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.barcode-birthday svg {
  color: var(--accent-purple);
  flex-shrink: 0;
}

.barcode-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.barcode-description {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.barcode-comment {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--accent-sky);
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.barcode-comment svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.barcode-used-note {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--accent-amber);
  margin-bottom: 10px;
}

.barcode-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-indigo);
  margin-bottom: 6px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

.barcode-value svg {
  color: var(--accent-indigo);
  flex-shrink: 0;
}

.barcode-value-empty {
  color: var(--text-tertiary);
  font-weight: 400;
  font-style: italic;
  font-family: inherit;
}

.barcode-value-empty svg {
  color: var(--text-tertiary);
}

/* ---------- Barcode Image Name ---------- */
.barcode-image-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent-purple);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.12);
  border-radius: var(--radius-sm);
}

.barcode-image-name svg {
  color: var(--accent-purple);
  flex-shrink: 0;
}

.barcode-image-name span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.barcode-image-name-empty {
  color: var(--text-tertiary);
  font-weight: 400;
  border-style: dashed;
  background: transparent;
}

.btn-edit-image-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-edit-image-name:hover {
  background: var(--bg-glass-hover);
  color: var(--accent-purple);
  border-color: rgba(168, 85, 247, 0.3);
}

.btn-add-image-name {
  width: auto;
  height: auto;
  padding: 4px 8px;
  gap: 4px;
  font-size: 0.75rem;
  font-family: var(--font-family);
}

.btn-add-image-name span {
  white-space: nowrap;
}

/* ---------- Search Value Input ---------- */
.search-value-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-value-wrapper .input-text {
  width: 220px;
  padding: 8px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.search-value-wrapper .input-text:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-value-wrapper .input-text::placeholder {
  color: var(--text-tertiary);
}

/* ---------- Duplicates Modal ---------- */
.duplicate-group {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.duplicate-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.05);
  border-bottom: 1px solid var(--border-subtle);
}

.duplicate-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  color: var(--accent-indigo);
}

.duplicate-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 10px;
  border-radius: 12px;
}

.duplicate-items {
  padding: 8px;
}

.duplicate-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.duplicate-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.duplicate-item img {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}

.duplicate-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.barcode-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.barcode-actions .btn {
  font-size: 0.78rem;
  padding: 6px 12px;
}

/* ---------- Selection Mode ---------- */
.barcode-card.is-selected {
  border-color: var(--accent-indigo) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), var(--shadow-md) !important;
}

.barcode-card.is-active {
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.08);
}

.barcode-select-check {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-medium);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  transition: all var(--transition-fast);
}

.barcode-select-check.checked {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
}

.barcode-card {
  position: relative;
}

/* ---------- Bulk Action Bar ---------- */
.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin-bottom: 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  animation: slide-down 0.3s ease;
}

.bulk-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bulk-bar-count {
  font-size: 0.85rem;
  color: var(--text-accent);
  font-weight: 500;
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state p {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--text-secondary);
}

.empty-state-hint {
  font-size: 0.85rem !important;
  color: var(--text-tertiary) !important;
  margin-top: 4px !important;
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

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

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-enter 0.3s var(--transition-slow) both;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-sm {
  max-width: 480px;
}

.modal-upload {
  max-width: 560px;
}

.modal-image {
  max-width: 90vw;
  max-height: 90vh;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.modal-close-image {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  border: none;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ---------- Drop Zone ---------- */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 20px;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone.drag-over {
  transform: scale(1.02);
}

.drop-zone p {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.drop-zone-hint {
  font-size: 0.82rem !important;
  color: var(--text-tertiary) !important;
  margin-top: 4px !important;
}

/* ---------- Upload Preview ---------- */
.preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

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

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.preview-item:hover .preview-remove {
  opacity: 1;
}

/* ---------- Users List ---------- */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.user-item-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.user-item-login {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.user-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 20px 0;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-secondary);
}

/* ---------- History ---------- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.history-dot-use { background: var(--accent-emerald); }
.history-dot-unuse { background: var(--accent-amber); }
.history-dot-upload { background: var(--accent-indigo); }
.history-dot-delete { background: var(--accent-rose); }

.history-text {
  flex: 1;
}

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

.history-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.history-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 420px;
  animation: toast-enter 0.4s var(--transition-slow) both;
  font-size: 0.88rem;
}

.toast-success {
  border-color: rgba(52, 211, 153, 0.3);
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.3);
}

.toast-success svg { color: var(--accent-emerald); }
.toast-error svg { color: var(--accent-rose); }

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

@keyframes toast-exit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ---------- Loading spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
  }

  .stats-section {
    padding: 16px 16px 0;
  }

  .toolbar-section {
    padding: 14px 16px;
  }

  .barcodes-section {
    padding: 8px 16px 40px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
  }

  .search-group {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
  }

  .date-input-wrapper {
    width: 100%;
  }

  .date-input-wrapper .input-date {
    width: 100%;
  }

  .search-date-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .input-date {
    width: 100%;
  }

  .barcodes-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 32px 24px;
    margin: 16px;
  }

  .search-info {
    margin: 0 16px;
  }
}

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

  .header-title {
    font-size: 1rem;
  }

  .user-badge {
    display: none;
  }
}
