/* StremioLabAR Catalogs V2 — Refined Dark Cinema */

/* ═══════════════════════════════════════
   1. Design Tokens
   ═══════════════════════════════════════ */
:root {
  /* Brand */
  --purple: #7B5BF5;
  --purple-hover: #6A4AE8;
  --purple-dim: rgba(123, 91, 245, 0.12);
  --purple-glow: rgba(123, 91, 245, 0.25);
  --mint: #10B981;
  --mint-dim: rgba(16, 185, 129, 0.12);
  --mint-glow: rgba(16, 185, 129, 0.25);

  /* Surfaces */
  --bg-page: #08080D;
  --bg-card: #111117;
  --bg-elevated: #1A1A22;
  --bg-input: #16161E;
  --bg-hover: #1F1F28;

  /* Borders */
  --border: #252530;
  --border-subtle: #1E1E28;
  --border-focus: var(--purple);

  /* Text */
  --text-1: #F0F0F5;
  --text-2: #9898A6;
  --text-3: #5C5C6E;

  /* Semantic */
  --error: #EF4444;
  --warning: #F59E0B;
  --success: var(--mint);

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.15);
  --shadow-elevated: 0 4px 24px rgba(0,0,0,.35);
  --shadow-glow-purple: 0 0 0 3px var(--purple-glow);
  --shadow-glow-mint: 0 0 0 3px var(--mint-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-1);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture on page background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.018;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ═══════════════════════════════════════
   3. Layout
   ═══════════════════════════════════════ */
.page {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-6);
  padding-bottom: var(--space-8);
}

/* Extra bottom padding only when action bar is present */
.page.has-action-bar {
  padding-bottom: 120px;
}

/* ═══════════════════════════════════════
   4. Header
   ═══════════════════════════════════════ */
.header {
  margin-bottom: var(--space-8);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  object-fit: cover;
}

.header-text h1 {
  font-family: 'Rethink Sans', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-text h1 .brand-purple {
  color: var(--purple);
}

.header-text h1 .brand-mint {
  color: var(--mint);
}

.header-text h1 .brand-dim {
  color: var(--text-2);
  font-weight: 600;
}

.header-text p {
  font-size: 15px;
  color: var(--text-2);
  margin-top: var(--space-1);
}

/* Stats bar */
.stats-bar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.stat-value {
  font-family: 'Rethink Sans', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--purple);
}

.stat-label {
  font-size: 13px;
  color: var(--text-3);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* ═══════════════════════════════════════
   5. Section Cards
   ═══════════════════════════════════════ */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-card);
}

.section-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-card-header h2 {
  font-family: 'Rethink Sans', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
}

.section-card-header .icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--purple-dim);
  color: var(--purple);
  flex-shrink: 0;
}

.section-hint {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: var(--space-4);
}

/* ═══════════════════════════════════════
   6. Inputs & Buttons
   ═══════════════════════════════════════ */
.input-row {
  display: flex;
  gap: var(--space-3);
}

.input-field {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

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

.input-field:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--shadow-glow-purple);
}

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast), transform var(--duration-fast);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--purple-hover);
}

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

.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow-purple);
}

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

/* Secondary button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-3);
  color: var(--text-1);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow-purple);
}

/* Small button */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 12px;
  border-radius: 6px;
}

/* Status messages */
.status-msg {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
}

.status-msg.visible { display: block; }
.status-msg.error   { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); color: var(--error); }
.status-msg.success { background: var(--mint-dim); border: 1px solid rgba(16,185,129,.25); color: var(--mint); }
.status-msg.warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25); color: var(--warning); }

/* ═══════════════════════════════════════
   7. Letterboxd Item
   ═══════════════════════════════════════ */
.lb-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--mint-dim);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-sm);
  margin-top: var(--space-3);
}

.lb-item .lb-icon { font-size: 18px; }

.lb-item .lb-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-1);
}

.lb-item .lb-remove {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  padding: var(--space-1);
  border-radius: 4px;
  transition: color var(--duration-fast);
  line-height: 1;
}

.lb-item .lb-remove:hover { color: var(--error); }

/* ═══════════════════════════════════════
   8. Tab Navigation
   ═══════════════════════════════════════ */
.catalog-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-5);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.tab-btn:hover {
  color: var(--text-2);
  background: var(--bg-elevated);
}

.tab-btn.active {
  background: var(--purple-dim);
  color: var(--purple);
}

.tab-btn .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-3);
  transition: all var(--duration-normal);
}

.tab-btn.active .tab-count {
  background: var(--purple);
  color: #fff;
}

/* Tab Panels */
.tab-panel {
  display: none;
  opacity: 0;
  transform: translateY(6px);
}

.tab-panel.active {
  display: block;
  animation: panelIn var(--duration-normal) var(--ease-out) forwards;
}

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

/* ═══════════════════════════════════════
   9. Search Bar
   ═══════════════════════════════════════ */
.search-bar {
  position: relative;
  margin-bottom: var(--space-4);
}

.search-bar .search-icon {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-bar input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  padding-right: 40px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.search-bar input::placeholder { color: var(--text-3); }

.search-bar input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--shadow-glow-purple);
}

/* ═══════════════════════════════════════
   10. Filter Chips
   ═══════════════════════════════════════ */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.chip.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.chip.chip-sort {
  border-style: dashed;
}

.chip.chip-sort.active {
  border-style: solid;
}

.chip-expand {
  border-style: dashed;
  border-color: var(--border-subtle);
  color: var(--text-3);
}

.chip-expand:hover {
  border-color: var(--text-3);
  color: var(--text-2);
}

/* ═══════════════════════════════════════
   11. Catalog List
   ═══════════════════════════════════════ */
.catalog-scroll {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-left: 2px; /* scrollbar spacing */
}

/* Custom scrollbar */
.catalog-scroll::-webkit-scrollbar { width: 5px; }
.catalog-scroll::-webkit-scrollbar-track { background: transparent; }
.catalog-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.catalog-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* Catalog row */
.cat-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.cat-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.cat-row.selected {
  background: var(--purple-dim);
  border-color: rgba(123, 91, 245, 0.3);
}

.cat-row.hidden {
  display: none;
}

/* Custom checkbox */
.cat-check {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  transition: all var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cat-row.selected .cat-check {
  background: var(--purple);
  border-color: var(--purple);
}

.cat-check svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast) var(--ease-out);
}

.cat-row.selected .cat-check svg {
  opacity: 1;
  transform: scale(1);
}

/* Catalog name */
.cat-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Catalog badge */
.cat-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}

.cat-row.selected .cat-badge {
  background: rgba(123,91,245,.15);
  color: var(--purple);
}

/* ═══════════════════════════════════════
   12. Bulk Actions
   ═══════════════════════════════════════ */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.bulk-bar .selected-text {
  font-size: 13px;
  color: var(--text-3);
}

.bulk-bar .selected-text strong {
  color: var(--purple);
  font-weight: 700;
}

.bulk-bar .bulk-btns {
  display: flex;
  gap: var(--space-2);
}

/* ═══════════════════════════════════════
   13. Info Bar
   ═══════════════════════════════════════ */
.info-bar {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
}

/* ═══════════════════════════════════════
   14. Random Selection Section
   ═══════════════════════════════════════ */
.collapsible {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.collapsible-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  user-select: none;
}

.collapsible-trigger:hover {
  background: var(--bg-elevated);
}

.collapsible-trigger-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.collapsible-arrow {
  font-size: 14px;
  color: var(--text-3);
  transition: transform var(--duration-normal) var(--ease-out);
}

.collapsible.open .collapsible-arrow {
  transform: rotate(180deg);
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out);
}

.collapsible.open .collapsible-body {
  max-height: 500px;
}

.collapsible-inner {
  padding: 0 var(--space-6) var(--space-6);
}

/* Warning note */
.warning-block {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 13px;
  color: var(--warning);
  text-align: center;
}

/* Quick start buttons */
.qs-grid {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.qs-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-5) var(--space-7);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
  min-width: 100px;
  font-family: inherit;
}

.qs-btn:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.qs-btn .qs-num {
  font-family: 'Rethink Sans', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-1);
}

.qs-btn .qs-label {
  font-size: 12px;
  color: var(--text-3);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-3) 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.divider-label {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   15. Selection Warnings
   ═══════════════════════════════════════ */
.warn-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: var(--space-4);
  display: none;
}

.warn-banner.visible { display: block; }

.warn-banner.warn-50 {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  color: var(--warning);
  text-align: center;
}

.warn-banner.warn-cap {
  position: fixed;
  top: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,.95);
  border: 1px solid #dc2626;
  color: #fff;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
  box-shadow: var(--shadow-elevated);
}

.warn-banner.warn-cap.visible {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════
   16. Sticky Action Bar
   ═══════════════════════════════════════ */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(to top, var(--bg-page) 70%, transparent);
  padding: var(--space-4) var(--space-6) var(--space-6);
  pointer-events: none;
}

.action-bar-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-elevated);
  pointer-events: all;
}

.selection-info {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--text-2);
}

.selection-info .sel-count {
  font-family: 'Rethink Sans', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--purple);
}

.selection-info .sel-sep {
  color: var(--text-3);
  font-weight: 400;
}

.selection-info .sel-max {
  color: var(--text-3);
  font-size: 14px;
}

.action-bar .btn-primary {
  padding: var(--space-3) var(--space-7);
  font-size: 15px;
}

/* ═══════════════════════════════════════
   17. Social Links
   ═══════════════════════════════════════ */
.community-row {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.community-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--duration-fast);
}

.community-link:hover {
  border-color: var(--purple);
  color: var(--purple);
  transform: translateY(-1px);
}

.community-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ═══════════════════════════════════════
   18. Credits
   ═══════════════════════════════════════ */
.credits {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
  padding: var(--space-5) 0;
}

.credits strong { color: var(--text-2); }

.credits a {
  color: var(--purple);
  text-decoration: none;
}

.credits a:hover { text-decoration: underline; }

.credits .providers {
  opacity: 0.6;
}

/* ═══════════════════════════════════════
   19. Staggered Load Animation
   ═══════════════════════════════════════ */
.anim-in {
  opacity: 0;
  transform: translateY(12px);
  animation: slideIn 0.5s var(--ease-out) forwards;
}

.anim-in:nth-child(1) { animation-delay: 0ms; }
.anim-in:nth-child(2) { animation-delay: 60ms; }
.anim-in:nth-child(3) { animation-delay: 120ms; }
.anim-in:nth-child(4) { animation-delay: 180ms; }
.anim-in:nth-child(5) { animation-delay: 240ms; }
.anim-in:nth-child(6) { animation-delay: 300ms; }
.anim-in:nth-child(7) { animation-delay: 360ms; }
.anim-in:nth-child(8) { animation-delay: 420ms; }

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

/* ═══════════════════════════════════════
   20. Spinner
   ═══════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}

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

/* ═══════════════════════════════════════
   21. Responsive
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  .page {
    padding: var(--space-4) var(--space-3);
    padding-bottom: var(--space-7);
  }

  .page.has-action-bar {
    padding-bottom: 110px;
  }

  .header-inner {
    gap: var(--space-4);
  }

  .logo {
    width: 52px;
    height: 52px;
  }

  .header-text h1 {
    font-size: 20px;
  }

  .header-text p {
    font-size: 13px;
  }

  /* Stats bar compact on mobile */
  .stats-bar {
    flex-direction: row;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
  }

  .stat {
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 0;
  }

  .stat-divider {
    width: 1px;
    height: 32px;
    flex-shrink: 0;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-label {
    font-size: 10px;
    line-height: 1.3;
  }

  .input-row {
    flex-direction: column;
  }

  .section-card {
    padding: var(--space-4);
  }

  .section-card-header h2 {
    font-size: 15px;
  }

  .tab-btn {
    padding: var(--space-3) var(--space-2);
    font-size: 13px;
  }

  .catalog-scroll {
    max-height: 350px;
  }

  .cat-row {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .cat-name {
    font-size: 13px;
  }

  .filter-chips {
    gap: 6px;
  }

  .chip {
    font-size: 11px;
    padding: 4px 10px;
  }

  .bulk-bar {
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
    text-align: center;
  }

  .bulk-bar .bulk-btns {
    justify-content: center;
  }

  .qs-grid {
    flex-direction: column;
    align-items: center;
  }

  .qs-btn {
    width: 100%;
    max-width: 200px;
    padding: var(--space-4) var(--space-6);
  }

  .qs-num {
    font-size: 24px;
  }

  /* Sticky action bar */
  .action-bar {
    padding: var(--space-3) var(--space-3) var(--space-4);
  }

  .action-bar-inner {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .selection-info .sel-count {
    font-size: 18px;
  }

  .action-bar .btn-primary {
    padding: var(--space-3) var(--space-5);
    font-size: 14px;
  }

  .community-row {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-2);
  }

  .community-link {
    padding: var(--space-2) var(--space-4);
    font-size: 13px;
  }

  .collapsible-trigger {
    padding: var(--space-4) var(--space-5);
  }

  .collapsible-trigger-text {
    font-size: 15px;
  }

  .collapsible-inner {
    padding: 0 var(--space-4) var(--space-4);
  }
}

@media (max-width: 420px) {
  .header-inner {
    gap: var(--space-3);
  }

  .logo {
    width: 44px;
    height: 44px;
  }

  .header-text h1 {
    font-size: 18px;
  }

  .catalog-tabs {
    gap: 1px;
    padding: 2px;
  }

  .tab-btn {
    font-size: 12px;
    gap: 3px;
    padding: var(--space-2) var(--space-1);
  }

  .tab-btn .tab-count {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .action-bar-inner {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }

  .action-bar .btn-primary {
    width: 100%;
  }
}
