/* =====================================================
   VIBE Carolina — Inventory Count Styles
   ===================================================== */

/* ── Toolbar ────────────────────────────────────────── */
.inv-toolbar {
  padding: 12px 16px 8px;
  display: flex; flex-direction: column; gap: 8px;
}

/* Search bar */
.inv-search-wrap {
  position: relative; display: flex; align-items: center;
}
.inv-search-icon {
  position: absolute; left: 12px; color: #9ca3af; pointer-events: none;
}
.inv-search-input {
  width: 100%; padding: 10px 14px 10px 38px;
  border: 1.5px solid #e5e7eb; border-radius: 10px;
  background: #fff; font-size: .9rem; color: #1a1d2e;
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.inv-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.inv-search-input::placeholder { color: #9ca3af; }

/* Second toolbar row */
.inv-toolbar-row2 {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.inv-sync-label { font-size: .75rem; color: #9ca3af; }
.inv-filter-select {
  padding: 6px 10px; border-radius: 8px;
  border: 1.5px solid #e5e7eb; background: #fff;
  font-size: .8rem; color: #374151; cursor: pointer;
  appearance: auto;
}

/* ── Product grid (reuses .product-grid from style.css) ── */
.inv-store-group { margin-bottom: 4px; }
.inv-store-count {
  font-size: .68rem; color: #c4b5a0; font-weight: 500;
  margin-left: auto;
}
/* Extra bottom padding for the fixed sync bar */
#inv-product-list { padding-bottom: 140px; }

/* ── Inventory card overrides ────────────────────────── */
/* Green left border when counted */
.inv-card.inv-counted .card-color-bar {
  background: #22c55e;
}

/* Replace the card footer with inventory controls */
.inv-card-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid #f1f5f9;
}
.inv-card-qty-row {
  display: flex; align-items: center; gap: 6px;
}

/* −/+ buttons */
.inv-card-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1.5px solid #e5e7eb; background: #f8fafc;
  color: #374151; font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.inv-card-btn:active { background: #e5e7eb; transform: scale(.93); }

/* Qty box: number + "cs" unit */
.inv-card-qty-box {
  flex: 1;
  display: flex; align-items: baseline; justify-content: center; gap: 3px;
  background: #eff6ff; border: 2px solid #bfdbfe; border-radius: 8px;
  padding: 5px 8px; transition: background .2s, border-color .2s;
}
.inv-card-qty-box.counted {
  background: #dcfce7; border-color: #86efac;
}

.inv-card-qty-input {
  width: 36px; font-size: 1.2rem; font-weight: 800;
  color: #1d4ed8; text-align: center;
  background: transparent; border: none; outline: none; padding: 0;
  -moz-appearance: textfield;
}
.inv-card-qty-box.counted .inv-card-qty-input { color: #15803d; }
.inv-card-qty-input::-webkit-inner-spin-button,
.inv-card-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.inv-card-unit {
  font-size: .65rem; font-weight: 700; color: #60a5fa;
  letter-spacing: .03em; align-self: flex-end; margin-bottom: 1px;
}
.inv-card-qty-box.counted .inv-card-unit { color: #4ade80; }

/* ── Empty state ─────────────────────────────────────── */
.inv-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 60px 24px; gap: 12px;
  color: #6b7280;
}
.inv-empty-state h3 { font-size: 1.05rem; color: #1a1d2e; margin: 0; }
.inv-empty-state p  { font-size: .85rem; margin: 0; }

/* ── Sync bottom bar ─────────────────────────────────── */
.inv-sync-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 16px 24px;
  background: linear-gradient(to top, #f0f2f5 60%, transparent);
  z-index: 50;
  display: flex; align-items: center; gap: 10px;
}
.inv-sync-btn-big {
  flex: 1; padding: 16px;
  border: none; border-radius: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #1a1d2e; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  transition: all .2s;
}
.inv-sync-btn-big:active { transform: scale(.98); }

/* Unsaved dot */
.inv-unsaved-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #f59e0b; flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(245,158,11,.2);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}

/* Sync header button spinning state */
.inv-sync-icon.inv-syncing svg { animation: spin .8s linear infinite; }

/* ═══════════════════════════════════════════════════════
   📷 Barcode scanning (2026-07-21)
   ═══════════════════════════════════════════════════════ */

/* ── Scan bar ─────────────────────────────────────────── */
.inv-scan-bar { padding: 12px 16px 0; }
.inv-scan-bar form {
  display: flex; align-items: center; gap: 8px;
  position: relative;
}
.inv-scan-glyph {
  position: absolute; left: 12px; color: #16a34a; pointer-events: none;
}
.inv-scan-input {
  flex: 1; min-width: 0;
  padding: 12px 14px 12px 38px;
  border: 1.5px solid #d1fae5; border-radius: 12px;
  background: #fff; color: #1a1d2e;
  font-size: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.inv-scan-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.inv-scan-input::placeholder {
  color: #9ca3af;
  font-family: inherit;
}
.inv-scan-find {
  padding: 12px 16px; border: none; border-radius: 12px;
  background: #1a1d2e; color: #fff;
  font-size: .85rem; font-weight: 700; cursor: pointer;
  flex-shrink: 0;
}
.inv-scan-find:active { transform: scale(.97); }

/* ── Bottom sheet (quick count / link) ────────────────── */
.inv-sheet-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,17,26,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.inv-sheet-overlay[hidden] { display: none; }
.inv-sheet {
  width: 100%; max-width: 560px;
  background: #fff; color: #1a1d2e;
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
  animation: inv-sheet-up .18s ease-out;
  max-height: 82vh; overflow-y: auto;
}
@keyframes inv-sheet-up {
  from { transform: translateY(24px); opacity: .6; }
  to   { transform: translateY(0);    opacity: 1; }
}

.inv-sheet-head { display: flex; align-items: flex-start; gap: 12px; }
.inv-sheet-titles { flex: 1; min-width: 0; }
.inv-sheet-titles h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.inv-sheet-meta { font-size: .78rem; color: #6b7280; margin-top: 3px; }
.inv-sheet-code {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 3px 9px;
  background: #f3f4f6; border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem; color: #4b5563;
}
.inv-sheet-relink {
  border: none; background: none; padding: 0;
  color: #3b82f6; font-size: .72rem; font-weight: 600;
  cursor: pointer; text-decoration: underline;
}
.inv-sheet-thumb {
  width: 54px; height: 54px; border-radius: 10px;
  object-fit: contain; background: #fff;
  border: 1px solid #e5e7eb; flex-shrink: 0;
}
.inv-sheet-x {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: #f3f4f6; color: #6b7280;
  font-size: .95rem; cursor: pointer; flex-shrink: 0;
}

.inv-sheet-onhand {
  margin: 12px 0 0; font-size: .85rem; color: #6b7280;
}
.inv-sheet-onhand b { color: #1a1d2e; }

/* Count / Receive segmented toggle (warehouse) */
.inv-sheet-actions {
  display: flex; gap: 3px; margin-top: 12px;
  background: #f3f4f6; border-radius: 10px; padding: 3px;
}
.inv-sheet-action-btn {
  flex: 1; padding: 9px 8px; border: none; border-radius: 8px;
  background: transparent; color: #6b7280;
  font-size: .85rem; font-weight: 600; cursor: pointer;
}
.inv-sheet-action-btn.active {
  background: #fff; color: #1a1d2e;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* Big stepper */
.inv-sheet-qty {
  display: grid; grid-template-columns: 60px 1fr 60px;
  gap: 10px; margin-top: 12px;
}
.inv-sheet-qty button {
  height: 54px; border: 1.5px solid #e5e7eb; border-radius: 12px;
  background: #f9fafb; color: #1a1d2e;
  font-size: 1.6rem; font-weight: 600; cursor: pointer;
}
.inv-sheet-qty button:active { background: #d1fae5; }
.inv-sheet-qty-input {
  text-align: center; font-size: 1.6rem; font-weight: 700;
  border: 1.5px solid #e5e7eb; border-radius: 12px;
  color: #1a1d2e; min-width: 0; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.inv-sheet-qty-input:focus { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.inv-sheet-qty-input::-webkit-outer-spin-button,
.inv-sheet-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.inv-sheet-fracs { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }

.inv-sheet-save {
  width: 100%; margin-top: 14px; padding: 14px;
  border: none; border-radius: 12px;
  background: #22c55e; color: #fff;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.inv-sheet-save:active { transform: scale(.98); }
.inv-sheet-cancel {
  width: 100%; margin-top: 8px; padding: 10px;
  border: none; background: none; color: #6b7280;
  font-size: .85rem; font-weight: 600; cursor: pointer;
}

/* ── Link sheet ───────────────────────────────────────── */
.inv-link-note {
  margin: 10px 0 0; padding: 10px 12px;
  background: #fef3c7; color: #92400e;
  border-radius: 10px; font-size: .8rem; line-height: 1.4;
}
.inv-link-search { margin-top: 12px; }
.inv-link-results {
  margin-top: 8px; max-height: 44vh; overflow-y: auto;
  border: 1px solid #f3f4f6; border-radius: 12px;
}
.inv-link-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: none; border-bottom: 1px solid #f3f4f6;
  background: #fff; cursor: pointer; text-align: left;
}
.inv-link-row:last-child { border-bottom: none; }
.inv-link-row:active { background: #f0fdf4; }
.inv-link-thumb {
  width: 38px; height: 38px; border-radius: 8px;
  object-fit: contain; border: 1px solid #f3f4f6;
  background: #fff; flex-shrink: 0;
}
.inv-link-name { font-size: .85rem; font-weight: 600; color: #1a1d2e; line-height: 1.25; }
.inv-link-meta { font-size: .72rem; color: #9ca3af; margin-top: 2px; }
.inv-link-empty { padding: 18px; text-align: center; color: #9ca3af; font-size: .82rem; }

/* ── Scanned-card flash ───────────────────────────────── */
.inv-scan-flash { animation: inv-flash 1.4s ease-out; }
@keyframes inv-flash {
  0%   { box-shadow: 0 0 0 3px rgba(34,197,94,.8); }
  100% { box-shadow: 0 0 0 3px rgba(34,197,94,0); }
}

/* ── Link-sheet filter chips (no-keyboard narrowing) ──── */
.inv-link-chips {
  display: flex; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-top: 8px; padding-bottom: 2px;
  scrollbar-width: none;
}
.inv-link-chips::-webkit-scrollbar { display: none; }
.inv-chip {
  border: 1.5px solid #e5e7eb; background: #fff; color: #374151;
  border-radius: 999px; padding: 7px 13px;
  font-size: .78rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0; cursor: pointer;
}
.inv-chip.active { background: #1a1d2e; color: #fff; border-color: #1a1d2e; }

/* ── Product-first linking (armed scan) ───────────────── */
.inv-card { position: relative; }
.inv-card-linkbtn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid #e5e7eb; border-radius: 9px;
  background: rgba(255,255,255,.94); color: #9ca3af;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.inv-card-linkbtn svg { width: 17px; height: 17px; }
.inv-card-linkbtn:active { background: #dcfce7; color: #16a34a; border-color: #86efac; }

.inv-scan-arm {
  margin: 10px 16px 0;
  padding: 10px 14px;
  background: #dcfce7; color: #14532d;
  border-radius: 12px; font-size: .85rem; line-height: 1.35;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.inv-scan-arm button {
  border: none; border-radius: 8px; padding: 7px 12px;
  background: #fff; color: #14532d;
  font-size: .78rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.inv-scan-input.armed {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.28);
}
