/**
 * ColorKidPlay - Online Coloring Studio Styles
 */

/* Entry button on page */
.pill-button-paint,
.gallery-item .paint-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #ffffff !important;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.25);
}

.pill-button-paint {
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
}

.pill-button-paint:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(109, 40, 217, 0.38);
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.gallery-item .paint-mini {
  width: 100%;
  min-height: 38px;
  margin: 6px 0 0;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13px;
  text-align: center;
}

.gallery-item .paint-mini:hover {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  box-shadow: 0 5px 14px rgba(109, 40, 217, 0.35);
}

.gallery-item .paint-mini svg,
.pill-button-paint svg {
  width: 17px;
  height: 17px;
  flex: none;
}

/* Modal Overlay & Container */
.ckp-paint-studio-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  background: #0f172a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
}

.ckp-paint-studio-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.ckp-paint-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ckp-paint-studio-window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #f8fafc;
  overflow: hidden;
}

/* Header */
.ckp-paint-header {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ckp-paint-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ckp-paint-btn-icon {
  width: 38px;
  height: 38px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  color: #334155;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ckp-paint-btn-icon svg {
  width: 18px;
  height: 18px;
}

.ckp-paint-btn-icon:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}

.ckp-paint-btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ckp-paint-btn-close {
  background: #fee2e2;
  border-color: #fecaca;
  color: #ef4444;
}

.ckp-paint-btn-close:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.ckp-paint-header-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ckp-paint-badge {
  font-size: 11px;
  font-weight: 800;
  color: #8b5cf6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ckp-paint-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.ckp-paint-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ckp-paint-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.ckp-paint-btn-print {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.ckp-paint-btn-print:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ckp-paint-btn-save {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.ckp-paint-btn-save:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.ckp-paint-btn-action svg {
  width: 16px;
  height: 16px;
}

/* Workspace */
.ckp-paint-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
}

/* Tools Dock */
.ckp-paint-dock {
  width: 80px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  gap: 20px;
  flex-shrink: 0;
  z-index: 10;
}

.ckp-paint-tool-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ckp-paint-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.ckp-paint-tool-btn .ckp-tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.ckp-paint-tool-btn .ckp-tool-icon svg {
  width: 22px;
  height: 22px;
}

.ckp-paint-tool-btn .ckp-tool-name {
  font-size: 11px;
  font-weight: 700;
}

.ckp-paint-tool-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ckp-paint-tool-btn.is-active {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

/* Sizes */
.ckp-paint-size-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-top: 1px solid #e2e8f0;
  padding-top: 14px;
}

.ckp-paint-group-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.ckp-paint-sizes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.ckp-size-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ckp-size-btn span {
  background: #475569;
  border-radius: 50%;
  display: block;
  transition: background 0.15s ease;
}

.ckp-size-btn:hover {
  background: #e2e8f0;
}

.ckp-size-btn.is-active {
  border-color: #8b5cf6;
  background: #ede9fe;
}

.ckp-size-btn.is-active span {
  background: #8b5cf6;
}

/* Stage & Canvas */
.ckp-paint-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.ckp-paint-stage-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.ckp-paint-canvas-wrap {
  position: relative;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.ckp-canvas {
  display: block;
}

.ckp-color-canvas {
  position: relative;
  z-index: 1;
}

.ckp-line-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Loading spinner */
.ckp-paint-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(4px);
  z-index: 20;
}

.ckp-paint-loader.is-hidden {
  display: none;
}

.ckp-paint-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: ckpSpin 0.8s linear infinite;
  margin-bottom: 12px;
}

.ckp-paint-loader p {
  font-weight: 700;
  color: #475569;
  font-size: 14px;
}

@keyframes ckpSpin {
  to { transform: rotate(360deg); }
}

/* Footer / Palette */
.ckp-paint-footer {
  height: 72px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03);
}

.ckp-paint-current-color-wrap {
  flex-shrink: 0;
}

.ckp-paint-current-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, background-color 0.2s;
}

.ckp-paint-swatches-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px;
  scrollbar-width: thin;
}

.ckp-paint-swatches-scroll::-webkit-scrollbar {
  height: 4px;
}

.ckp-paint-swatches-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.ckp-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ckp-color-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.ckp-color-swatch.is-selected {
  transform: scale(1.22);
  box-shadow: 0 0 0 3px #8b5cf6, 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.ckp-paint-custom-color-wrap {
  flex-shrink: 0;
}

.ckp-custom-color-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 3px;
}

.ckp-custom-color-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.ckp-custom-color-icon {
  background: #ffffff;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ckp-custom-color-icon svg {
  width: 20px;
  height: 20px;
  color: #334155;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ckp-paint-header {
    height: 52px;
    padding: 0 10px;
  }
  .ckp-paint-title {
    max-width: 140px;
    font-size: 13px;
  }
  .ckp-paint-btn-action span {
    display: none;
  }
  .ckp-paint-btn-action {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
  }
  .ckp-paint-dock {
    width: 58px;
    padding: 10px 4px;
    gap: 12px;
  }
  .ckp-paint-tool-btn .ckp-tool-icon {
    font-size: 20px;
  }
  .ckp-paint-tool-btn .ckp-tool-name {
    font-size: 9px;
  }
  .ckp-paint-footer {
    height: 60px;
    padding: 0 10px;
    gap: 8px;
  }
  .ckp-color-swatch {
    width: 30px;
    height: 30px;
  }
}
