/* Catalog download hub */
.catalog-hero {
  background: linear-gradient(135deg, #8868c9 0%, #6542a9 55%, #4e3287 100%);
  color: #fff;
  padding: 48px 0 40px;
  text-align: center;
}

.catalog-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 10px;
}

.catalog-hero p {
  opacity: 0.92;
  max-width: 620px;
  margin: 0 auto;
  font-size: 1rem;
}

.catalog-section {
  padding: 36px 0 60px;
}

.catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.catalog-tab {
  border: 1.5px solid #e7e7ef;
  background: #fff;
  color: #5a5f6b;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.dark-mode .catalog-tab {
  background: #1e1e1e;
  border-color: #333;
  color: #ccc;
}

.catalog-tab:hover,
.catalog-tab.active {
  border-color: #8868c9;
  background: linear-gradient(135deg, rgba(136, 104, 201, 0.12), rgba(101, 66, 169, 0.12));
  color: #6542a9;
}

body.dark-mode .catalog-tab.active {
  color: #c4b5fd;
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 16px 18px;
  background: #faf8ff;
  border: 1px solid #efe9fb;
  border-radius: 14px;
}

body.dark-mode .catalog-toolbar {
  background: #1e1e28;
  border-color: #333;
}

.catalog-toolbar-left,
.catalog-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.catalog-count {
  font-size: 0.88rem;
  color: #7a7f8c;
  font-weight: 600;
}

.catalog-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.catalog-btn-primary {
  background: linear-gradient(135deg, #8868c9, #6542a9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(101, 66, 169, 0.28);
}

.catalog-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(101, 66, 169, 0.38);
}

.catalog-btn-secondary {
  background: #fff;
  color: #6542a9;
  border: 1.5px solid #e0d4f5;
}

body.dark-mode .catalog-btn-secondary {
  background: #2a2a2a;
  border-color: #444;
  color: #c4b5fd;
}

.catalog-btn-ghost {
  background: transparent;
  color: #6542a9;
  border: 1.5px solid #d8c9f0;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.catalog-card {
  position: relative;
  border: 2px solid transparent;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

body.dark-mode .catalog-card {
  background: #1e1e1e;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.catalog-card.selected {
  border-color: #8868c9;
  box-shadow: 0 6px 22px rgba(136, 104, 201, 0.28);
}

.catalog-card-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 22px;
  height: 22px;
  accent-color: #8868c9;
  cursor: pointer;
}

.catalog-card-img-wrap {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #f5f5f8;
  cursor: pointer;
}

.catalog-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.catalog-card:hover .catalog-card-img-wrap img {
  transform: scale(1.04);
}

.catalog-card-body {
  padding: 12px 14px 14px;
}

.catalog-card-body h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: inherit;
}

.catalog-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.catalog-card-actions .catalog-btn {
  padding: 7px 10px;
  font-size: 0.75rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.catalog-empty {
  text-align: center;
  padding: 60px 20px;
  color: #7a7f8c;
}

/* Editor modal */
.catalog-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.catalog-editor-overlay.active {
  display: flex;
}

.catalog-editor-modal {
  background: #fff;
  border-radius: 16px;
  width: min(960px, 100%);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.dark-mode .catalog-editor-modal {
  background: #1a1a1a;
}

.catalog-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

body.dark-mode .catalog-editor-header {
  border-color: #333;
}

.catalog-editor-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.catalog-editor-canvas-wrap {
  background: #111;
  min-height: 360px;
  max-height: 60vh;
  overflow: hidden;
}

.catalog-editor-canvas-wrap img {
  max-width: 100%;
  display: block;
}

.catalog-editor-tools {
  padding: 16px;
  border-left: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

body.dark-mode .catalog-editor-tools {
  border-color: #333;
}

.catalog-editor-tools label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7a7f8c;
  margin-bottom: 4px;
}

.catalog-editor-tools input[type="range"] {
  width: 100%;
}

.catalog-editor-footer {
  padding: 14px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

body.dark-mode .catalog-editor-footer {
  border-color: #333;
}

@media (max-width: 768px) {
  .catalog-editor-body {
    grid-template-columns: 1fr;
  }
  .catalog-editor-tools {
    border-left: none;
    border-top: 1px solid #eee;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
