/* CSS 변수 정의 */
.color-temp-wrapper {
  --bg-primary: #f5f5f0;
  --bg-secondary: #fff;
  --bg-section: #fff;
  --border-color: #333;
  --text-primary: #222;
  --text-secondary: #555;
  --text-light: #666;
  --color-accent: #3498db;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-purple: #9b59b6;
  --shadow-sm: 2px 2px 0 rgba(0,0,0,0.1);
  --shadow-md: 4px 4px 0 rgba(0,0,0,0.15);
  --shadow-lg: 8px 8px 0 rgba(0,0,0,0.15);
}

/* 전역 box-sizing */
.color-temp-wrapper,
.color-temp-wrapper *,
.color-temp-wrapper *::before,
.color-temp-wrapper *::after {
  box-sizing: border-box;
}

/* 메인 컨테이너 */
.color-temp-container {
  max-width: 1180px;
  width: 100%;
  margin: 15px auto;
  padding: 15px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  font-family: 'Noto Sans KR', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}

/* 헤더 */
.converter-header {
  text-align: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 3px double var(--border-color);
}

.converter-header h2 {
  margin: 0 0 6px 0;
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  text-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.4;
}

/* 빠른 액션 버튼 */
.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-sample,
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  font-family: inherit;
  white-space: nowrap;
}

.btn-sample:hover,
.btn-reset:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.btn-sample:active,
.btn-reset:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn-sample:focus-visible,
.btn-reset:focus-visible {
  outline: 3px solid var(--color-warning);
  outline-offset: 2px;
}

.btn-sample {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--border-color);
}

.btn-reset {
  background: var(--color-warning);
  color: #fff;
  border-color: var(--border-color);
}

/* 광고 섹션 */
.ad-section {
  display: block;
  width: 100%;
  min-height: 90px;
  padding: 12px;
  text-align: center;
  background: #fff;
  border: 1px solid #ddd;
  overflow: visible;
  margin-bottom: 12px;
}

.ad-label {
  display: block;
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-section .adsbygoogle {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 80px;
  text-align: center;
}

/* 색상 미리보기 섹션 */
.preview-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
}

.color-preview-box {
  position: relative;
  width: 100%;
  height: 200px;
  border: 2px solid var(--border-color);
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
  background: rgb(255, 248, 251);
}

.preview-info {
  text-align: center;
}

.preview-temp {
  padding: 10px 20px;
  font-size: 32px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  border: 2px solid rgba(0,0,0,0.2);
  background: rgba(255,255,255,0.95);
  color: var(--text-primary);
  margin-bottom: 8px;
  display: inline-block;
}

.preview-temp.light-bg {
  background: rgba(0,0,0,0.95);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

.preview-desc {
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.2);
  display: inline-block;
  margin-bottom: 6px;
}

.preview-desc.light-bg {
  background: rgba(0,0,0,0.9);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

.preview-rgb {
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.2);
  display: inline-block;
}

.preview-rgb.light-bg {
  background: rgba(0,0,0,0.9);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

/* 섹션 타이틀 */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  font-size: 17px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

.preview-section .section-title {
  color: var(--color-success);
}

.temp-title {
  color: var(--color-warning);
}

.result-title {
  color: var(--color-accent);
}

.info-section .section-title {
  color: var(--color-purple);
}

/* 메인 그리드 */
.converter-main {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.input-section,
.result-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

/* 입력 그룹 */
.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

.input-hint {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
}

/* 슬라이더 + 입력 그룹 */
.slider-input-group {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 10px;
  align-items: center;
}

/* 슬라이더 */
.kelvin-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, 
    rgb(255, 147, 41) 0%,
    rgb(255, 197, 143) 20%,
    rgb(255, 228, 206) 40%,
    rgb(255, 248, 251) 60%,
    rgb(201, 226, 255) 100%
  );
}

.kelvin-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 2px solid var(--border-color);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.kelvin-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: #fff;
  border: 2px solid var(--border-color);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.kelvin-slider:focus {
  outline: 2px solid var(--color-warning);
  outline-offset: 2px;
}

/* 숫자 입력 */
.number-input {
  width: 100%;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  text-align: center;
}

.number-input:focus {
  outline: none;
  background: #fffacd;
  border-color: var(--color-warning);
}

/* 온도 스케일 */
.temp-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 15px;
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid #ddd;
}

.scale-item {
  flex: 1;
  text-align: center;
}

.scale-marker {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.scale-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* 결과 그룹 */
.result-group {
  margin-bottom: 12px;
}

.result-group:last-child {
  margin-bottom: 0;
}

.result-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
}

.output-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid var(--border-color);
}

.output-value {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

/* RGB 값 표시 */
.rgb-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.rgb-item {
  padding: 12px;
  background: #f9f9f9;
  border: 1px solid var(--border-color);
  text-align: center;
}

.rgb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.rgb-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

/* 복사 버튼 */
.btn-copy-small {
  flex-shrink: 0;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

.btn-copy-small:hover {
  background: #f0f0f0;
  transform: translate(0.5px, 0.5px);
  box-shadow: 0.5px 0.5px 0 rgba(0,0,0,0.1);
}

.btn-copy-small:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.btn-copy-small:focus-visible {
  outline: 2px solid var(--color-warning);
  outline-offset: 2px;
}

/* 정보 섹션 */
.info-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.info-content {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.info-card {
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  text-align: center;
}

.info-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.info-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.info-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.feature-list,
.usage-box {
  margin-bottom: 12px;
}

.feature-list p,
.usage-box p {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.feature-list ul,
.usage-box ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.feature-list li,
.usage-box li {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.5;
}

.feature-list li:last-child,
.usage-box li:last-child {
  margin-bottom: 0;
}

.usage-box {
  padding: 10px;
  background: #e8f5e9;
  border: 1px solid var(--color-success);
  border-left: 4px solid var(--color-success);
}

.warning-box {
  padding: 10px;
  background: #fff8e6;
  border: 1px solid var(--color-warning);
  border-left: 4px solid var(--color-warning);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.warning-box strong {
  color: var(--color-warning);
}

/* 토스트 알림 */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-success);
  color: #fff;
  padding: 12px 20px;
  border: 2px solid #333;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  min-width: 280px;
  max-width: 90%;
}

.toast.show {
  bottom: 30px;
  opacity: 1;
}

.toast-content {
  text-align: center;
}

.toast-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.toast-value {
  font-size: 14px;
  font-family: 'Courier New', monospace;
}

/* 반응형: 태블릿 */
@media (max-width: 1024px) {
  .converter-main {
    grid-template-columns: 1fr;
  }
  
  .info-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-actions {
    justify-content: flex-start;
  }
}

/* 반응형: 모바일 */
@media (max-width: 768px) {
  .color-temp-container {
    margin: 8px 5px;
    padding: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .converter-header h2 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .quick-actions {
    gap: 6px;
  }

  .btn-sample,
  .btn-reset {
    font-size: 13px;
    padding: 7px 10px;
  }
  
  .color-preview-box {
    height: 160px;
  }
  
  .preview-temp {
    font-size: 28px;
    padding: 8px 16px;
  }

  .preview-desc {
    font-size: 14px;
  }

  .preview-rgb {
    font-size: 13px;
  }
  
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .temp-scale {
    flex-wrap: wrap;
  }

  .scale-item {
    flex: 0 0 calc(33.333% - 6px);
  }

  .scale-marker {
    height: 30px;
  }

  .scale-label {
    font-size: 11px;
  }

  .slider-input-group {
    grid-template-columns: 1fr 90px;
  }

  .rgb-values {
    gap: 6px;
  }

  .rgb-number {
    font-size: 20px;
  }
}

/* 반응형: 작은 모바일 */
@media (max-width: 480px) {
  .color-temp-container {
    margin: 8px 5px;
    padding: 8px;
    width: calc(100% - 10px);
    max-width: 100%;
    box-sizing: border-box;
    border-width: 1px;
  }
  
  .converter-header h2 {
    font-size: 22px;
  }

  .quick-actions {
    flex-direction: column;
    gap: 6px;
  }

  .btn-sample,
  .btn-reset {
    width: 100%;
    justify-content: center;
    font-size: 13px;
  }
  
  .color-preview-box {
    height: 140px;
  }
  
  .preview-temp {
    font-size: 24px;
    padding: 6px 14px;
  }

  .preview-desc {
    font-size: 13px;
  }

  .preview-rgb {
    font-size: 12px;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }

  .temp-scale {
    gap: 6px;
  }

  .scale-item {
    flex: 0 0 calc(50% - 3px);
  }

  .slider-input-group {
    grid-template-columns: 1fr 80px;
  }

  .output-value {
    font-size: 14px;
  }

  .rgb-values {
    grid-template-columns: 1fr;
  }

  .rgb-number {
    font-size: 22px;
  }
}