/* ── Color Palette Generator Page ─────────────────────────────────────────── */

.cpg-page {
  min-height: 100vh;
  background: var(--bg-primary);
  padding: 100px clamp(24px, 5vw, 64px) 80px;
}

/* ── Saved strip ────────────────────────────────────────────────────────────── */

.cpg-saved-strip {
  max-width: 900px;
  margin: 0 auto 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 20px 24px;
}

.cpg-saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cpg-saved-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cpg-clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.cpg-clear-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(240,246,252,0.2);
}

.cpg-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */

.cpg-hero {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}

.cpg-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.cpg-hero h1 .accent { color: var(--accent); }

.cpg-hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}

/* ── Base color input ──────────────────────────────────────────────────────── */

.cpg-base-color-row {
  margin-bottom: 24px;
}

.cpg-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cpg-color-picker {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.cpg-color-text {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  max-width: 200px;
}
.cpg-color-text::placeholder { color: var(--text-muted); }
.cpg-color-text:focus { border-color: var(--accent); }

.cpg-clear-color-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.cpg-clear-color-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(240,246,252,0.2);
}

/* ── Results ────────────────────────────────────────────────────────────────── */

.cpg-results {
  max-width: 900px;
  margin: 0 auto;
}

.cpg-results-header {
  margin-bottom: 24px;
}

.cpg-results-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cpg-results-sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Palettes grid ──────────────────────────────────────────────────────────── */

.cpg-palettes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* ── Palette card ───────────────────────────────────────────────────────────── */

.cpg-palette-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
  animation: cpg-fade-in 0.35s ease-out both;
  position: relative;
}

.cpg-palette-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.cpg-palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.cpg-palette-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cpg-scheme-badge {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: capitalize;
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Swatches ───────────────────────────────────────────────────────────────── */

.cpg-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.cpg-swatch {
  height: 80px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 4px;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.cpg-swatch:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  z-index: 1;
}

.cpg-swatch-hex {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
}

.cpg-swatch-label {
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-weight: 400;
  text-align: center;
  margin-top: 2px;
}

/* ── Palette actions ────────────────────────────────────────────────────────── */

.cpg-palette-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cpg-btn-copy-all,
.cpg-btn-save,
.cpg-btn-remove {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cpg-btn-copy-all:hover,
.cpg-btn-save:hover {
  border-color: var(--border-accent);
  color: var(--accent);
}

.cpg-btn-remove {
  color: #ef4444;
  border-color: rgba(239,68,68,0.3);
}
.cpg-btn-remove:hover {
  background: rgba(239,68,68,0.08);
}

.cpg-btn-use {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: auto;
  white-space: nowrap;
}
.cpg-btn-use:hover { background: var(--accent-hover); }

/* ── Copy toast ─────────────────────────────────────────────────────────────── */

.cpg-copy-toast {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
}

/* ── SEO content block ──────────────────────────────────────────────────────── */

.cpg-seo-content {
  max-width: 720px;
  margin: 80px auto 0;
  font-family: var(--font-body);
}

.cpg-seo-content h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

.cpg-seo-content h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 36px 0 12px;
}

.cpg-seo-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.cpg-seo-cta {
  text-align: center;
  margin: 56px 0 0;
  padding: 40px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.cpg-seo-cta p {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ── Animations ─────────────────────────────────────────────────────────────── */

@keyframes cpg-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cpg-palette-card:nth-child(1) { animation-delay: 0ms; }
.cpg-palette-card:nth-child(2) { animation-delay: 80ms; }
.cpg-palette-card:nth-child(3) { animation-delay: 160ms; }
.cpg-palette-card:nth-child(4) { animation-delay: 240ms; }
.cpg-palette-card:nth-child(5) { animation-delay: 320ms; }
.cpg-palette-card:nth-child(6) { animation-delay: 400ms; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .cpg-palettes-grid { grid-template-columns: 1fr; }
  .cpg-swatches { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .cpg-swatch { height: 64px; min-height: 64px; }
  .cpg-palette-actions { gap: 6px; flex-wrap: wrap; }
  .cpg-btn-copy-all { min-height: 44px; font-size: 0.85rem; }
  .cpg-btn-save, .cpg-btn-remove { min-height: 44px; }
  .cpg-btn-use { margin-left: 0; width: 100%; justify-content: center; min-height: 44px; }
  .cpg-base-color-row .ng-field-group { max-width: 100% !important; }
  .cpg-saved-grid { grid-template-columns: 1fr; }
  .cpg-btn-copy-all { width: 100%; }
  .cpg-swatch-hex { font-size: 0.6rem; }
  .cpg-form-card { padding: 20px; }
  .cpg-hero-sub { font-size: 1rem; }

  /* iOS: prevent zoom-on-focus — color text input must be 16px+ */
  .cpg-color-text { font-size: 1rem; }

  /* Generate button: 56px+ tap target (uses .ng-generate-btn class) */
  .ng-generate-btn { min-height: 56px; font-size: 1rem; }

  /* Color picker: larger touch target */
  .cpg-color-picker { width: 48px; height: 48px; }

  /* No horizontal overflow */
  .cpg-page { overflow-x: hidden; }
}

@media (max-width: 480px) {
  .cpg-swatches { gap: 3px; }
  .cpg-swatch { height: 56px; min-height: 56px; }
  .cpg-swatch-hex { font-size: 0.52rem; }
  .cpg-swatch-label { display: none; }
}

/* Mobile: saved palettes strip — snap scroll */
@media (max-width: 600px) {
  .cpg-saved-strip { padding: 16px; }
  .cpg-saved-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 8px; }
  .cpg-saved-grid > * { scroll-snap-align: start; flex: 0 0 280px; }
}

/* Sticky brand-kit CTA after results */
.ng-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-top: 1px solid var(--border-accent);
  padding: 12px 16px;
  display: none;
}

.ng-sticky-cta.visible { display: block; }

.ng-sticky-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 24px;
  height: 56px;
  border: none;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.ng-sticky-cta-btn:hover { background: var(--accent-hover); }

@media (min-width: 601px) {
  .ng-sticky-cta { display: none !important; }
}

/* ── Shareable Result Page ─────────────────────────────────────────────────── */

.cpg-share-row {
  display: flex;
  gap: 8px;
  max-width: 600px;
  margin: 24px auto 0;
  align-items: center;
}

.cpg-share-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  min-width: 0;
}

.cpg-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}

/* Swatch card on result page */
.cpg-swatch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  animation: fadeUp 0.4s ease both;
}

.cpg-swatch-large {
  width: 100%;
  height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cpg-swatch-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(0,0,0,0.15);
}

.cpg-swatch-large:hover .cpg-swatch-overlay { opacity: 1; }

.cpg-copy-hex-btn {
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.cpg-swatch-info {
  padding: 16px;
}

.cpg-swatch-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.cpg-swatch-hex-lg {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.cpg-swatch-formats { display: flex; flex-direction: column; gap: 6px; }

.cpg-format-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cpg-format-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 36px;
}

.cpg-format-value {
  font-family: 'DM Sans', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.cpg-mini-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
}

.cpg-result-cta {
  background: var(--accent);
  color: white;
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  margin-top: 48px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.cpg-result-cta h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
  margin: 0 0 12px;
}

.cpg-result-cta p {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  margin: 0 0 24px;
  font-family: 'DM Sans', sans-serif;
}
