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

/* 메인 컨테이너 */
.daily-income-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;
}

/* 헤더 */
.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: 30px;
  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: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-sample,
.btn-reset {
  flex: 1;
  min-width: 140px;
  padding: 10px 16px;
  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;
}

.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-reset {
  background: var(--color-danger);
  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: 10px;
}

.ad-label {
  display: block;
  font-size: 10px;
  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;
}

/* 메인 그리드 */
.calculator-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.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: 6px;
  border-bottom: 1px solid var(--border-color);
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

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

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

/* 체크박스 그룹 */
.checkbox-group {
  margin-bottom: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.checkbox-label:hover {
  background: #f0f0f0;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
}

/* 텍스트 입력 */
.text-input,
.select-input {
  width: 100%;
  max-width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}

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

/* 계산 버튼 */
.btn-calculate {
  width: 100%;
  padding: 12px;
  background: var(--color-success);
  color: #fff;
  border: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  margin-top: 8px;
  font-family: inherit;
}

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

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

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

/* 정보 박스 */
.info-box {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #e3f2fd;
  border: 1px solid #2196f3;
  margin-top: 10px;
}

.info-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.info-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-text strong {
  color: var(--text-primary);
}

/* 실시간 증가 카운터 */
.realtime-counter {
  padding: 15px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: 2px solid var(--border-color);
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow-md);
  margin-bottom: 10px;
}

.counter-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.9;
}

.counter-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  margin-bottom: 4px;
}

.counter-info {
  font-size: 12px;
  opacity: 0.8;
}

/* 결과 하이라이트 */
.result-highlight {
  padding: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid var(--border-color);
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow-md);
  margin-bottom: 10px;
}

.highlight-value {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 8px;
  font-family: 'Courier New', monospace;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.highlight-label {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.9;
}

.highlight-info {
  font-size: 14px;
  opacity: 0.8;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.3);
}

/* 결과 없음 */
.no-result {
  padding: 30px 15px;
  text-align: center;
}

.no-result-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.no-result-text {
  font-size: 15px;
  color: var(--text-light);
}

/* 상세 분석 그리드 (3열) */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.detail-card {
  padding: 12px;
  background: #fff;
  border: 2px solid var(--border-color);
  text-align: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.detail-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

.detail-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-accent);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

/* 달력 + 비교 분석 그리드 (50% / 50%) */
.calendar-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

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

/* 달력 컨트롤 */
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-calendar-nav {
  padding: 8px 12px;
  background: var(--color-accent);
  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);
  font-family: inherit;
  white-space: nowrap;
}

.btn-calendar-nav:hover {
  background: #2980b9;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

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

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

.calendar-header {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

/* 달력 날짜 */
.calendar-day {
  aspect-ratio: 0.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 13px;
  transition: all 0.2s;
  cursor: default;
}

.calendar-day.header {
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  border-color: var(--border-color);
  font-size: 14px;
}

.calendar-day.empty {
  background: #f5f5f5;
  border-style: dashed;
  opacity: 0.5;
}

.calendar-day.weekend {
  background: #fff5f5;
}

.calendar-day.excluded {
  background: #e0e0e0;
  opacity: 0.6;
  text-decoration: line-through;
}

.calendar-day.today {
  background: #fff9c4;
  border: 2px solid var(--color-warning);
  font-weight: 700;
}

.calendar-day:not(.header):not(.empty):hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.day-number {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.day-amount {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.calendar-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.legend-color {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-color);
}

.legend-color.today {
  background: #fff9c4;
}

.legend-color.weekend {
  background: #fff5f5;
}

.legend-color.weekday {
  background: #fff;
}

/* 비교 분석 섹션 */
.comparison-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comparison-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.comparison-item:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}

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

.comparison-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-success);
  font-family: 'Courier New', monospace;
  text-align: right;
}

/* 푸터 노트 */
.footer-note {
  margin-top: 10px;
  padding: 12px;
  background: #f0f0f0;
  border: 2px dashed #999;
}

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

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

.footer-note li {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 4px;
  line-height: 1.4;
}

.footer-note li:last-child {
  margin-bottom: 0;
}

/* 반응형: 태블릿 */
@media (max-width: 1024px) {
  .calendar-comparison-grid {
    grid-template-columns: 1fr;
  }
  
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .calendar-grid {
    gap: 4px;
  }
  
  .calendar-day {
    padding: 6px 4px;
  }
  
  .day-number {
    font-size: 15px;
  }
  
  .day-amount {
    font-size: 10px;
  }
}

/* 반응형: 모바일 */
@media (max-width: 768px) {
  .daily-income-container {
    margin: 10px 5px;
    padding: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
  }
  
  .calculator-header h2 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 13px;
  }
  
  .calculator-main {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    flex-direction: column;
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .calendar-comparison-grid {
    grid-template-columns: 1fr;
  }

  .calendar-controls {
    gap: 6px;
  }

  .btn-calendar-nav {
    padding: 8px 10px;
    font-size: 12px;
  }

  .calendar-header {
    font-size: 15px;
    padding: 6px;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    padding: 4px 2px;
  }

  .calendar-day.header {
    font-size: 12px;
  }

  .day-number {
    font-size: 14px;
  }

  .day-amount {
    font-size: 9px;
  }

  .comparison-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .comparison-value {
    text-align: left;
  }
}

/* 반응형: 작은 모바일 */
@media (max-width: 480px) {
  .daily-income-container {
    margin: 10px 5px;
    padding: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
    border-width: 1px;
  }

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

  .highlight-value {
    font-size: 36px;
  }

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

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    padding: 3px 1px;
  }

  .calendar-day.header {
    font-size: 11px;
  }

  .day-number {
    font-size: 13px;
  }

  .day-amount {
    font-size: 8px;
  }

  .comparison-label {
    font-size: 13px;
  }
  
  .comparison-value {
    font-size: 12px;
  }
}