/* ================================================================
   CATALOG + CURATOR — Standalone Page Styles
   Dark theme matching existing portal (navy, cream, gold)
   ================================================================ */

/* Catalog-only variables — scoped so they never override portal globals */
.page-catalog {
  --navy-card:   #111630;
  --navy-hover:  #1a1f44;
  --cream:       #e8dcc4;
  --green:       #4ade80;
  --green-soft:  rgba(74,222,128,0.15);
  --amber:       #fbbf24;
  --amber-soft:  rgba(251,191,36,0.15);
  --red:         #f87171;
  --red-soft:    rgba(248,113,113,0.15);
  --gray:        #9ca3af;
  --gray-soft:   rgba(156,163,175,0.15);
  --blue:        #60a5fa;
  --blue-soft:   rgba(96,165,250,0.15);
}

/* Scoped to catalog page — no global resets */

/* ── Header ──────────────────────────────────────────────── */
.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--gold-soft);
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
}
.cat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-header-logo {
  height: 28px;
  opacity: 0.9;
}
.cat-header-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 1px;
}
.cat-header-back {
  color: var(--ivory-faint);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--fade);
}
.cat-header-back:hover { color: var(--gold); }

/* ── Tabs ────────────────────────────────────────────────── */
.cat-tabs {
  display: flex;
  gap: 0;
  padding: 0 0;
  border-bottom: 1px solid rgba(226,198,141,0.12);
  margin-bottom: 20px;
}
.cat-tab {
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ivory-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--fade);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--sans);
}
.cat-tab:hover { color: var(--cream); }
.cat-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Content area ────────────────────────────────────────── */
.cat-content {
  padding: 0;
  max-width: 1400px;
  margin: 0 auto;
}
.cat-panel { display: none; }
.cat-panel.active { display: block; }

/* ── Filter bar ──────────────────────────────────────────── */
.cat-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.cat-filter-select, .cat-filter-input {
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color var(--fade);
}
.cat-filter-select:focus, .cat-filter-input:focus {
  border-color: var(--gold);
}
.cat-filter-select option { background: var(--navy-2); }
.cat-filter-input { min-width: 200px; }

.cat-filter-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.cat-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--gold-soft);
  background: transparent;
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: all var(--fade);
  white-space: nowrap;
}
.cat-btn:hover {
  background: var(--gold-faint);
  border-color: var(--gold);
}
.cat-btn-primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.cat-btn-primary:hover {
  background: var(--gold-deep);
}
.cat-btn-bible {
  border-color: rgba(212,168,67,0.4);
  color: var(--gold);
}
.cat-btn-bible:hover {
  border-color: var(--gold);
  background: rgba(212,168,67,0.1);
}
.cat-btn-danger {
  border-color: var(--red-soft);
  color: var(--red);
}
.cat-btn-danger:hover {
  background: var(--red-soft);
}
.cat-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── SKU Grid ────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .cat-grid { grid-template-columns: 1fr; } }

.cat-card {
  background: #0d1230;
  border: 1px solid rgba(226,198,141,0.08);
  border-radius: 6px;
  padding: 14px;
  transition: all 0.2s;
  cursor: default;
}
.cat-card:hover {
  border-color: rgba(226,198,141,0.18);
}
.cat-card-img {
  width: 100%;
  height: 100px;
  background: #0a0e24;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cat-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.cat-card-img-placeholder {
  color: rgba(244,239,231,0.15);
  font-size: 11px;
  letter-spacing: 0.03em;
}
.cat-card-dropzone {
  cursor: pointer;
  transition: all 0.2s;
}
.cat-drop-active {
  border: 2px dashed rgba(226,198,141,0.4);
  background: rgba(226,198,141,0.05);
}
.cat-drop-active .cat-card-img-placeholder {
  color: rgba(226,198,141,0.5);
}
.cat-card-name {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #e8dcc4;
  margin-bottom: 3px;
  line-height: 1.3;
}
.cat-card-sku {
  font-size: 10px;
  color: rgba(244,239,231,0.35);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}
.cat-card-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.cat-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid;
}
.cat-badge-cat {
  background: transparent;
  color: rgba(226,198,141,0.7);
  border-color: rgba(226,198,141,0.2);
}
.cat-badge-subcat {
  background: transparent;
  color: rgba(96,165,250,0.7);
  border-color: rgba(96,165,250,0.2);
}
.cat-badge-enrichment {
  background: transparent;
}
.cat-badge-enrichment-pending {
  color: rgba(251,191,36,0.7);
  border-color: rgba(251,191,36,0.2);
}
.cat-badge-enrichment-enriched {
  color: rgba(74,222,128,0.7);
  border-color: rgba(74,222,128,0.2);
}
.cat-badge-enrichment-failed {
  color: rgba(248,113,113,0.7);
  border-color: rgba(248,113,113,0.2);
}

/* Status pills */
.cat-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid;
}
.cat-status-active   { background: transparent; color: rgba(74,222,128,0.7); border-color: rgba(74,222,128,0.2); }
.cat-status-paused   { background: transparent; color: rgba(156,163,175,0.7); border-color: rgba(156,163,175,0.2); }
.cat-status-seasonal { background: transparent; color: rgba(251,191,36,0.7); border-color: rgba(251,191,36,0.2); }
.cat-status-retired  { background: transparent; color: rgba(248,113,113,0.7); border-color: rgba(248,113,113,0.2); }
.cat-status:hover { opacity: 0.8; }

.cat-card-meta {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(244,239,231,0.3);
}
.cat-card-meta span { display: block; margin-bottom: 1px; }

.cat-card-bible-toggle {
  margin-top: 6px;
  background: none;
  border: 1px solid rgba(226,198,141,0.12);
  color: rgba(226,198,141,0.5);
  font-size: 9px;
  font-family: 'Poppins', system-ui, sans-serif;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.cat-card-bible-toggle:hover {
  border-color: rgba(226,198,141,0.3);
  color: rgba(226,198,141,0.8);
}
.cat-card-bible {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.cat-bible-section {
  margin-bottom: 6px;
}
.cat-bible-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(212,168,67,0.5);
  margin-bottom: 2px;
}
.cat-bible-text {
  display: block;
  font-size: 11px;
  line-height: 1.5;
  color: var(--cream);
}

/* ── Stats bar ───────────────────────────────────────────── */
.cat-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--navy-card);
  border-radius: 8px;
  border: 1px solid var(--gold-faint);
}
.cat-stat {
  text-align: center;
}
.cat-stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--gold);
}
.cat-stat-label {
  font-size: 11px;
  color: var(--ivory-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Schedule / Calendar grid ────────────────────────────── */
.sched-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sched-month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sched-month-picker input[type="month"] {
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
}
.sched-month-picker input[type="month"]:focus {
  border-color: var(--gold);
}
.sched-month-picker input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

.sched-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}
@media (max-width: 900px) {
  .sched-layout { grid-template-columns: 1fr; }
}

.sched-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sched-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--ivory-faint);
  text-transform: uppercase;
  padding: 8px 0;
  letter-spacing: 0.5px;
}
.sched-day {
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  border-radius: 6px;
  padding: 6px 8px;
  min-height: 80px;
  transition: all var(--fade);
  position: relative;
  cursor: default;
}
.sched-day:hover {
  border-color: var(--gold-soft);
}
.sched-day.empty {
  background: transparent;
  border-color: transparent;
}
.sched-day.locked {
  border-color: var(--gold);
  background: var(--gold-faint);
}
.sched-day-num {
  font-size: 11px;
  color: var(--ivory-faint);
  margin-bottom: 4px;
}
.sched-day-product {
  font-size: 11px;
  color: var(--ivory);
  line-height: 1.3;
  margin-bottom: 4px;
}
.sched-day-cat {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--gold-faint);
  color: var(--gold);
  display: inline-block;
}
.sched-day-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}
.sched-day-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--ivory-faint);
  padding: 2px;
  border-radius: 3px;
  transition: all var(--fade);
}
.sched-day-actions button:hover {
  background: var(--gold-faint);
  color: var(--gold);
}
.sched-day[draggable="true"] {
  cursor: grab;
}
.sched-day.drag-over {
  border-color: var(--gold);
  background: var(--gold-faint);
}

/* Distribution sidebar */
.sched-sidebar {
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  border-radius: 10px;
  padding: 16px;
}
.sched-sidebar h3 {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 12px;
}
.dist-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dist-bar-label {
  font-size: 11px;
  color: var(--ivory-faint);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dist-bar-track {
  flex: 1;
  height: 14px;
  background: var(--navy);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}
.dist-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 7px;
  transition: width 300ms ease;
}
.dist-bar-count {
  font-size: 10px;
  color: var(--ivory-faint);
  width: 30px;
  text-align: right;
}
.sched-coverage {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--gold-faint);
}
.sched-coverage-stat {
  font-size: 13px;
  color: var(--ivory-soft);
}
.sched-coverage-stat strong {
  color: var(--gold);
}
.sched-subcat-warning {
  margin-top: 8px;
  font-size: 11px;
  color: var(--amber);
}

/* ── Insights ────────────────────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 800px) {
  .insights-grid { grid-template-columns: 1fr; }
}
.insights-card {
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  border-radius: 10px;
  padding: 20px;
}
.insights-card h3 {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 16px;
}
.insights-card.full-width {
  grid-column: 1 / -1;
}

/* Donut chart */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}
.donut-svg {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ivory-soft);
}
.donut-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Heat map */
.heatmap-grid {
  display: grid;
  gap: 2px;
  overflow-x: auto;
}
.heatmap-cell {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--ivory-faint);
}
.heatmap-row {
  display: flex;
  gap: 2px;
  align-items: center;
}
.heatmap-label {
  font-size: 10px;
  color: var(--ivory-faint);
  width: 100px;
  text-align: right;
  padding-right: 8px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.heat-0 { background: var(--navy); }
.heat-1 { background: rgba(226,198,141,0.15); }
.heat-2 { background: rgba(226,198,141,0.30); }
.heat-3 { background: rgba(226,198,141,0.50); }
.heat-4 { background: rgba(226,198,141,0.70); }
.heat-5 { background: var(--gold); color: var(--navy); }

/* Histogram */
.histogram-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
}
.histogram-bar {
  flex: 1;
  background: var(--gold);
  border-radius: 3px 3px 0 0;
  min-width: 8px;
  transition: height 300ms ease;
  position: relative;
}
.histogram-bar:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--cream);
  white-space: nowrap;
  padding: 2px 6px;
  background: var(--navy-2);
  border-radius: 4px;
}
.histogram-labels {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.histogram-labels span {
  flex: 1;
  text-align: center;
  font-size: 9px;
  color: var(--ivory-faint);
}

/* Activity log */
.activity-log {
  max-height: 300px;
  overflow-y: auto;
}
.activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gold-faint);
  font-size: 12px;
}
.activity-row:last-child { border-bottom: none; }
.activity-action {
  color: var(--ivory-soft);
}
.activity-date {
  color: var(--ivory-faint);
  font-size: 11px;
}

/* Learnings list */
.learning-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gold-faint);
}
.learning-item:last-child { border-bottom: none; }
.learning-text {
  font-size: 12px;
  color: var(--ivory-soft);
  flex: 1;
}
.learning-disable {
  font-size: 11px;
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--sans);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--fade);
}
.learning-disable:hover {
  background: var(--red-soft);
}

/* Bible Health grid */
.bible-health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}
.bible-health-item {
  padding: 12px 8px;
  background: var(--navy);
  border-radius: 8px;
}
.bible-health-value {
  font-size: 28px;
  font-weight: 600;
}
.bible-health-label {
  font-size: 11px;
  color: var(--ivory-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}

/* ── Modal ───────────────────────────────────────────────── */
.cat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.cat-modal-overlay.open {
  display: flex;
}
.cat-modal {
  background: var(--navy-2);
  border: 1px solid var(--gold-soft);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
}
.cat-modal h2 {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 16px;
}
.cat-modal-field {
  margin-bottom: 12px;
}
.cat-modal-field label {
  display: block;
  font-size: 12px;
  color: var(--ivory-faint);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cat-modal-field input,
.cat-modal-field select,
.cat-modal-field textarea {
  width: 100%;
  background: var(--navy-card);
  border: 1px solid var(--gold-faint);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
}
.cat-modal-field input:focus,
.cat-modal-field select:focus,
.cat-modal-field textarea:focus {
  border-color: var(--gold);
}
.cat-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Swap candidates list */
.swap-list {
  max-height: 300px;
  overflow-y: auto;
}
.swap-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--gold-faint);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--fade);
}
.swap-item:hover {
  border-color: var(--gold);
  background: var(--gold-faint);
}
.swap-item-info {
  flex: 1;
}
.swap-item-name {
  font-size: 13px;
  color: var(--ivory);
}
.swap-item-meta {
  font-size: 11px;
  color: var(--ivory-faint);
}
.swap-item.already-scheduled {
  opacity: 0.4;
}

/* ── Loading + Empty states ──────────────────────────────── */
.cat-loading, .cat-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ivory-faint);
  font-size: 14px;
}
.cat-loading::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  border: 2px solid var(--gold-faint);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-faint); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-soft); }

/* ── Notification toast ──────────────────────────────────── */
.cat-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-card);
  border: 1px solid var(--gold);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 300ms ease;
}
.cat-toast.show {
  transform: translateY(0);
  opacity: 1;
}
