/* CSS 변수 정의 */
.date-difference-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-special: #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 */
.date-difference-wrapper,
.date-difference-wrapper *,
.date-difference-wrapper *::before,
.date-difference-wrapper *::after {
  box-sizing: border-box;
}

/* 메인 컨테이너 */
.date-difference-container {
  max-width: 1180px;
  width: 100%;
  margin: 20px auto;
  padding: 20px;
  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;
}

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

.calculator-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: 14px;
  color: var(--text-light);
  line-height: 1.4;
}

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

.btn-quick,
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border-color);
  font-size: 15px;
  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;
}

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

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

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

.btn-quick {
  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: 100px;
  padding: 15px;
  text-align: center;
  background: #fff;
  border: 1px solid #ddd;
  overflow: visible;
  margin-bottom: 15px;
}

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

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

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

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

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

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

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

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

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

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

/* 날짜 입력 행 */
.date-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-input {
  flex: 1;
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: inherit;
}

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

.btn-today {
  flex-shrink: 0;
  padding: 6px 10px;
  background: var(--color-success);
  color: #fff;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  white-space: nowrap;
}

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

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

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

/* 일수 입력 행 */
.days-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.number-input {
  flex: 1;
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 15px;
  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);
}

.select-input {
  width: 70px;
  padding: 8px 6px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

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

/* 계산 버튼 */
.btn-calculate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 18px;
  background: var(--color-accent);
  color: #fff;
  border: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  margin-top: 8px;
  font-family: inherit;
}

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

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

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

/* 결과 표시 */
.result-display {
  text-align: center;
}

.main-result {
  margin-bottom: 15px;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  box-shadow: var(--shadow-sm);
}

.big-number {
  font-size: 42px;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 5px;
  font-family: 'Courier New', monospace;
}

.result-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-results {
  text-align: left;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: #f9f9f9;
  border: 1px solid #ddd;
}

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

.result-label-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.result-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent);
  font-family: 'Courier New', monospace;
}

.no-result {
  text-align: center;
  padding: 40px 20px;
  background: #fafafa;
  border: 1px dashed #ddd;
  color: var(--text-light);
  font-size: 14px;
}

/* 특별한 날 결과 */
.special-result {
  text-align: center;
  margin-top: 15px;
  padding: 15px;
  background: #f0f8ff;
  border: 1px solid var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.special-date {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-special);
  margin-bottom: 8px;
  font-family: 'Courier New', monospace;
}

.special-info {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* 기념일 버튼 */
.milestone-buttons {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.milestone-buttons h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
}

.milestone-btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-milestone {
  padding: 8px 12px;
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
  font-family: inherit;
}

.btn-milestone:hover {
  background: #f0f0f0;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

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

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

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

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

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

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

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

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

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

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

.feature-list {
  margin-bottom: 15px;
}

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

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

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

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

.warning-box {
  padding: 12px;
  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);
}

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

/* 반응형: 모바일 */
@media (max-width: 768px) {
  .date-difference-container {
    margin: 10px 5px;
    padding: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .calculator-header h2 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 13px;
  }
  
  .quick-actions {
    flex-direction: column;
  }
  
  .btn-quick,
  .btn-reset {
    width: 100%;
    justify-content: center;
  }
  
  .calculator-main {
    grid-template-columns: 1fr;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .big-number {
    font-size: 36px;
  }
  
  .special-date {
    font-size: 28px;
  }
}

/* 반응형: 작은 모바일 */
@media (max-width: 480px) {
  .date-difference-container {
    margin: 10px 5px;
    padding: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
    box-sizing: border-box;
    border-width: 1px;
  }
  
  .calculator-header h2 {
    font-size: 22px;
  }
  
  .big-number {
    font-size: 32px;
  }
  
  .special-date {
    font-size: 24px;
  }
  
  .btn-calculate {
    font-size: 15px;
    padding: 8px 16px;
  }
  
  .milestone-btn-group {
    grid-template-columns: 1fr;
  }
  
  .date-input,
  .number-input,
  .select-input {
    font-size: 14px;
  }
}