/* ═══════════════════════════════════════════════════════════════
   ColorPalette — style.css
   Premium glassmorphism UI with subtle animations
═══════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─── */
:root {
  /* Dark theme (default) */
  --cp-bg: #0a0a0f;
  --cp-bg-card: rgba(255, 255, 255, 0.04);
  --cp-bg-card-hover: rgba(255, 255, 255, 0.07);
  --cp-border: rgba(255, 255, 255, 0.08);
  --cp-border-hover: rgba(255, 255, 255, 0.18);
  --cp-text: #f0eee8;
  --cp-text-muted: rgba(240, 238, 232, 0.5);
  --cp-accent: #c9a96e;
  --cp-accent-glow: rgba(201, 169, 110, 0.2);
  --cp-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --cp-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --cp-glass-blur: blur(20px);

  /* Dynamic accent (changes with palette) */
  --palette-accent-1: #c9a96e;
  --palette-accent-2: #8b6cc4;
  --palette-accent-3: #4ecdc4;

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 450ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light theme */
html.light {
  --cp-bg: #f4f1eb;
  --cp-bg-card: rgba(255, 255, 255, 0.7);
  --cp-bg-card-hover: rgba(255, 255, 255, 0.9);
  --cp-border: rgba(0, 0, 0, 0.08);
  --cp-border-hover: rgba(0, 0, 0, 0.18);
  --cp-text: #1a1814;
  --cp-text-muted: rgba(26, 24, 20, 0.5);
  --cp-accent: #8b6cc4;
  --cp-accent-glow: rgba(139, 108, 196, 0.15);
  --cp-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  --cp-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--cp-bg);
  color: var(--cp-text);
  font-family: 'DM Sans', sans-serif;
  transition: background-color 0.5s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dynamic background tint */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, var(--palette-accent-1) 0%, transparent 70%);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  transition: background 1s ease, opacity 0.5s ease;
}

/* ─── Typography ─── */
.font-display { font-family: 'Cormorant Garamond', serif; }
.font-mono { font-family: 'DM Mono', monospace; }

/* ─── Header ─── */
.cp-header {
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: var(--cp-glass-blur);
  -webkit-backdrop-filter: var(--cp-glass-blur);
  border-bottom: 1px solid var(--cp-border);
  transition: background 0.5s ease, border-color 0.3s ease;
}

html.light .cp-header {
  background: rgba(244, 241, 235, 0.7);
}

.cp-logo-text {
  background: linear-gradient(135deg, var(--cp-text) 0%, var(--cp-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-mark {
  background: linear-gradient(135deg, var(--palette-accent-1), var(--palette-accent-2));
  transition: background 1s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.logo-swatch-a {
  background: inherit;
}

/* ─── Icon Buttons ─── */
.cp-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--cp-border);
  background: var(--cp-bg-card);
  color: var(--cp-text);
  cursor: pointer;
  transition: all var(--t-base);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.cp-icon-btn:hover {
  border-color: var(--cp-border-hover);
  background: var(--cp-bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.cp-icon-btn:active { transform: translateY(0) scale(0.95); }

/* ─── Hero Section ─── */
.hero-section {
  position: relative;
}

.hero-glow {
  background: radial-gradient(ellipse 60% 40% at 50% 80%, var(--palette-accent-1) 0%, transparent 70%);
  opacity: 0.08;
  transition: background 1s ease;
}

.hero-eyebrow {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.1s;
}

.hero-title {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.2s;
  color: var(--cp-text);
  line-height: 0.92;
  letter-spacing: -0.02em;
}

.hero-title em {
  color: var(--cp-accent);
  transition: color 0.8s ease;
}

.hero-subtitle {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.3s;
}

/* ─── Primary Button ─── */
.cp-btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--palette-accent-1), var(--palette-accent-2));
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all var(--t-base);
  overflow: hidden;
  box-shadow: 0 8px 32px var(--cp-accent-glow), 0 2px 8px rgba(0,0,0,0.3);
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.4s;
}

.cp-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 48px var(--cp-accent-glow), 0 4px 12px rgba(0,0,0,0.3);
}

.cp-btn-primary:active { transform: scale(0.97); }

.btn-icon {
  display: inline-block;
  animation: spin-slow 4s linear infinite;
  font-size: 0.75rem;
}

.btn-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 2.5s ease-in-out infinite;
}

/* ─── Ghost Button ─── */
.cp-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  background: var(--cp-bg-card);
  color: var(--cp-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  border-radius: 14px;
  border: 1px solid var(--cp-border);
  cursor: pointer;
  transition: all var(--t-base);
  backdrop-filter: blur(8px);
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.45s;
}

.cp-btn-ghost:hover {
  border-color: var(--cp-border-hover);
  background: var(--cp-bg-card-hover);
  transform: translateY(-1px);
}

/* ─── Palette Bar ─── */
.palette-bar {
  min-height: 100px;
  transition: all var(--t-slow);
}

.palette-swatch {
  flex: 1;
  min-height: 100px;
  position: relative;
  cursor: pointer;
  transition: flex var(--t-bounce), filter var(--t-fast);
  overflow: hidden;
}

.palette-swatch:hover {
  flex: 1.6;
  z-index: 1;
}

.palette-swatch:hover .swatch-info {
  opacity: 1;
  transform: translateY(0);
}

.swatch-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--t-base);
}

.swatch-name {
  display: block;
  font-size: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  color: white;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.swatch-hex {
  display: block;
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  margin-top: 2px;
}

.swatch-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--t-fast);
  cursor: pointer;
  color: white;
}

.palette-swatch:hover .swatch-copy-btn { opacity: 1; }
.swatch-copy-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }

/* ─── Glass Cards ─── */
.cp-card {
  background: var(--cp-bg-card);
  backdrop-filter: var(--cp-glass-blur);
  -webkit-backdrop-filter: var(--cp-glass-blur);
  border: 1px solid var(--cp-border);
  border-radius: 20px;
  padding: 20px;
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  position: relative;
  overflow: hidden;
}

.cp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

.cp-card:hover {
  border-color: var(--cp-border-hover);
  box-shadow: var(--cp-shadow);
}

.cp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.cp-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--cp-text);
}

.cp-badge {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-accent);
  border: 1px solid var(--cp-accent);
  border-radius: 6px;
  padding: 2px 8px;
  opacity: 0.8;
  white-space: nowrap;
}

/* ─── Tabs ─── */
.cp-tab {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  font-weight: 400;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cp-text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: 0.05em;
}

.cp-tab:hover {
  color: var(--cp-text);
  border-color: var(--cp-border);
}

.cp-tab.active {
  background: var(--cp-accent);
  color: white;
  border-color: transparent;
}

/* ─── Label ─── */
.cp-label {
  display: block;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cp-text-muted);
  margin-bottom: 6px;
}

/* ─── Spectrum Cursor ─── */
.spectrum-cursor {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  transition: box-shadow var(--t-fast);
  z-index: 10;
}

/* ─── Hue Thumb ─── */
.hue-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  z-index: 10;
}

/* ─── Color Inputs ─── */
.color-inputs {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.preview-swatch-container {
  flex-shrink: 0;
}

.color-preview-swatch {
  width: 60px;
  height: 60px;
  border: 1px solid var(--cp-border);
  transition: background-color var(--t-base), transform var(--t-fast), box-shadow var(--t-base);
  cursor: pointer;
}

.color-preview-swatch:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.cp-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--cp-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text);
  transition: all var(--t-fast);
  outline: none;
}

html.light .cp-input {
  background: rgba(0,0,0,0.04);
}

.cp-input:focus {
  border-color: var(--cp-accent);
  background: var(--cp-bg-card-hover);
  box-shadow: 0 0 0 3px var(--cp-accent-glow);
}

.cp-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cp-input-label {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text-muted);
  min-width: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─── Mood Grid ─── */
.mood-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-bounce);
  border: 1px solid var(--cp-border);
  aspect-ratio: 4/3;
}

.mood-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--cp-border-hover);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.mood-card:active { transform: scale(0.97); }

.mood-swatches {
  display: flex;
  height: 65%;
  width: 100%;
}

.mood-swatch-mini {
  flex: 1;
  height: 100%;
  transition: flex var(--t-base);
}

.mood-card:hover .mood-swatch-mini { }

.mood-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: rgba(10,10,15,0.7);
  backdrop-filter: blur(8px);
  font-size: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  text-align: center;
}

html.light .mood-label {
  background: rgba(244,241,235,0.8);
  color: var(--cp-text);
}

/* ─── Color Library ─── */
.library-group-title {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cp-text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--cp-border);
}

.library-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}

.lib-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--t-bounce);
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}

.lib-swatch:hover {
  transform: scale(1.3) translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  z-index: 10;
  border-radius: 10px;
}

.lib-swatch:active { transform: scale(1.0); }

/* ─── Search Input ─── */
.cp-search-input {
  background: var(--cp-bg-card);
  border: 1px solid var(--cp-border);
  border-radius: 10px;
  padding: 6px 8px 6px 28px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--cp-text);
  outline: none;
  width: 160px;
  transition: all var(--t-fast);
}

.cp-search-input:focus {
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 3px var(--cp-accent-glow);
  width: 180px;
}

.cp-search-input::placeholder { color: var(--cp-text-muted); }

/* ─── Action Button ─── */
.cp-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--cp-bg-card);
  border: 1px solid var(--cp-border);
  border-radius: 10px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--cp-text);
  cursor: pointer;
  transition: all var(--t-fast);
}

.cp-action-btn:hover {
  border-color: var(--cp-border-hover);
  background: var(--cp-bg-card-hover);
  transform: translateY(-1px);
}

.cp-action-btn:active { transform: scale(0.95); }

/* ─── Export Buttons ─── */
.cp-export-btn {
  padding: 10px 12px;
  background: var(--cp-bg-card);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text);
  cursor: pointer;
  transition: all var(--t-base);
  text-align: center;
  letter-spacing: 0.05em;
}

.cp-export-btn:hover {
  border-color: var(--cp-accent);
  color: var(--cp-accent);
  background: var(--cp-accent-glow);
  transform: translateY(-1px);
}

/* ─── Code Block ─── */
.cp-code-block {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  padding: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--cp-text);
  line-height: 1.6;
  white-space: pre;
}

html.light .cp-code-block {
  background: rgba(0,0,0,0.06);
}

/* ─── Preview Container ─── */
.preview-container {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

html.light .preview-container {
  background: rgba(0,0,0,0.06);
}

/* Card Preview */
.preview-card {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.preview-card-header {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.preview-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.preview-card-text-a {
  height: 10px;
  border-radius: 5px;
  width: 100px;
}

.preview-card-text-b {
  height: 7px;
  border-radius: 4px;
  width: 65px;
  margin-top: 6px;
  opacity: 0.6;
}

.preview-card-body {
  padding: 20px;
}

.preview-card-btn {
  height: 32px;
  border-radius: 8px;
  width: 90px;
  display: inline-block;
  margin-top: 12px;
}

/* Phone Preview */
.preview-phone {
  width: 140px;
  height: 280px;
  border-radius: 24px;
  border: 3px solid rgba(255,255,255,0.15);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.08);
  position: relative;
  margin: 16px auto;
}

.preview-phone-notch {
  width: 50px;
  height: 8px;
  background: rgba(0,0,0,0.4);
  border-radius: 0 0 8px 8px;
  margin: 0 auto;
}

.preview-phone-screen {
  width: 100%;
  height: calc(100% - 8px);
  display: flex;
  flex-direction: column;
}

/* Poster Preview */
.preview-poster {
  width: 100%;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ─── Toast ─── */
.cp-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid var(--cp-border-hover);
  border-radius: 40px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--cp-text);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  pointer-events: none;
  animation: toastIn 0.4s var(--t-bounce) both;
  white-space: nowrap;
}

html.light .cp-toast {
  background: rgba(244,241,235,0.95);
}

.cp-toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── History / Favorites Items ─── */
.palette-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1px solid transparent;
}

.palette-history-item:hover {
  background: var(--cp-bg-card-hover);
  border-color: var(--cp-border);
}

.history-swatches {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  width: 80px;
  height: 28px;
  flex-shrink: 0;
}

.history-swatch {
  flex: 1;
}

.history-meta {
  flex: 1;
  min-width: 0;
}

.history-name {
  font-size: 12px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text-muted);
  margin-top: 1px;
}

.history-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.palette-history-item:hover .history-actions { opacity: 1; }

.history-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--cp-border);
  color: var(--cp-text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 10px;
}

.history-action-btn:hover {
  color: var(--cp-accent);
  border-color: var(--cp-accent);
}

/* ─── Scrollbar ─── */
.cp-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--cp-border) transparent;
}

.cp-scrollbar::-webkit-scrollbar { width: 4px; }
.cp-scrollbar::-webkit-scrollbar-track { background: transparent; }
.cp-scrollbar::-webkit-scrollbar-thumb { background: var(--cp-border); border-radius: 2px; }

/* ─── Modal ─── */
.cp-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cp-modal.hidden { display: none; }

.cp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.cp-modal-content {
  position: relative;
  z-index: 10;
  background: var(--cp-bg);
  border: 1px solid var(--cp-border-hover);
  border-radius: 24px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
  animation: modalIn 0.4s var(--t-bounce) both;
  box-shadow: var(--cp-shadow-lg);
}

.cp-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--cp-bg-card);
  border: 1px solid var(--cp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--cp-text-muted);
  transition: all var(--t-fast);
}

.cp-modal-close:hover {
  color: var(--cp-text);
  border-color: var(--cp-border-hover);
}

.modal-swatch {
  height: 120px;
  transition: background-color var(--t-base);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--cp-bg-card);
  border: 1px solid var(--cp-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.modal-value-row:hover {
  border-color: var(--cp-accent);
  background: var(--cp-accent-glow);
}

.modal-value-label {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-value-text {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--cp-text);
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -100% center; }
  100% { background-position: 200% center; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes paletteReveal {
  from { opacity: 0; transform: scaleX(0.8); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes swatchPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.swatch-pop {
  animation: swatchPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* ─── Ripple effect ─── */
.ripple-container { position: relative; overflow: hidden; }

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ─── Utilities ─── */
.w-4\.5 { width: 1.125rem; }
.h-4\.5 { height: 1.125rem; }

/* Palette entry animation */
#palette-bar {
  animation: paletteReveal 0.5s ease both;
}

/* Particle canvas */
#particle-canvas {
  opacity: 0.4;
}

/* Active favorite button */
.btn-favorited svg { fill: #e84393; stroke: #e84393; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .hero-title { font-size: 3.5rem; }
  .palette-swatch { min-height: 72px; }
  .cp-search-input { width: 130px; }
  .cp-search-input:focus { width: 150px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2.8rem; }
  .cp-card { padding: 16px; }
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* Fix Mobile Scrolling */
html, body {
  height: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* مهم جداً للسلاسة على iOS */
}

body {
  position: relative;
  overflow-y: auto !important; /* السماح بالتمرير العمودي */
}

/* تأكد أن المحتوى الرئيسي يمكن تمريره */
main#workspace {
  position: relative;
  z-index: 10;
  overflow-y: visible;
}

/* إصلاح الـ fixed header على الموبايل */
.cp-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

/* تجنب أي overflow مخفي يمنع الـ scroll */
#particle-canvas {
  pointer-events: none;
  z-index: 0;
}