/**********************************************
 * 독립된 컨테이너 및 기본 설정
 **********************************************/
.circle-art-tool-container {
  width: 100% !important;
  max-width: 1180px !important;
  margin: 20px auto !important;
  background-color: #f2f2f2 !important;
  padding: 20px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  color: #595959 !important;
  overflow: hidden !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

.circle-art-tool-container * {
  box-sizing: border-box !important;
}

/**********************************************
 * 헤더 영역
 **********************************************/
.calculator-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 15px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #cccccc !important;
}

.circle-art-tool-container h2 {
  margin: 0 !important;
  color: #595959 !important;
  font-size: 1.2em !important;
  font-weight: 600 !important;
}

.circle-art-tool-container h3 {
  margin: 0 0 10px 0 !important;
  color: #595959 !important;
  font-size: 1.1em !important;
  font-weight: 600 !important;
}

.section-title {
  margin: 20px 0 15px 0 !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #e6e6e6 !important;
}

/**********************************************
 * 본문 레이아웃
 **********************************************/
.calculator-body {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 20px !important;
}

.input-section {
  flex: 1 !important;
  min-width: 300px !important;
  background-color: #ffffff !important;
  padding: 20px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

.result-section {
  flex: 2 !important;
  min-width: 350px !important;
  background-color: #ffffff !important;
  padding: 20px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

/**********************************************
 * 이미지 업로드 영역
 **********************************************/
.upload-area {
  margin-bottom: 20px !important;
}

.upload-area label {
  display: block !important;
  font-size: 1em !important;
  font-weight: 500 !important;
  margin-bottom: 10px !important;
  color: #595959 !important;
}

.upload-box {
  width: 100% !important;
  min-height: 200px !important;
  border: 2px dashed #cccccc !important;
  border-radius: 8px !important;
  padding: 10px !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: hidden !important;
  transition: all 0.3s ease !important;
}

.upload-box:hover {
  border-color: #a5a5a5 !important;
  background-color: #f9f9f9 !important;
}

.upload-box.drag-over {
  border-color: #7f7f7f !important;
  background-color: #f2f2f2 !important;
}

.upload-placeholder {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  padding: 20px !important;
  text-align: center !important;
}

.upload-placeholder p {
  margin: 10px 0 0 0 !important;
  font-size: 0.9em !important;
  color: #7f7f7f !important;
}

.upload-icon {
  width: 48px !important;
  height: 48px !important;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%237f7f7f" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>') !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

.image-preview-container {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.image-preview {
  max-width: 100% !important;
  max-height: 300px !important;
  object-fit: contain !important;
}

.upload-info {
  margin-top: 8px !important;
  font-size: 0.8em !important;
  color: #7f7f7f !important;
}

.upload-info p {
  margin: 0 !important;
}

/**********************************************
 * 도트화 설정 영역
 **********************************************/
.circlelate-settings {
  margin-top: 20px !important;
}

.setting-group {
  margin-bottom: 15px !important;
}

.setting-group label {
  display: block !important;
  font-size: 0.9em !important;
  font-weight: 500 !important;
  margin-bottom: 8px !important;
  color: #595959 !important;
}

.slider-with-value {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.slider-with-value input[type="range"] {
  flex: 1 !important;
  height: 5px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background: #e6e6e6 !important;
  outline: none !important;
  border-radius: 5px !important;
  transition: background 0.2s !important;
}

.slider-with-value input[type="range"]::-webkit-slider-thumb {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 15px !important;
  height: 15px !important;
  border-radius: 50% !important;
  background: #595959 !important;
  cursor: pointer !important;
}

.slider-with-value input[type="range"]::-moz-range-thumb {
  width: 15px !important;
  height: 15px !important;
  border-radius: 50% !important;
  background: #595959 !important;
  cursor: pointer !important;
  border: none !important;
}

.value-display {
  min-width: 50px !important;
  text-align: right !important;
  font-size: 0.9em !important;
  color: #595959 !important;
}

/* 색상 선택 스타일 */
.color-with-value {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.color-with-value input[type="color"] {
  width: 40px !important;
  height: 30px !important;
  border: 1px solid #cccccc !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  padding: 0 !important;
}

.color-with-value input[type="text"] {
  flex: 1 !important;
  height: 30px !important;
  padding: 0 8px !important;
  border: 1px solid #cccccc !important;
  border-radius: 4px !important;
  font-size: 0.9em !important;
  color: #595959 !important;
}

/* 체크박스 스타일 */
.checkbox-group {
  display: flex !important;
  align-items: center !important;
}

.checkbox-label {
  display: flex !important;
  align-items: center !important;
  cursor: pointer !important;
  font-weight: 500 !important;
  font-size: 0.9em !important;
  color: #595959 !important;
}

.checkbox-label input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  cursor: pointer !important;
  height: 0 !important;
  width: 0 !important;
}

.custom-checkbox {
  position: relative !important;
  display: inline-block !important;
  width: 18px !important;
  height: 18px !important;
  margin-right: 8px !important;
  background-color: #ffffff !important;
  border: 2px solid #cccccc !important;
  border-radius: 3px !important;
  transition: all 0.2s ease !important;
}

.checkbox-label:hover .custom-checkbox {
  border-color: #a5a5a5 !important;
}

.checkbox-label input:checked ~ .custom-checkbox {
  background-color: #595959 !important;
  border-color: #595959 !important;
}

.custom-checkbox::after {
  content: "" !important;
  position: absolute !important;
  display: none !important;
  left: 5px !important;
  top: 1px !important;
  width: 5px !important;
  height: 10px !important;
  border: solid white !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) !important;
}

.checkbox-label input:checked ~ .custom-checkbox::after {
  display: block !important;
}

/* 셀렉트 박스 스타일 */
.setting-group select {
  width: 100% !important;
  padding: 8px 12px !important;
  font-size: 0.9em !important;
  color: #595959 !important;
  background-color: #ffffff !important;
  border: 1px solid #cccccc !important;
  border-radius: 4px !important;
  appearance: none !important;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23595959" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px !important;
  cursor: pointer !important;
}

.setting-group select:focus {
  border-color: #7f7f7f !important;
  outline: none !important;
}

/**********************************************
 * 버튼 스타일
 **********************************************/
.button-group {
  display: flex !important;
  gap: 10px !important;
  margin-top: 20px !important;
}

/* 기본 버튼 스타일 */
.button-group button,
.result-buttons button {
  padding: 10px 15px !important;
  font-size: 0.9em !important;
  font-weight: 500 !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
}

/* 메인 버튼 */
.primary-btn {
  width: 100% !important;
  background-color: #595959 !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(89, 89, 89, 0.2) !important;
}

.primary-btn:hover {
  background-color: #7f7f7f !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(89, 89, 89, 0.3) !important;
}

/* 보조 버튼 */
.secondary-btn {
  flex: 1 !important;
  background-color: #cccccc !important;
  color: #595959 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.secondary-btn:hover {
  background-color: #a5a5a5 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* 결과 영역 버튼 */
.action-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: #f2f2f2 !important;
  color: #595959 !important;
  border: 1px solid #cccccc !important;
  padding: 10px 15px !important;
  font-size: 0.9em !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  flex: 1 !important;
}

.action-btn:hover {
  background-color: #e6e6e6 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.action-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  width: 16px !important;
  height: 16px !important;
  margin-right: 8px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

.download-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>') !important;
}

.png-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>') !important;
}

.svg-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v4"></path><polyline points="14 2 14 8 20 8"></polyline><path d="M2 15h10"></path><path d="M9 18l3-3-3-3"></path></svg>') !important;
}

/**********************************************
 * 미리보기 영역
 **********************************************/
.preview-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 15px !important;
}

.preview-info {
  font-size: 0.8em !important;
  color: #7f7f7f !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

.circle-preview-container {
  width: 100% !important;
  padding-bottom: 20px !important;
  position: relative !important;
  min-height: 300px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.circle-canvas-wrapper {
  width: 100% !important;
  height: auto !important;
  min-height: 300px !important;
  max-height: 800px !important;
  overflow: auto !important;
  border: 1px solid #e6e6e6 !important;
  border-radius: 4px !important;
  background-color: #f9f9f9 !important;
  position: relative !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 15px !important;
}

#circleCanvas {
  display: block !important;
  image-rendering: pixelated !important;
  image-rendering: crisp-edges !important;
  max-width: 100% !important;
  max-height: 770px !important;
  margin: 0 auto !important;
}

.preview-placeholder {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  background-color: rgba(249, 249, 249, 0.8) !important;
  z-index: 1 !important;
}

.preview-placeholder p {
  margin: 0 !important;
  font-size: 0.9em !important;
  color: #7f7f7f !important;
  text-align: center !important;
  padding: 20px !important;
}

.result-buttons {
  display: flex !important;
  gap: 10px !important;
  margin: 15px 0 !important;
}

/**********************************************
 * 색상 팔레트 영역
 **********************************************/
.color-palette-section {
  margin-top: 20px !important;
}

.color-palette {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
  gap: 10px !important;
  margin-top: 15px !important;
}

.color-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  cursor: pointer !important;
  transition: transform 0.2s ease !important;
}

.color-item:hover {
  transform: scale(1.05) !important;
}

.color-swatch {
  width: 50px !important;
  height: 50px !important;
  border-radius: 4px !important;
  border: 1px solid #cccccc !important;
  margin-bottom: 5px !important;
}

.color-code {
  font-size: 0.75em !important;
  color: #595959 !important;
  text-align: center !important;
}

/**********************************************
 * 안내 박스
 **********************************************/
.info-box {
  margin-top: 25px !important;
  padding: 12px 15px !important;
  border-left: 3px solid #a5a5a5 !important;
  background-color: #f2f2f2 !important;
  font-size: 0.85em !important;
  color: #7f7f7f !important;
  border-radius: 0 4px 4px 0 !important;
}

.info-box p {
  margin: 4px 0 !important;
}

/**********************************************
 * 유틸리티 클래스
 **********************************************/
.hidden {
  display: none !important;
}

/**********************************************
 * 반응형
 **********************************************/
@media screen and (max-width: 900px) {
  .calculator-body {
    flex-direction: column !important;
  }
  
  .input-section, .result-section {
    width: 100% !important;
  }
  
  .color-palette {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
  }
  
  .preview-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  
  .preview-info {
    margin-top: 5px !important;
  }
}

@media screen and (max-width: 480px) {
  .circle-art-tool-container {
    padding: 15px 5px !important;
  }
  
  .input-section, .result-section {
    padding: 12px !important;
  }
  
  .result-buttons {
    flex-direction: column !important;
  }
  
  .color-palette {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important;
  }
}