/* ═══════════════════════════════════════════
   ITEMS PAGE — HIGH-END STYLES
   ═══════════════════════════════════════════ */

/* ─── TABLE ENHANCEMENTS ─── */
#itemsTable tbody tr {
  animation: fadeIn .35s var(--ease) both;
}
#itemsTable tbody tr:nth-child(1)  { animation-delay: .02s }
#itemsTable tbody tr:nth-child(2)  { animation-delay: .04s }
#itemsTable tbody tr:nth-child(3)  { animation-delay: .06s }
#itemsTable tbody tr:nth-child(4)  { animation-delay: .08s }
#itemsTable tbody tr:nth-child(5)  { animation-delay: .10s }
#itemsTable tbody tr:nth-child(6)  { animation-delay: .12s }
#itemsTable tbody tr:nth-child(7)  { animation-delay: .14s }
#itemsTable tbody tr:nth-child(8)  { animation-delay: .16s }
#itemsTable tbody tr:nth-child(9)  { animation-delay: .18s }
#itemsTable tbody tr:nth-child(10) { animation-delay: .20s }
#itemsTable tbody tr:nth-child(11) { animation-delay: .22s }
#itemsTable tbody tr:nth-child(12) { animation-delay: .24s }
#itemsTable tbody tr:nth-child(13) { animation-delay: .26s }
#itemsTable tbody tr:nth-child(14) { animation-delay: .28s }
#itemsTable tbody tr:nth-child(15) { animation-delay: .30s }

#itemsTable tbody tr:hover {
  background: rgba(59,130,246,.035);
}

.items-empty {
  text-align: center;
  padding: 60px 20px !important;
  color: var(--dim);
  font-size: .85rem;
}

/* Row checkbox */
#itemsTable input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ─── TRACKING TYPE PREVIEW (in modal) ─── */
.tracking-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
}

/* ─── STOCK DETAIL MODAL ─── */
.stock-modal {
  min-width: 720px;
  max-width: 820px;
}

/* Summary row */
.stock-item-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.stock-item-summary .summary-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(139,92,246,.08));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--accent);
  flex-shrink: 0;
}
.stock-item-summary .summary-info {
  flex: 1;
}
.stock-item-summary .summary-code {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--en);
  letter-spacing: .3px;
}
.stock-item-summary .summary-name {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 2px;
}
.stock-item-summary .summary-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.stock-item-summary .summary-stock {
  text-align: right;
}
.stock-item-summary .summary-stock-label {
  font-size: .7rem;
  color: var(--muted);
}
.stock-item-summary .summary-stock-value {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--en);
  color: var(--accent);
  letter-spacing: -.3px;
}

/* ─── TABS ─── */
.stock-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.stock-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  position: relative;
  bottom: -1px;
}
.stock-tab:hover {
  color: var(--text2);
}
.stock-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.stock-tab i {
  font-size: .75rem;
}

/* Tab panels */
.stock-tab-panel {
  display: none;
  animation: fadeIn .3s var(--ease) both;
}
.stock-tab-panel.active {
  display: block;
}
.stock-tab-loading {
  text-align: center;
  padding: 40px;
  color: var(--dim);
  font-size: .84rem;
}

/* Inner tables inside stock detail */
.stock-inner-table {
  width: 100%;
  border-collapse: collapse;
}
.stock-inner-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}
.stock-inner-table td {
  padding: 10px 14px;
  font-size: .8rem;
  border-bottom: 1px solid rgba(255,255,255,.03);
  white-space: nowrap;
}
.stock-inner-table tbody tr {
  transition: background .15s var(--ease);
}
.stock-inner-table tbody tr:hover {
  background: rgba(59,130,246,.025);
}
.stock-inner-table tbody tr:last-child td {
  border-bottom: none;
}
.stock-inner-table .font-mono {
  font-family: var(--en);
  font-feature-settings: 'tnum';
}

/* Warehouse stock bar */
.stock-bar-wrap {
  width: 100px;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}
.stock-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .6s var(--ease);
}

/* Movement type badges */
.mv-in {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  background: rgba(34,197,94,.08);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.08);
}
.mv-out {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  background: rgba(239,68,68,.08);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.08);
}
.mv-adj {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  background: rgba(245,158,11,.08);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,.08);
}
.mv-move {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  background: rgba(59,130,246,.08);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,.08);
}

/* Empty state inside tabs */
.stock-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--dim);
  font-size: .84rem;
}
.stock-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: .3;
}

/* ─── QR CODE MODAL ─── */
.qr-modal {
  min-width: 380px;
  max-width: 420px;
}

.qr-info {
  text-align: center;
  margin-bottom: 24px;
}
.qr-item-code {
  font-size: .78rem;
  font-weight: 700;
  font-family: var(--en);
  color: var(--accent);
  letter-spacing: .8px;
  margin-bottom: 4px;
}
.qr-item-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.qr-code-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface2);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.qr-code-wrap .qr-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(139,92,246,.08), rgba(59,130,246,.05));
  opacity: .6;
  pointer-events: none;
  z-index: 0;
}
.qr-code-wrap #qrCanvas {
  position: relative;
  z-index: 1;
}
.qr-code-wrap #qrCanvas img,
.qr-code-wrap #qrCanvas canvas {
  display: block;
  border-radius: 4px;
}

.qr-actions {
  display: flex;
  gap: 10px;
}
.qr-actions .e-btn {
  min-width: 120px;
  justify-content: center;
}
.qr-actions .e-btn i {
  font-size: .75rem;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .stock-modal {
    min-width: auto;
    width: 95vw;
  }
  .qr-modal {
    min-width: auto;
    width: 90vw;
    max-width: 420px;
  }
}

@media (max-width: 768px) {
  /* Stock detail modal - stack summary rows */
  .stock-item-summary{
    flex-wrap:wrap;gap:12px;padding:12px 14px;
  }
  .stock-item-summary .summary-icon{width:40px;height:40px;font-size:1rem}
  .stock-item-summary .summary-info{flex:1 1 100%;order:2}
  .stock-item-summary .summary-stock{flex:1 1 100%;order:3;text-align:left}
  .stock-item-summary .summary-stock-value{font-size:1.2rem}
  .stock-item-summary .summary-name{font-size:.88rem}

  /* Stock tabs — scroll horizontal */
  .stock-tabs{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch}
  .stock-tabs::-webkit-scrollbar{display:none}
  .stock-tab{padding:8px 12px;font-size:.75rem;white-space:nowrap;flex-shrink:0}

  /* Inner tables - compact */
  .stock-inner-table th,.stock-inner-table td{padding:8px 10px;font-size:.72rem}

  /* QR modal */
  .qr-actions{flex-direction:column;gap:8px}
  .qr-actions .e-btn{width:100%;min-width:auto}
}
