/* ===== 전역 box-sizing ===== */
.steps-to-kilometers-calculator-container,
.steps-to-kilometers-calculator-container *,
.steps-to-kilometers-calculator-container *::before,
.steps-to-kilometers-calculator-container *::after {
  box-sizing: border-box;
}

/* ===== 메인 컨테이너 - 라이트 모드 (기본) ===== */
.steps-to-kilometers-calculator-container {
  /* 배경색 */
  --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;
  --color-teal: #1abc9c;
  
  /* 그림자 (네오브루탈리즘) */
  --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);
  
  /* 입력 포커스 */
  --input-focus-bg: #fffacd;
  
  /* 헤더 타이틀 */
  --title-color: #2c3e50;
  --title-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  
  /* 버튼 호버 배경 */
  --btn-hover-overlay: rgba(0,0,0,0.1);
  
  /* 기타 */
  --copy-btn-bg: #fff;
  --copy-btn-hover-bg: #f0f0f0;
  
  /* 컨테이너 스타일 */
  position: relative;
  max-width: 800px;
  width: 100%;
  margin: 15px auto;
  padding: 12px;
  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;
}

/* ===== 수동 다크 모드 ===== */
.steps-to-kilometers-calculator-container.dark {
  /* 배경색 */
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-section: #2d2d2d;
  
  /* 테두리 */
  --border-color: #e0e0e0;
  
  /* 텍스트 */
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-light: #909090;
  
  /* 브랜드 색상 */
  --color-accent: #5dade2;
  --color-success: #52c77a;
  --color-warning: #f5b041;
  --color-danger: #ec7063;
  --color-purple: #af7ac5;
  --color-teal: #48d1cc;
  
  /* 그림자 */
  --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
  --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
  --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
  
  /* 입력 포커스 */
  --input-focus-bg: #3a3a3a;
  
  /* 헤더 타이틀 */
  --title-color: #7fb3d5;
  --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  
  /* 버튼 호버 배경 */
  --btn-hover-overlay: rgba(255,255,255,0.1);
  
  /* 기타 */
  --copy-btn-bg: #3a3a3a;
  --copy-btn-hover-bg: #4a4a4a;
}

/* ===== 시스템 다크모드 자동 감지 ===== */
@media (prefers-color-scheme: dark) {
  .steps-to-kilometers-calculator-container:not(.dark):not(.light) {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-section: #2d2d2d;
    --border-color: #e0e0e0;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-light: #909090;
    --color-accent: #5dade2;
    --color-success: #52c77a;
    --color-warning: #f5b041;
    --color-danger: #ec7063;
    --color-purple: #af7ac5;
    --color-teal: #48d1cc;
    --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
    --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
    --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
    --input-focus-bg: #3a3a3a;
    --title-color: #7fb3d5;
    --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    --btn-hover-overlay: rgba(255,255,255,0.1);
    --copy-btn-bg: #3a3a3a;
    --copy-btn-hover-bg: #4a4a4a;
  }
}

/* ===== 다크모드 토글 버튼 ===== */
.dark-mode-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10;
}

.dark-mode-toggle:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
}

.dark-mode-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.theme-icon {
  font-size: 18px;
  line-height: 1;
}

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

.calculator-header h2 {
  margin: 0 0 6px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--title-color);
  text-shadow: var(--title-shadow);
  line-height: 1.2;
}

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

/* ===== 메인 그리드 ===== */
.calculator-main {
  display: grid;
  grid-template-columns: 1fr 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);
}

/* ===== 섹션 타이틀 ===== */
.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;
  line-height: 1.2;
}

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

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

.section-title svg {
  flex-shrink: 0;
}

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

.input-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calculator-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Courier New', Courier, monospace;
  outline: none;
  transition: all 0.2s;
}

.calculator-input:focus {
  background: var(--input-focus-bg);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.calculator-input.error {
  border-color: var(--color-danger);
}

.input-hint {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.3;
}

/* ===== 버튼 - 네오브루탈리즘 ===== */
/* 계산하기 버튼 - 1.5px 테두리 */
.btn-calculate {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: var(--color-accent);
  border: 1.5px solid var(--border-color);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
}

.btn-calculate:hover {
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
  background: var(--color-accent);
  filter: brightness(1.05);
}

.btn-calculate:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.btn-calculate svg {
  flex-shrink: 0;
}

/* 버튼 그룹 */
.btn-group {
  display: flex;
  gap: 8px;
}

/* 샘플 버튼 - 1px 테두리 */
.btn-sample {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: var(--color-success);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-sample:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
  filter: brightness(1.05);
}

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

.btn-sample svg {
  flex-shrink: 0;
}

/* 초기화 버튼 - 1px 테두리 */
.btn-reset {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: var(--color-warning);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-reset:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
  filter: brightness(1.05);
}

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

.btn-reset svg {
  flex-shrink: 0;
}

/* ===== 결과 표시 ===== */
.result-display {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.result-label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
  font-weight: 600;
}

.result-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-success);
  font-family: 'Courier New', Courier, monospace;
  margin-bottom: 6px;
  line-height: 1;
}

.result-details {
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 18px;
  line-height: 1.4;
}

/* ===== 정보 박스 ===== */
.info-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.info-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-teal);
  line-height: 1.2;
}

.info-title svg {
  flex-shrink: 0;
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-list li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-list li:last-child {
  margin-bottom: 0;
}

.info-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-teal);
  font-weight: 700;
}

/* ===== 토스트 알림 ===== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  max-width: 90%;
  text-align: center;
}

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

/* ===== 반응형 ===== */
@media screen and (max-width: 768px) {
  .steps-to-kilometers-calculator-container {
    margin: 8px 5px;
    padding: 10px;
    width: calc(100% - 10px);
  }

  .calculator-main {
    grid-template-columns: 1fr;
  }

  .calculator-header h2 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 14px;
  }

  .dark-mode-toggle {
    top: 10px;
    right: 10px;
    padding: 6px 10px;
  }
}

@media screen and (max-width: 480px) {
  .steps-to-kilometers-calculator-container {
    padding: 8px;
    border-width: 1px;
  }

  .calculator-header h2 {
    font-size: 20px;
  }

  .subtitle {
    font-size: 13px;
  }

  .section-title {
    font-size: 15px;
  }

  .result-value {
    font-size: 28px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-sample,
  .btn-reset {
    width: 100%;
  }
}