/* ═══════════════════════════════════════════════════════════
   Step 3 — Curate the Welcome (collection_pick_clients)
   Per-widget CSS: OVERRIDES frozen collection_campaign.css
   to match Mockup v3 spec.

   Uses --cc-* tokens from collection_campaign.css.
   ═══════════════════════════════════════════════════════════ */

:root {
  --cpc-override: #7c3aed;
  --cpc-override-bg: #f5f0ff;
  --cpc-first-bg: #fff0f3;
  --cpc-first-accent: #e91e63;
}

/* ══════════════════════════════════════════════════════════
   TITLE — serif font per mockup v3
   ══════════════════════════════════════════════════════════ */
.cpc-pick-section .kb-pd-section-lbl {
  font-family: var(--cc-serif, 'Fraunces', Georgia, serif);
  font-size: 1.65rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--cc-navy, #1a1a2e);
  padding: 1rem 1rem 0.25rem;
}

/* ══════════════════════════════════════════════════════════
   STAT STRIP — cream bg, spacing, colored accents per mockup
   ══════════════════════════════════════════════════════════ */
.cpc-stats-strip {
  background: var(--cc-surface-sunken, #f8f7f2) !important;
}
.cpc-stat {
  padding: 0.85rem 1.25rem !important;
}
.cpc-stats-strip .cpc-stat:nth-child(1) .cpc-stat-value,
.cpc-stats-strip .cpc-stat:nth-child(1) .cpc-stat-value strong {
  color: var(--cc-gold, #c29954) !important;
  font-size: 1.2rem;
}
.cpc-stats-strip .cpc-stat:nth-child(2) .cpc-stat-value {
  color: var(--cpc-first-accent) !important;
}
.cpc-stats-strip .cpc-stat:nth-child(1) {
  background: linear-gradient(135deg, rgba(194,153,84,0.06), rgba(194,153,84,0.02));
}
.cpc-stats-strip .cpc-stat:nth-child(2) {
  background: linear-gradient(135deg, rgba(233,30,99,0.06), rgba(233,30,99,0.02));
}

/* ── Subtitle ── */
.cpc-subtitle {
  font-size: 0.8rem;
  color: var(--cc-text-muted, #6c757d);
  padding: 0.4rem 1rem 0.6rem;
  line-height: 1.5;
}
.cpc-subtitle strong {
  color: var(--cc-navy, #1a1a2e);
}

/* ══════════════════════════════════════════════════════════
   SECTION HEADER — "YOUR DISTRIBUTORS" row
   ══════════════════════════════════════════════════════════ */
.cpc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--cc-border, #e2e4e8);
}
.cpc-section-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cc-text-muted, #6c757d);
}
.cpc-section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.62rem;
}
.cpc-section-sep {
  color: var(--cc-border, #e2e4e8);
}
.cpc-settings-hint {
  color: var(--cc-text-muted, #6c757d);
}
.cpc-select-all-btn,
.cpc-hint-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cc-navy, #1a1a2e);
  padding: 0.3rem 0.5rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.cpc-select-all-btn:hover,
.cpc-hint-toggle:hover {
  color: var(--cc-gold, #c29954);
}
.cpc-select-all-btn:focus-visible,
.cpc-hint-toggle:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════
   TABLE — neutral header bg, column widths
   ══════════════════════════════════════════════════════════ */
.cpc-table thead th {
  background: #f5f5f5 !important;
}
.cpc-th-deadline { width: 100px; }
.cpc-th-lang     { min-width: 100px; }
.cpc-th-delivery { min-width: 130px; }
.cpc-th-tune     { width: 52px; text-align: center; }

/* ── Channel pills — ensure full text visible ── */
.cpc-ch-pill {
  padding: 2px 8px;
  white-space: nowrap;
}

/* ── Tune column — ensure gear not clipped ── */
.cpc-td-tune {
  text-align: center;
  width: 52px;
  min-width: 52px;
}

/* ── Tune button — visible gear on every row ── */
.cpc-tune-btn {
  background: none;
  border: 1px solid var(--cc-border, #e2e4e8);
  border-radius: var(--cc-radius-sm, 6px);
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--cc-text-muted, #6c757d);
  padding: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cpc-tune-btn:hover {
  background: var(--cc-surface-sunken, #f4f5f7);
  border-color: var(--cc-navy, #1a1a2e);
  color: var(--cc-navy, #1a1a2e);
}
.cpc-tune-btn:active {
  background: var(--cc-border, #e2e4e8);
}
.cpc-tune-btn:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}

/* Ensure tune column cells are centered */
.cpc-td-tune {
  text-align: center;
  width: 52px;
}

/* ══════════════════════════════════════════════════════════
   OVERRIDE HIGHLIGHTING (purple per spec)
   ══════════════════════════════════════════════════════════ */
.cpc-override-val {
  color: var(--cpc-override);
  font-weight: 600;
}
.cpc-override-tag {
  font-size: 0.58rem;
  color: var(--cpc-override);
  font-weight: 500;
  opacity: 0.8;
  margin-left: 0.2rem;
}

/* ══════════════════════════════════════════════════════════
   FIRST-COLLECTION ROW — pink per spec (overrides frozen gold)
   ══════════════════════════════════════════════════════════ */
.cpc-trow.cpc-row-first {
  background: var(--cpc-first-bg) !important;
}
.cpc-trow.cpc-row-first td:first-child {
  border-left: 3px solid var(--cpc-first-accent);
  padding-left: calc(0.75rem - 3px);
}
.cpc-badge-first {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--cpc-first-accent);
  color: white;
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  margin-left: 0.4rem;
  white-space: nowrap;
  vertical-align: middle;
}
.cpc-first-val {
  color: var(--cpc-first-accent);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════
   HINT ROWS (narrative descriptions, hidden by default)
   ══════════════════════════════════════════════════════════ */
.cpc-hint-row td {
  padding-top: 0 !important;
  padding-bottom: 0.4rem !important;
}
.cpc-hint-text {
  font-size: 0.72rem;
  color: var(--cc-text-muted, #6c757d);
  font-style: italic;
  padding-left: 2.5rem;
}

/* ══════════════════════════════════════════════════════════
   TUNE MODAL — per-distributor settings
   ══════════════════════════════════════════════════════════ */
.cpc-tune-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpc-tune-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}
.cpc-tune-dialog {
  position: relative;
  background: var(--cc-card, #ffffff);
  border-radius: var(--cc-radius-md, 12px);
  box-shadow: var(--cc-shadow-lg, 0 4px 16px rgba(0,0,0,0.12));
  width: 420px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: cpc-tune-in 0.2s ease-out;
}
@keyframes cpc-tune-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cpc-tune-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--cc-border, #e2e4e8);
}
.cpc-tune-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cc-navy, #1a1a2e);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cpc-tune-icon { font-size: 1.1rem; }
.cpc-tune-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cc-text-muted, #6c757d);
  border-radius: var(--cc-radius-sm, 6px);
  transition: background 0.15s;
}
.cpc-tune-close:hover { background: var(--cc-surface-sunken, #f4f5f7); }
.cpc-tune-close:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}
.cpc-tune-name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: var(--cc-surface-sunken, #f8f9fb);
}
.cpc-tune-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}
.cpc-tune-dist-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cc-navy, #1a1a2e);
}
.cpc-tune-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cpc-tune-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cpc-tune-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cc-text-muted, #6c757d);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cpc-tune-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cpc-first-accent);
}
.cpc-tune-field-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.cpc-tune-input,
.cpc-tune-select,
.cpc-tune-textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--cc-border, #e2e4e8);
  border-radius: var(--cc-radius-sm, 6px);
  font-size: 0.82rem;
  color: var(--cc-text, #2d2d3a);
  background: white;
  min-height: 44px;
}
.cpc-tune-input:focus,
.cpc-tune-select:focus,
.cpc-tune-textarea:focus {
  outline: none;
  border-color: var(--cc-navy, #1a1a2e);
  box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.12);
}
.cpc-tune-input:focus-visible,
.cpc-tune-select:focus-visible,
.cpc-tune-textarea:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}
.cpc-tune-clear-btn {
  background: none;
  border: 1px solid var(--cc-border, #e2e4e8);
  border-radius: var(--cc-radius-sm, 6px);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--cc-text-muted, #6c757d);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}
.cpc-tune-clear-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.cpc-tune-clear-btn:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}
.cpc-tune-help {
  font-size: 0.68rem;
  color: var(--cc-text-muted, #6c757d);
}
.cpc-tune-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cpc-tune-ch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--cc-border, #e2e4e8);
  border-radius: var(--cc-radius-sm, 6px);
  min-height: 44px;
  transition: background 0.15s, border-color 0.15s;
}
.cpc-tune-ch-label:hover {
  background: var(--cc-surface-sunken, #f8f9fb);
}
.cpc-tune-ch-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cc-navy, #1a1a2e);
}
.cpc-tune-ch-label:has(input:checked) {
  background: #e8f0fe;
  border-color: #1a73e8;
}
.cpc-tune-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--cc-border, #e2e4e8);
}

/* Tune modal buttons */
.cpc-tune-footer .cpc-btn {
  min-height: 44px;
  padding: 0.55rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--cc-radius-sm, 6px);
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.cpc-tune-footer .cpc-btn-confirm {
  background: var(--cc-emerald, #10B981);
  color: white;
}
.cpc-tune-footer .cpc-btn-confirm:hover { background: #059669; }
.cpc-tune-footer .cpc-btn-confirm:active { background: #047857; }
.cpc-tune-footer .cpc-btn-confirm:focus-visible {
  outline: 2px solid var(--cc-emerald, #10B981);
  outline-offset: 2px;
}
.cpc-tune-footer .cpc-btn-confirm:disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.cpc-tune-footer .cpc-btn-ghost {
  background: white;
  color: var(--cc-navy, #1a1a2e);
  border: 1px solid var(--cc-border, #e2e4e8);
}
.cpc-tune-footer .cpc-btn-ghost:hover {
  background: var(--cc-surface-sunken, #f4f5f7);
  border-color: var(--cc-navy, #1a1a2e);
}
.cpc-tune-footer .cpc-btn-ghost:active {
  background: var(--cc-border, #e2e4e8);
}
.cpc-tune-footer .cpc-btn-ghost:focus-visible {
  outline: 2px solid var(--cc-navy, #1a1a2e);
  outline-offset: 2px;
}

/* ── Saving state ── */
.cpc-tune-saving {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Hide old tab row and launch panel (shell handles them now) ── */
.cpc-tab-row { display: none; }
.cpc-launch-panel { display: none; }

/* ══════════════════════════════════════════════════════════
   HONORARY SECTION — template pills
   ══════════════════════════════════════════════════════════ */
.cpc-template-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 600;
  background: #fdf6ec;
  color: #96722e;
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid #e9d8b4;
}
.cpc-template-pill:hover {
  background: #f5eedd;
  border-color: var(--cc-gold, #c29954);
  color: #6b4f1a;
}
.cpc-template-pill.active,
.cpc-template-pill.cpc-template-pill--active {
  background: var(--cc-navy, #1a1a2e);
  color: white;
  border-color: var(--cc-navy, #1a1a2e);
}
.cpc-templates-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cc-text-muted, #6c757d);
  margin-right: 0.3rem;
}

/* ══════════════════════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cpc-tune-dialog {
    animation-duration: 0.01ms !important;
  }
  .cpc-tune-btn,
  .cpc-tune-close,
  .cpc-tune-footer .cpc-btn,
  .cpc-tune-ch-label,
  .cpc-tune-clear-btn,
  .cpc-select-all-btn,
  .cpc-hint-toggle,
  .cpc-template-pill {
    transition-duration: 0.01ms !important;
  }
}
