/* ============ Color Chart Builder v2 ============ */

.ccb-root {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 30px auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #111827;
}

@media (max-width: 900px) {
  .ccb-root {
    grid-template-columns: 1fr;
  }
}

/* ===== Controls Panel ===== */

.ccb-controls {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  max-height: 85vh;
  overflow-y: auto;
  position: sticky;
  top: 40px;
}

.ccb-controls::-webkit-scrollbar {
  width: 6px;
}

.ccb-controls::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.ccb-panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px 0;
  color: #111827;
}

.ccb-control-group {
  margin-bottom: 16px;
}

.ccb-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.ccb-hint {
  font-size: 12px;
  color: #9ca3af;
  margin: 0 0 8px 0;
}

.ccb-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.ccb-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ccb-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #ffffff;
  outline: none;
  cursor: pointer;
}

.ccb-select:focus {
  border-color: #6366f1;
}

.ccb-range {
  width: 100%;
  accent-color: #6366f1;
  cursor: pointer;
}

.ccb-color-input {
  width: 40px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: #ffffff;
}

.ccb-inline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ccb-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
  white-space: nowrap;
}

.ccb-checkbox-label input[type="checkbox"] {
  accent-color: #6366f1;
  width: 16px;
  height: 16px;
}

.ccb-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 20px 0;
}

.ccb-download-info {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 8px;
}

/* ===== Font Dropdown ===== */

.ccb-font-row {
  position: relative;
}

.ccb-font-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  z-index: 100;
  margin-top: 4px;
}

.ccb-font-dropdown.ccb-hidden {
  display: none;
}

.ccb-font-option {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}

.ccb-font-option:hover {
  background: #f3f4f6;
}

.ccb-font-empty {
  color: #9ca3af;
  cursor: default;
}

/* ===== Row Config ===== */

.ccb-rows-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.ccb-row-config-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.ccb-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ccb-row-label {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
}

.ccb-row-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ccb-cols-label {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ccb-cols-input {
  width: 56px !important;
  padding: 4px 8px !important;
  text-align: center;
  font-size: 13px !important;
}

.ccb-row-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Cell Config (image upload) ===== */

.ccb-cell-config {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  position: relative;
  width: 90px;
}

.ccb-cell-upload-area {
  width: 70px;
  height: 70px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s;
  position: relative;
}

.ccb-cell-upload-area:hover {
  border-color: #6366f1;
}

.ccb-cell-upload-area.has-image {
  border-style: solid;
  border-color: #e5e7eb;
}

.ccb-cell-upload-area.has-image:hover {
  border-color: #6366f1;
}

.ccb-cell-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ccb-cell-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #9ca3af;
  font-size: 10px;
}

.ccb-cell-file {
  display: none;
}

.ccb-cell-name {
  width: 100% !important;
  padding: 3px 6px !important;
  font-size: 11px !important;
  text-align: center;
}

.ccb-cell-remove-img {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.ccb-cell-config:hover .ccb-cell-remove-img {
  opacity: 1;
}

/* ===== Buttons ===== */

.ccb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.ccb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ccb-btn-primary {
  width: 100%;
  background: #6366f1;
  color: #ffffff;
}

.ccb-btn-primary:hover:not(:disabled) {
  background: #4f46e5;
}

.ccb-btn-outline {
  width: 100%;
  background: #ffffff;
  color: #374151;
  border: 1px dashed #d1d5db;
}

.ccb-btn-outline:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: #eef2ff;
}

.ccb-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.ccb-btn-icon:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: #fef2f2;
}

/* ===== Preview ===== */

.ccb-preview-wrapper {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
}

.ccb-preview-scroll {
  overflow: auto;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background: repeating-conic-gradient(#f3f4f6 0% 25%, #ffffff 0% 50%) 0 0 / 20px 20px;
  min-height: 400px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.ccb-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
