/* ============================================
   날짜 요일 계산기 스타일
   - 네오브루탈리즘 디자인
   - 다크모드 지원
   - 2열 좌우 레이아웃
   ============================================ */

/* Global box-sizing */
.date-day-calculator-container,
.date-day-calculator-container *,
.date-day-calculator-container *::before,
.date-day-calculator-container *::after {
  box-sizing: border-box;
}

/* ============================================
   CSS 변수 - 라이트 모드 (기본)
   ============================================ */
.date-day-calculator-container {
  /* Background colors */
  --bg-primary: #f5f5f0;
  --bg-secondary: #fff;
  --bg-section: #fff;
  
  /* Borders */
  --border-color: #333;
  
  /* Text colors */
  --text-primary: #222;
  --text-secondary: #555;
  --text-light: #666;
  
  /* Brand colors */
  --color-accent: #3498db;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-purple: #9b59b6;
  --color-teal: #1abc9c;
  
  /* Shadows (neobrutalism) */
  --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);
  
  /* Border radius */
  --radius-container: 8px;
  --radius-section: 6px;
  --radius-button: 4px;
  --radius-input: 4px;
  
  /* Input focus */
  --input-focus-bg: #fffacd;
  
  /* Header title */
  --title-color: #2c3e50;
  --title-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  
  /* Button hover background */
  --btn-hover-overlay: rgba(0,0,0,0.1);
  
  /* Copy button background */
  --copy-btn-bg: #fff;
  --copy-btn-hover-bg: #f0f0f0;
}

/* ============================================
   다크 모드 (수동 토글)
   ============================================ */
.date-day-calculator-container.dark {
  /* Background colors */
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-section: #2d2d2d;
  
  /* Borders */
  --border-color: #e0e0e0;
  
  /* Text colors */
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-light: #909090;
  
  /* Brand colors */
  --color-accent: #5dade2;
  --color-success: #52c77a;
  --color-warning: #f5b041;
  --color-danger: #ec7063;
  --color-purple: #af7ac5;
  --color-teal: #48d1cc;
  
  /* Shadows */
  --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 */
  --input-focus-bg: #3a3a3a;
  
  /* Header title */
  --title-color: #7fb3d5;
  --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  
  /* Button hover background */
  --btn-hover-overlay: rgba(255,255,255,0.1);
  
  /* Copy button background */
  --copy-btn-bg: #3a3a3a;
  --copy-btn-hover-bg: #4a4a4a;
}

/* ============================================
   시스템 다크모드 자동 감지
   ============================================ */
@media (prefers-color-scheme: dark) {
  .date-day-calculator-container:not(.dark):not(.light) {
    /* Background colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-section: #2d2d2d;
    
    /* Borders */
    --border-color: #e0e0e0;
    
    /* Text colors */
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-light: #909090;
    
    /* Brand colors */
    --color-accent: #5dade2;
    --color-success: #52c77a;
    --color-warning: #f5b041;
    --color-danger: #ec7063;
    --color-purple: #af7ac5;
    --color-teal: #48d1cc;
    
    /* Shadows */
    --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 */
    --input-focus-bg: #3a3a3a;
    
    /* Header title */
    --title-color: #7fb3d5;
    --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    
    /* Button hover background */
    --btn-hover-overlay: rgba(255,255,255,0.1);
    
    /* Copy button background */
    --copy-btn-bg: #3a3a3a;
    --copy-btn-hover-bg: #4a4a4a;
  }
}

/* ============================================
   메인 컨테이너
   ============================================ */
.date-day-calculator-container {
  position: relative;
  max-width: 1000px;
  width: 100%;
  margin: 8px auto;
  padding: 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-container);
  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;
}

/* ============================================
   다크모드 토글 버튼
   ============================================ */
.dark-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-size: 15.5px;
  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;
}

/* 다크모드 아이콘 전환 */
.date-day-calculator-container:not(.dark) .dark-mode-toggle .icon-dark {
  display: none;
}

.date-day-calculator-container.dark .dark-mode-toggle .icon-light {
  display: none;
}

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

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

.subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
   빠른 액션 버튼
   ============================================ */
.quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-quick {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

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

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

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

.btn-random {
  background: var(--color-success);
  color: #fff;
}

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

/* ============================================
   메인 그리드 (2열 레이아웃)
   ============================================ */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

/* ============================================
   섹션 스타일
   ============================================ */
.input-section,
.result-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 8px;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 10px 0 6px 0;
}

/* ============================================
   입력 요소
   ============================================ */
.input-group {
  margin-bottom: 8px;
}

.input-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

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

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

/* ============================================
   계산 버튼
   ============================================ */
.btn-calculate {
  width: 100%;
  padding: 10px;
  background: var(--color-accent);
  color: #fff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

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

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

/* ============================================
   미니 달력
   ============================================ */
.mini-calendar-section {
  margin-top: 10px;
}

.mini-calendar {
  font-size: 12px;
}

.month-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding: 5px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
}

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

.month-arrow {
  padding: 3px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.15s;
}

.month-arrow:hover {
  background: var(--color-accent);
  color: #fff;
}

.mini-calendar table {
  width: 100%;
  border-collapse: collapse;
}

.mini-calendar th {
  padding: 4px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}

.mini-calendar td {
  padding: 5px;
  text-align: center;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  font-size: 12px;
}

.mini-calendar td:hover {
  background: var(--color-accent);
  color: #fff;
}

.mini-calendar td.current-month {
  color: var(--text-primary);
  font-weight: 500;
}

.mini-calendar td.other-month {
  color: var(--text-light);
  opacity: 0.5;
}

.mini-calendar td.today {
  background: var(--color-success);
  color: #fff;
  font-weight: 700;
}

.mini-calendar td.selected {
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
}

/* ============================================
   결과 카드
   ============================================ */
.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.result-main {
  text-align: center;
}

.result-day-badge {
  display: inline-block;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.result-day-badge.weekend {
  background: var(--color-danger);
}

.result-date-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.result-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   상세 정보
   ============================================ */
.details-section {
  margin-top: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  box-shadow: var(--shadow-sm);
}

.detail-item label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-value-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-value {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-copy-small {
  padding: 4px 6px;
  background: var(--copy-btn-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-copy-small:hover {
  background: var(--copy-btn-hover-bg);
  transform: scale(1.1);
}

.btn-copy-small:active {
  transform: scale(0.95);
}

.btn-copy-small svg {
  color: var(--text-secondary);
}

/* ============================================
   히스토리 섹션
   ============================================ */
.history-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 8px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-md);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.btn-clear-history {
  padding: 5px 10px;
  background: var(--color-danger);
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-clear-history:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
}

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

.history-dates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.history-date-card {
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.history-date-card:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
  background: var(--color-accent);
  color: #fff;
}

.history-date-text {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.history-date-card:hover .history-date-text {
  color: #fff;
}

.history-date-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.history-date-day.weekend {
  color: var(--color-danger);
}

.history-date-card:hover .history-date-day {
  color: #fff;
}

.history-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ============================================
   안내 섹션
   ============================================ */
.info-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 8px;
  box-shadow: var(--shadow-md);
}

.info-content {
  padding: 8px 0;
}

.info-content ul {
  margin: 0;
  padding-left: 20px;
  list-style: none;
}

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

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

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

/* ============================================
   토스트 알림
   ============================================ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  padding: 10px 15px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 1000;
  max-width: 300px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  color: var(--color-success);
  flex-shrink: 0;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toast-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.toast-value {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

/* ============================================
   반응형 - 모바일 (768px 이하)
   ============================================ */
@media (max-width: 768px) {
  .date-day-calculator-container {
    margin: 6px 5px;
    width: calc(100% - 10px);
    padding: 7px;
  }

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

  .subtitle {
    font-size: 12.5px;
  }

  /* 2열 → 1열로 변경 */
  .main-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    flex-wrap: wrap;
  }

  .btn-quick {
    font-size: 12.5px;
    padding: 6px 8px;
  }

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

  .history-dates {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .dark-mode-toggle {
    top: 6px;
    right: 6px;
    padding: 5px 8px;
    font-size: 14px;
  }
}

/* ============================================
   반응형 - 초소형 (480px 이하)
   ============================================ */
@media (max-width: 480px) {
  .date-day-calculator-container {
    padding: 6px;
    border-width: 1px;
  }

  .calculator-header {
    padding: 6px 6px 10px;
  }

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

  .input-section,
  .result-section,
  .history-section,
  .info-section {
    padding: 6px;
  }

  .result-day-badge {
    font-size: 16px;
    padding: 6px 12px;
  }

  .toast {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}