/* ═══════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════ */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --accent: #ff3c3c;
  --accent-glow: rgba(255, 60, 60, 0.25);
  --text: #ffffff;
  --text-muted: #666666;
  --text-dim: #999999;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Card dimensions — 9:16 at preview scale */
  --card-w: 405px;
  --card-h: 720px;
}

/* ═══════════════════════════════════════════
   RESET
═══════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 36px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 20px;
}

.header-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.header-link:hover {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   CONTROLS
═══════════════════════════════════════════ */
.controls-section {
  padding: 48px 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

.niche-select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 44px 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  min-width: 200px;
  transition: border-color 0.2s;
}

.niche-select:hover,
.niche-select:focus {
  border-color: var(--accent);
}

.niche-select option {
  background: #1a1a1a;
}

.generate-btn {
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 24px var(--accent-glow);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.generate-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(255, 60, 60, 0.4);
}

.generate-btn:active {
  transform: translateY(0);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.generate-btn.loading {
  cursor: wait;
}

.error-msg {
  font-size: 0.84rem;
  color: var(--accent);
  min-height: 20px;
  text-align: center;
  max-width: 480px;
}

/* ═══════════════════════════════════════════
   GLOBAL ACTIONS
═══════════════════════════════════════════ */
/* ─── GLOBAL ACTIONS ────────────────────────────────────────── */
.global-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.global-btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#dl-zip-btn {
  background: #2a2a35;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
#dl-zip-btn:hover:not(:disabled) {
  background: #3a3a45;
  border-color: rgba(255, 255, 255, 0.2);
}

.video-btn {
  background: linear-gradient(135deg, #ff3c3c, #cc0000);
  color: #ffffff;
}
.video-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 60, 60, 0.4);
}

.global-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── SLIDES DISPLAY ──────────────────────────────────────── */
.slides-section {
  padding: 8px 36px 80px;
}

.slides-strip {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 20px 4px 24px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.slides-strip::-webkit-scrollbar {
  height: 4px;
}

.slides-strip::-webkit-scrollbar-track {
  background: transparent;
}

.slides-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

.empty-state strong {
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════
   SLIDE CARD
═══════════════════════════════════════════ */
.slide-card-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.slide-card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface2);
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.slide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.85);
}

/* Pinterest image as background */
.card-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Fallback canvas background */
.card-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Dark scrim for text legibility */
.card-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scrim-top {
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.65) 22%,
      rgba(0, 0, 0, 0.08) 52%,
      rgba(0, 0, 0, 0) 100%);
}

.scrim-middle {
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0.08) 30%,
      rgba(0, 0, 0, 0.82) 44%,
      rgba(0, 0, 0, 0.82) 70%,
      rgba(0, 0, 0, 0.08) 84%,
      rgba(0, 0, 0, 0) 100%);
}

.scrim-bottom {
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.92) 0%,
      rgba(0, 0, 0, 0.72) 22%,
      rgba(0, 0, 0, 0.08) 52%,
      rgba(0, 0, 0, 0) 100%);
}

/* Text content layer */
.card-content {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px;
}

.content-top {
  top: 0;
}

.content-middle {
  top: 50%;
  transform: translateY(-50%);
}

.content-bottom {
  bottom: 0;
}

/* White pill label */
.card-pill {
  background: #ffffff;
  color: #000000;
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  padding: 8px 20px;
  border-radius: 100px;
  white-space: nowrap;
  max-width: 93%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Headline */
.card-headline {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.15;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.95), 0 1px 6px rgba(0, 0, 0, 0.85);
  letter-spacing: -0.03em;
}

/* Sub text */
.card-sub {
  font-family: var(--font);
  font-weight: 400;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.95);
}

/* Skeleton shimmer */
.slide-card.skeleton {
  background: var(--surface2);
  overflow: hidden;
}

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

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

  100% {
    transform: translateX(100%);
  }
}

.skeleton-label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════
   DOWNLOAD BUTTON
═══════════════════════════════════════════ */
.download-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  width: var(--card-w);
  justify-content: center;
}

.download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 60, 60, 0.08);
}

.download-btn:active {
  transform: scale(0.98);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 600px) {
  .header {
    padding: 14px 20px;
  }

  .brand-sub {
    display: none;
  }

  .controls-section {
    padding: 32px 20px 16px;
  }

  .slides-section {
    padding: 8px 0 60px;
  }

  .slides-strip {
    padding: 16px 20px 20px;
  }
}