/* ==========================================================================
   DOSU PAINT COLOR PICKER PAGE - colors.css (PREMIUM LIGHT THEME)
   ========================================================================== */

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

:root {
  /* DOSU Brand Gold Palette */
  --gold-primary: #c9952a;
  --gold-light: #f0c060;
  --gold-dark: #8a6318;
  --gold-accent: #d97706;
  --gold-soft: #fef9ee;

  /* Modern Clean Light Theme */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card2: #f1f5f9;

  /* Subtle Crisp Borders */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-gold: rgba(201, 149, 42, 0.45);

  /* High Contrast Accessible Typography */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, select {
  font-family: inherit;
}

/* Custom Scrollbar for Light Theme */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.gradient-text {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.cp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.25rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.cp-header-inner {
  max-width: 1360px;
  margin: 0 auto;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.cp-back-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.cp-back-btn:hover {
  color: var(--gold-dark);
  border-color: var(--gold-primary);
  background: var(--gold-soft);
  transform: translateX(-2px);
}

.cp-header-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.cp-header-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(201, 149, 42, 0.25);
}

.cp-header-title h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-header-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   LAYOUT & CONTAINER (Fix margin & right side clearance)
   ========================================================================== */
.cp-layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.25rem 7.5rem 1.25rem;
  box-sizing: border-box;
  transition: padding-right 0.35s ease;
}

@media (min-width: 768px) {
  .cp-layout {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 900px) {
  .cp-layout {
    /* Đảm bảo lề phải luôn rộng rãi, không bị che bởi thanh điều khiển bên phải */
    padding-right: 80px;
  }
  .cp-layout.panel-open {
    padding-right: 325px;
  }
}

/* ==========================================================================
   SEARCH BAR
   ========================================================================== */
.cp-search-wrap {
  padding: 1.2rem 0 0.5rem;
}

.cp-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.cp-search-icon {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.cp-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0.85rem 2.85rem 0.85rem 2.85rem;
  color: var(--text-primary);
  font-size: 0.96rem;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.cp-search-input::placeholder {
  color: #94a3b8;
}

.cp-search-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(201, 149, 42, 0.15);
  background: #ffffff;
}

.cp-search-clear {
  position: absolute;
  right: 0.9rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  display: none;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.cp-search-clear:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}

.cp-search-clear.visible {
  display: flex;
}

/* ==========================================================================
   GROUP PILLS (Tất Cả, Trung Tính, Đỏ, Xám, Xanh Dương...)
   ========================================================================== */
.cp-groups-wrap {
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.75rem 0 0.5rem;
}

.cp-groups-wrap::-webkit-scrollbar {
  display: none;
}

.cp-groups-track {
  display: flex;
  gap: 0.5rem;
  width: max-content;
}

.cp-group-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.95rem;
  border-radius: 30px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  user-select: none;
}

.cp-group-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: #f8fafc;
  transform: translateY(-1px);
}

.cp-group-pill.active {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(201, 149, 42, 0.35);
}

.cp-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.cp-group-count {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cp-group-pill.active .cp-group-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ==========================================================================
   FILTER TAGS & SORT DROPDOWN
   ========================================================================== */
.cp-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0 0.75rem;
  flex-wrap: wrap;
}

.cp-filter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-right: 0.2rem;
}

.cp-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.85rem;
  border-radius: 20px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.cp-filter-tag:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: #f8fafc;
}

.cp-filter-tag.active {
  background: #fef3c7;
  border-color: var(--gold-primary);
  color: #92400e;
  font-weight: 700;
}

.cp-sort-select {
  margin-left: auto;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.7rem;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.cp-sort-select:focus {
  border-color: var(--gold-primary);
}

/* ==========================================================================
   RESULTS INFO
   ========================================================================== */
.cp-results-info {
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 0.2rem 0 0.75rem;
}

.cp-results-info strong {
  color: var(--gold-dark);
  font-weight: 700;
}

/* ==========================================================================
   SWATCHES GRID & CARDS
   ========================================================================== */
.cp-swatches-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

@media (min-width: 480px) { .cp-swatches-grid { grid-template-columns: repeat(4, 1fr); gap: 0.85rem; } }
@media (min-width: 680px) { .cp-swatches-grid { grid-template-columns: repeat(5, 1fr); gap: 0.95rem; } }
@media (min-width: 900px) { .cp-swatches-grid { grid-template-columns: repeat(6, 1fr); gap: 1rem; } }
@media (min-width: 1100px) { .cp-swatches-grid { grid-template-columns: repeat(7, 1fr); gap: 1.1rem; } }
@media (min-width: 1300px) { .cp-swatches-grid { grid-template-columns: repeat(8, 1fr); gap: 1.15rem; } }

.cp-swatch-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.cp-swatch-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  border-color: var(--border-strong);
}

.cp-swatch-card.active {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2.5px var(--gold-primary), 0 8px 24px rgba(201, 149, 42, 0.25);
}

.cp-swatch-disc {
  width: 100%;
  aspect-ratio: 1;
  transition: filter 0.2s;
  /* Viền mờ nhẹ bên trong để các màu sơn trắng/sáng không bị chìm vào nền thẻ trắng */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.cp-swatch-card:hover .cp-swatch-disc {
  filter: brightness(1.05);
}

.cp-swatch-info {
  padding: 0.5rem 0.55rem 0.55rem;
  background: #ffffff;
}

.cp-swatch-code {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-swatch-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.cp-swatch-hex {
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 0.1rem;
  text-transform: uppercase;
  font-family: monospace;
}

.cp-swatch-fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
  cursor: pointer;
}

.cp-swatch-card:hover .cp-swatch-fav-btn,
.cp-swatch-fav-btn.active {
  opacity: 1;
}

.cp-swatch-fav-btn:hover {
  transform: scale(1.1);
}

.cp-swatch-fav-btn.active {
  color: #ef4444;
  border-color: #fecaca;
  background: #ffffff;
}

/* Empty state */
.cp-empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 1rem;
}

.cp-empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: #cbd5e1;
}

.cp-empty-state h3 {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

/* ==========================================================================
   LOAD MORE BUTTONS
   ========================================================================== */
.cp-load-more-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.cp-btn-load {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.cp-btn-load-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(201, 149, 42, 0.3);
}

.cp-btn-load-primary:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(201, 149, 42, 0.4);
}

.cp-btn-load-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-subtle);
}

.cp-btn-load-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: #f8fafc;
}

/* ==========================================================================
   ACTIVE COLOR PANEL (Mobile Bottom Sheet & Desktop Sidebar)
   ========================================================================== */
.cp-active-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 2.5px solid var(--gold-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.12);
  transform: translateY(calc(100% - 72px));
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.cp-active-panel.expanded {
  transform: translateY(0);
}

.cp-panel-handle {
  padding: 0.75rem 1.25rem 0.65rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
}

.cp-panel-handle-bar {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin: 0 auto 0.6rem;
  display: block;
}

.cp-panel-mini {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.cp-panel-mini-swatch {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.cp-panel-mini-code {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.cp-panel-mini-hex {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: monospace;
}

.cp-panel-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.cp-active-panel.expanded .cp-panel-toggle i {
  transform: rotate(180deg);
}

.cp-panel-toggle i {
  transition: transform 0.3s ease;
}

.cp-panel-body {
  padding: 0 1.25rem 1.75rem;
}

.cp-panel-swatch-large {
  width: 100%;
  height: 135px;
  border-radius: var(--radius-md);
  margin-bottom: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
}

.cp-panel-name {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
}

.cp-panel-specs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cp-spec {
  flex: 1;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.55rem;
  text-align: center;
}

.cp-spec-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.cp-spec-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: monospace;
}

.cp-panel-harmony-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cp-panel-harmony-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.cp-harmony-chip {
  flex: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s;
}

.cp-harmony-chip:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.cp-harmony-color {
  height: 44px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.cp-harmony-text {
  background: #f8fafc;
  padding: 0.3rem 0.35rem;
  font-size: 0.66rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.35;
}

.cp-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.cp-panel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  border: 1.5px solid var(--border-subtle);
  transition: all 0.2s ease;
  cursor: pointer;
}

.cp-panel-btn-copy {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  color: #ffffff;
  border: none;
  grid-column: 1/-1;
  box-shadow: 0 4px 14px rgba(201, 149, 42, 0.3);
}

.cp-panel-btn-copy:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.cp-panel-btn-fav {
  background: #f8fafc;
  color: var(--text-secondary);
}

.cp-panel-btn-fav.active {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

.cp-panel-btn-fav:hover {
  border-color: #fca5a5;
  color: #ef4444;
}

.cp-panel-btn-consult {
  background: #f8fafc;
  color: var(--text-secondary);
}

.cp-panel-btn-consult:hover {
  border-color: var(--gold-primary);
  color: #92400e;
  background: #fef3c7;
}

/* ==========================================================================
   DESKTOP SIDEBAR PANEL (Width 320px fixed, slide-in)
   ========================================================================== */
.cp-panel-tab-btn,
.cp-panel-close-btn {
  display: none;
}

@media (min-width: 900px) {
  .cp-active-panel {
    position: fixed;
    top: 62px;
    right: 0;
    bottom: 0;
    left: auto;
    width: 320px;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-top: none;
    border-left: 2.5px solid var(--gold-primary);
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.1);
    transform: translateX(100%); /* Completely hidden off-screen when collapsed - no sliced text */
    overflow: visible;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .cp-active-panel.expanded {
    transform: translateX(0);
  }

  .cp-panel-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: absolute;
    left: -44px;
    top: 30px;
    width: 44px;
    height: 92px;
    background: #ffffff;
    border: 1.5px solid var(--border-subtle);
    border-right: none;
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 4px 14px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    z-index: 10;
  }

  .cp-panel-tab-btn:hover {
    background: var(--gold-soft);
    color: var(--gold-dark);
  }

  .cp-panel-tab-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  }

  .cp-panel-tab-icon {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
  }

  .cp-active-panel.expanded .cp-panel-tab-icon {
    transform: rotate(180deg);
  }

  .cp-panel-handle {
    flex-direction: row;
    align-items: center;
    padding: 1.1rem 1rem;
    gap: 0.75rem;
  }

  .cp-panel-handle-bar {
    display: none;
  }

  .cp-panel-toggle {
    display: none;
  }

  .cp-panel-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
  }

  .cp-panel-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
  }

  .cp-panel-body {
    overflow-y: auto;
    max-height: calc(100vh - 145px);
  }
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.cp-toast {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: 30px;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  z-index: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  max-width: 90vw;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

.cp-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 900px) {
  .cp-toast {
    bottom: 2.5rem;
  }
}

/* ==========================================================================
   VISUALIZER SECTION (Phòng Khách, Phòng Ngủ, Biệt Thự)
   ========================================================================== */
.cp-visualizer-section {
  display: none;
}

@media (min-width: 900px) {
  .cp-visualizer-section {
    display: block;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .cp-vis-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: #f8fafc;
  }

  .cp-vis-tab {
    flex: 1;
    padding: 0.7rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border-right: 1px solid var(--border-subtle);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
  }

  .cp-vis-tab:last-child {
    border-right: none;
  }

  .cp-vis-tab.active {
    color: var(--gold-dark);
    background: #ffffff;
    font-weight: 700;
    border-bottom: 2px solid var(--gold-primary);
  }

  .cp-vis-viewport {
    position: relative;
    height: 200px;
    overflow: hidden;
  }

  .cp-vis-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
  }

  .cp-vis-overlay {
    position: absolute;
    inset: 0;
    mix-blend-mode: multiply;
    opacity: 0.82;
    transition: background-color 0.4s ease;
  }

  .cp-vis-softlight {
    position: absolute;
    inset: 0;
    mix-blend-mode: soft-light;
    opacity: 0.22;
    transition: background-color 0.4s ease;
  }

  .cp-vis-lighting {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background 0.4s ease;
  }

  .cp-vis-lighting.warm {
    background: rgba(255, 170, 60, 0.12);
  }

  .cp-vis-badge {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border-subtle);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .cp-vis-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
  }

  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
  }

  .cp-vis-light-bar {
    display: flex;
    padding: 0.5rem;
    gap: 0.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-subtle);
  }

  .cp-vis-light-btn {
    flex: 1;
    padding: 0.42rem;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-shadow: var(--shadow-sm);
  }

  .cp-vis-light-btn.active {
    color: #92400e;
    border-color: var(--gold-primary);
    background: #fef3c7;
    font-weight: 700;
  }
}

/* ==========================================================================
   IN & XUẤT TỜ A4 (PRINT SPECIFICATIONS)
   Khắc phục: "lề phải bị ra quá, chữ sát mép phải của tờ A4"
   ========================================================================== */
@page {
  size: A4 portrait;
  /* Lề trên 15mm, lề phải 22mm (rộng rãi), lề dưới 15mm, lề trái 18mm */
  margin: 15mm 22mm 15mm 18mm;
}

@media print {
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10pt !important;
  }

  /* Ẩn các thành phần tương tác trên web khi in ra giấy A4 */
  .cp-header,
  .cp-search-wrap,
  .cp-groups-wrap,
  .cp-filter-wrap,
  .cp-load-more-row,
  .cp-active-panel,
  .cp-toast,
  .cp-swatch-fav-btn,
  .cp-vis-tabs,
  .cp-vis-light-bar {
    display: none !important;
  }

  .cp-layout {
    max-width: 100% !important;
    margin: 0 !important;
    /* Đảm bảo mép phải có đệm an toàn, chữ không bao giờ chạm sát lề giấy */
    padding: 0 4mm 0 0 !important;
  }

  .cp-results-info {
    font-size: 11pt !important;
    color: #111827 !important;
    border-bottom: 1.5pt solid #e5e7eb !important;
    padding-bottom: 3mm !important;
    margin-bottom: 6mm !important;
  }

  .cp-swatches-grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 4mm !important;
    page-break-inside: auto !important;
  }

  .cp-swatch-card {
    border: 1pt solid #cbd5e1 !important;
    border-radius: 4pt !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    background: #ffffff !important;
  }

  .cp-swatch-disc {
    box-shadow: inset 0 0 0 0.5pt rgba(0,0,0,0.15) !important;
  }

  .cp-swatch-info {
    padding: 2mm !important;
  }

  .cp-swatch-code {
    font-size: 8pt !important;
    color: #000000 !important;
  }

  .cp-swatch-name {
    font-size: 7pt !important;
    color: #374151 !important;
  }

  .cp-swatch-hex {
    font-size: 6pt !important;
    color: #6b7280 !important;
  }
}
