/* ══════════════════════════════════════════════════════════════════
   IDISI — TAB 1: WAREHOUSE & CATALOG (VIDEOMAKER FROSTED AESTHETIC)
   With Dynamic Hover Color Manifestation
   ══════════════════════════════════════════════════════════════════ */

/* ── Stats Banner ──────────────────────────────────────────────── */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .stats-banner {
    gap: 16px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 16px 16px;
  }
  .stat-val {
    font-size: var(--fs-display);
  }
  .stat-lbl {
    font-size: var(--fs-label);
  }
}

@media (min-width: 1200px) {
  .stats-banner {
    gap: 16px;
    margin-bottom: 24px;
  }
  .stat-card {
    padding: 20px 16px;
  }
  .stat-val {
    font-size: var(--fs-hero);
  }
  .stat-lbl {
    font-size: var(--fs-label);
  }
}

.stat-card {
  padding: 12px 8px;
  background: var(--glass-card);
  
  
  border: 1px solid var(--border);
  box-shadow: var(--border-specular);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  position: relative;
  z-index: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.24s var(--ease), background 0.24s var(--ease), z-index 0s 0.24s;
  font-family: var(--font);
}

.stat-val {
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
  transition: all 0.25s var(--ease);
}

.stat-lbl {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  transition: color 0.25s var(--ease);
}

/* Default state: calm monochrome numbers.
   Hover state: VIBRANT COLOR MANIFESTATION! */
@media (hover: hover) and (pointer: fine) {
  .stat-card:hover {
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
    border-color: var(--border-light);
    background: var(--glass-card-hover);
    box-shadow: var(--shadow-sm);
  }

  .stat-card.in-stock:hover,
  .stat-card.out-stock:hover {
    border-color: var(--border-light);
    background: var(--glass-card-hover);
    box-shadow: var(--shadow-sm);
  }
}

/* ── Active Filter Selection on Stat Cards ──────────────────────── */
.stat-card.active,
.stat-card.in-stock.active,
.stat-card.out-stock.active {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-sm);
}

.stat-card.active .stat-val,
.stat-card.in-stock.active .stat-val,
.stat-card.out-stock.active .stat-val {
  color: var(--text-main);
}


/* ── Books Grid — Fluid Auto-Fill Responsive Multi-Column ──────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

@media (min-width: 520px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1440px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
  }
}

/* ── VideoMaker Frosted Glass Book Card (GPU & CPU Optimized) ── */
.book-card {
  background: var(--glass-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), var(--border-specular);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  z-index: 1;
  content-visibility: auto;
  contain-intrinsic-size: 0 320px;
  touch-action: manipulation;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .book-card:hover {
    z-index: 5;
    transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.24s var(--ease), background 0.24s var(--ease), z-index 0s 0s;
    transform: translateY(-4px);
    border-color: var(--border-light);
    background: var(--glass-card-hover);
    box-shadow: var(--shadow-md), var(--shadow-glow);
  }
}

.book-card:active:not(:has(.card-cover-toggle:active)) {
  transform: scale(0.985);
}

/* ── Poster Aspect Ratio ───────────────────────────────────────── */
.book-poster {
  width: 100%;
  aspect-ratio: 3 / 4.1;
  position: relative;
  background: var(--bg-surface);
  overflow: hidden;
  contain: paint;
}

.book-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  transition: transform 0.28s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .book-card:hover .book-img {
    transform: scale(1.04);
  }
}

.book-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle at center, #181818 0%, #0a0a0a 100%);
  color: var(--text-dim);
}

.book-img-placeholder svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.book-img-placeholder span {
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ── Poster Badges (Number + Stock Pills) ──────────────────────── */
.poster-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.badge-number {
  background: rgba(10, 10, 10, 0.88);
  
  
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: var(--fs-meta);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.poster-stock-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.badge-stock {
  font-size: var(--fs-meta);
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: var(--r-xs);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s var(--ease);
}

/* Idle state: calm frosted capsule with subtle tint.
   On hover: glows vibrantly! */
.badge-stock.badge-hard {
  background: rgba(14, 26, 18, 0.88);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

.badge-stock.badge-soft {
  background: rgba(28, 22, 12, 0.88);
  color: #fde047;
  border-color: rgba(234, 179, 8, 0.3);
}

@media (hover: hover) and (pointer: fine) {
  .book-card:hover .badge-stock.badge-hard {
    background: rgba(34, 197, 94, 0.95);
    color: #04240d;
    box-shadow: none;
    border-color: transparent;
  }

  .book-card:hover .badge-stock.badge-soft {
    background: rgba(245, 158, 11, 0.95);
    color: #2b1700;
    box-shadow: none;
    border-color: transparent;
  }
}

/* ── Book Card Content ─────────────────────────────────────────── */
.book-content {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.book-sku-tag {
  align-self: flex-start;
  font-size: var(--fs-meta);
  margin-bottom: 8px;
}

/* ── Строка переключения переплёта («Тв» / «Мяг») и цены ── */
.card-cover-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--bg-input, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border);
  box-sizing: border-box;
}

[data-theme="light"] .card-cover-row {
  background: #f1f4f8;
  border-color: rgba(15, 23, 42, 0.08);
}

.card-cover-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-width: 54px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-size: var(--fs-label);
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all 0.18s var(--ease, ease);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

[data-theme="light"] .card-cover-toggle {
  background: #ffffff;
  color: var(--text-main, #0f172a);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-cover-toggle:hover {
  filter: brightness(1.05);
  transform: translateY(-0.5px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .card-cover-toggle:hover {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

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

.card-price-val {
  flex: 1;
  min-width: 0;
  text-align: right;
  padding-right: 12px;
  font-size: var(--fs-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.card-price-val.zero {
  color: var(--text-muted);
  font-weight: 600;
  opacity: 0.65;
}

/* ── Skeleton Shimmer (Perception Acceleration) ────────────────── */
.skeleton-card {
  background: var(--glass-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.skeleton-poster {
  width: 100%;
  aspect-ratio: 3 / 4.1;
  background: rgba(255, 255, 255, 0.035);
}

.skeleton-content {
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.04);
}

.skeleton-ctrl {
  width: 100%;
  height: 60px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  margin-top: 4px;
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  animation: shimmerWave 1.4s ease-in-out infinite;
}

@keyframes shimmerWave {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
