/* ═══════════════════════════════════════════
   在线万年历 - 自定义样式
   ═══════════════════════════════════════════ */

:root {
  --bg: #FAFAF9; --bg-alt: #F5F5F4; --surface: #FFFFFF;
  --border: #E7E5E4; --border-strong: #D6D3D1;
  --text: #1E293B; --text-secondary: #52525B; --text-muted: #71717A;
  --primary: #4F46E5; --primary-hover: #4338CA;
  --primary-light: rgba(79, 70, 229, 0.08);
  --secondary: #F97316; --accent: #EC4899; --success: #059669;
  --red: #DC2626; --orange: #EA580C; --green: #16A34A;
  --radius: 10px; --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.6; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

#header.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.calendar-section { padding: 24px 0 32px; }

.calendar-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.calendar-panel:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.08); }

.calendar-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.calendar-month-label {
  font-size: 20px; font-weight: 700; color: var(--text);
}

.nav-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease; color: var(--text-secondary);
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.today-btn {
  padding: 8px 16px; background: var(--primary); border: none;
  border-radius: 100px; font-family: inherit; font-size: 13px; font-weight: 500;
  color: white; cursor: pointer; transition: background 0.15s ease;
}
.today-btn:hover { background: var(--primary-hover); }

.year-select-group { display: flex; align-items: center; gap: 8px; }

.year-input {
  width: 70px; padding: 8px 10px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 8px; font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 14px; text-align: center; color: var(--text); outline: none;
  transition: all 0.2s ease;
}
.year-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

.calendar-grid { padding: 16px; }

.weekday-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; gap: 4px; margin-bottom: 8px;
}
.weekday-cell {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding: 8px 0; text-transform: uppercase; letter-spacing: 0.04em;
}
.weekday-cell.weekend { color: var(--red); }

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

.day-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease;
  position: relative; padding: 4px 2px;
  font-size: 14px; font-weight: 500; color: var(--text);
}
.day-cell:hover { background: var(--primary-light); }
.day-cell.empty { cursor: default; }
.day-cell.empty:hover { background: none; }

.day-cell.today {
  background: var(--primary); color: white; font-weight: 700;
}
.day-cell.today:hover { background: var(--primary-hover); }

.day-cell.weekend { color: var(--red); }
.day-cell.today.weekend { color: white; }

.day-lunar {
  font-size: 10px; color: var(--text-muted); margin-top: 1px;
  line-height: 1.2; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; text-align: center;
}
.day-cell.today .day-lunar { color: rgba(255,255,255,0.8); }

.day-solar-term {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--green); font-weight: 600; white-space: nowrap;
}
.day-cell.today .day-solar-term { color: rgba(255,255,255,0.9); }

.day-festival {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--red); font-weight: 600; white-space: nowrap;
}
.day-cell.today .day-festival { color: rgba(255,255,255,0.9); }

/* Selected day info */
.selected-day-info {
  margin: 0 16px 16px; padding: 16px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; gap: 20px; flex-wrap: wrap;
}
.info-item { display: flex; flex-direction: column; gap: 2px; min-width: 100px; }
.info-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-value { font-size: 15px; font-weight: 600; color: var(--text); }
.info-value.highlight { color: var(--red); }

.guide-section {
  margin-top: 16px; margin-bottom: 64px;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.guide-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 20px;
  background: none; border: none; cursor: pointer;
  transition: background 0.15s ease;
}
.guide-toggle:hover { background: var(--bg-alt); }
.guide-toggle-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #1E293B; }
.guide-toggle.open .toggle-arrow { transform: rotate(180deg); }
.toggle-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.guide-list { padding: 0 20px 20px; }
.guide-list.hidden { display: none; }
.guide-item { padding: 16px 0; border-top: 1px solid var(--border); }
.guide-item:first-child { border-top: 1px solid var(--border); }
.guide-item-title { font-size: 14px; font-weight: 600; color: #1E293B; margin-bottom: 6px; }
.guide-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.guide-item-body kbd { padding: 1px 6px; background: var(--bg-alt); border: 1px solid var(--border-strong); border-radius: 4px; font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 12px; color: var(--text-secondary); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #A5B4FC; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
::selection { background: rgba(79, 70, 229, 0.2); color: #1E293B; }

@media (max-width: 768px) {
  .page { padding: 0 16px; }
  .calendar-header-bar { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .calendar-month-label { font-size: 16px; }
  .day-cell { font-size: 12px; padding: 2px; }
  .day-lunar { font-size: 8px; }
  .selected-day-info { flex-direction: column; gap: 8px; }
}
