/* ========================================
   택일 계산기 스타일
   달력 + 점수 카드 + 상세 뷰
   ======================================== */

.taegil-page {
  padding-top: 80px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* 입력 폼 */
.taegil-form {
  max-width: 600px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

.form-card {
  background: var(--card-bg);
  border: 1px solid rgba(123,104,238,0.2);
  border-radius: 16px;
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-group select,
.form-group input[type="date"] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(123,104,238,0.3);
  border-radius: 10px;
  color: var(--white);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input[type="date"]:focus {
  border-color: var(--gold);
}

.form-group select option {
  background: #1e2230;
  color: var(--white);
}

.date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
}

.date-range .separator {
  color: var(--gray);
  font-size: 0.9rem;
  padding-top: 0.3rem;
}

/* 선택적 생년월일 섹션 */
.optional-section {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(123,104,238,0.15);
  padding-top: 1rem;
}

.optional-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  user-select: none;
}

.optional-toggle:hover {
  color: var(--gold);
}

.optional-toggle .arrow {
  transition: transform 0.3s;
  font-size: 0.7rem;
}

.optional-toggle.open .arrow {
  transform: rotate(90deg);
}

.optional-fields {
  display: none;
}

.optional-fields.show {
  display: block;
}

.birth-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.birth-row input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(123,104,238,0.3);
  border-radius: 10px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.birth-row input:focus {
  border-color: var(--gold);
}

/* 제출 버튼 */
.taegil-submit {
  text-align: center;
  margin: 1.5rem 0 2rem;
  padding: 0 1.5rem;
}

.btn-find {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 3rem;
  background: linear-gradient(135deg, var(--gold), #aa771c);
  color: #151820;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
}

.btn-find:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212,168,67,0.4);
}

.btn-find:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 로딩 */
.loading-overlay {
  display: none;
  text-align: center;
  padding: 3rem 1.5rem;
}

.loading-overlay.show {
  display: block;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(212,168,67,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 결과 영역 */
.taegil-result {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: none;
}

.taegil-result.show {
  display: block;
}

/* TOP 5 카드 */
.top5-section {
  margin-bottom: 2.5rem;
}

.top5-title {
  text-align: center;
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.top5-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.top5-card {
  background: linear-gradient(135deg, rgba(212,168,67,0.12), rgba(212,168,67,0.04));
  border: 1px solid rgba(212,168,67,0.35);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.3s;
}

.top5-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
}

.top5-rank {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.top5-date {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.2rem;
}

.top5-day {
  font-size: 0.78rem;
  color: var(--gray);
  margin-bottom: 0.4rem;
}

.top5-label {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* 달력 그리드 */
.calendar-section {
  margin-top: 1.5rem;
}

.calendar-month {
  margin-bottom: 2rem;
}

.calendar-month-title {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

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

.calendar-header-cell {
  text-align: center;
  font-size: 0.72rem;
  color: var(--gray);
  padding: 0.3rem 0;
  font-weight: 500;
}

.calendar-header-cell:first-child {
  color: #e57373;
}

.calendar-header-cell:last-child {
  color: #64b5f6;
}

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

.calendar-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  position: relative;
  font-size: 0.85rem;
  min-height: 44px;
}

.calendar-cell:hover {
  transform: scale(1.08);
  z-index: 2;
}

.calendar-cell.empty {
  cursor: default;
}

.calendar-cell.empty:hover {
  transform: none;
}

.calendar-cell .cell-day {
  font-weight: 600;
  line-height: 1;
}

.calendar-cell .cell-label {
  font-size: 0.55rem;
  margin-top: 2px;
  font-weight: 500;
}

/* 점수별 색상 */
.calendar-cell.score-5 {
  background: rgba(76, 175, 80, 0.25);
  border: 1px solid rgba(76, 175, 80, 0.5);
  color: #a5d6a7;
}

.calendar-cell.score-4 {
  background: rgba(139, 195, 74, 0.2);
  border: 1px solid rgba(139, 195, 74, 0.4);
  color: #c5e1a5;
}

.calendar-cell.score-3 {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--gray);
}

.calendar-cell.score-2 {
  background: rgba(255, 152, 0, 0.2);
  border: 1px solid rgba(255, 152, 0, 0.35);
  color: #ffcc80;
}

.calendar-cell.score-1 {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid rgba(244, 67, 54, 0.35);
  color: #ef9a9a;
}

/* 상세 모달 */
.day-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.day-detail-overlay.show {
  display: flex;
}

.day-detail-card {
  background: var(--purple);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.day-detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.day-detail-close:hover {
  color: var(--white);
}

.day-detail-date {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.3rem;
}

.day-detail-weekday {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.day-detail-pillar {
  display: inline-flex;
  gap: 0.5rem;
  background: rgba(255,255,255,0.06);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.day-detail-pillar span {
  font-size: 1.1rem;
  font-weight: 600;
}

.day-detail-officer {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.day-detail-score {
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.day-detail-reason {
  color: var(--gray);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.day-detail-personal {
  color: #81c784;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* 범례 */
.legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--gray);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.best { background: rgba(76, 175, 80, 0.5); }
.legend-dot.good { background: rgba(139, 195, 74, 0.4); }
.legend-dot.normal { background: rgba(255, 255, 255, 0.1); }
.legend-dot.caution { background: rgba(255, 152, 0, 0.4); }
.legend-dot.bad { background: rgba(244, 67, 54, 0.4); }

/* 점수 라벨 색상 */
.label-best {
  background: rgba(76, 175, 80, 0.25);
  color: #a5d6a7;
}

.label-good {
  background: rgba(139, 195, 74, 0.2);
  color: #c5e1a5;
}

.label-normal {
  background: rgba(255, 255, 255, 0.1);
  color: var(--gray);
}

.label-caution {
  background: rgba(255, 152, 0, 0.2);
  color: #ffcc80;
}

.label-bad {
  background: rgba(244, 67, 54, 0.2);
  color: #ef9a9a;
}

/* SSR 콘텐츠 */
.seo-content {
  max-width: 700px;
  margin: 3rem auto 0;
  padding: 0 1.5rem 3rem;
}

.seo-content h2 {
  color: var(--gold);
  font-size: 1.2rem;
  margin: 2rem 0 0.8rem;
}

.seo-content h3 {
  color: var(--white);
  font-size: 1rem;
  margin: 1.5rem 0 0.6rem;
}

.seo-content p {
  color: var(--gray);
  font-size: 0.9rem;
  line-height: 1.8;
  margin-bottom: 0.8rem;
}

.seo-content ul {
  color: var(--gray);
  font-size: 0.9rem;
  line-height: 1.8;
  padding-left: 1.2rem;
  margin-bottom: 1rem;
}

.officer-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.officer-table th,
.officer-table td {
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(123,104,238,0.2);
  font-size: 0.85rem;
}

.officer-table th {
  background: rgba(212,168,67,0.1);
  color: var(--gold);
  font-weight: 600;
}

.officer-table td {
  color: var(--gray);
}

/* 반응형 */
@media (max-width: 600px) {
  .form-card {
    padding: 1.5rem;
  }
  .date-range {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .date-range .separator {
    display: none;
  }
  .birth-row {
    grid-template-columns: 1fr 1fr;
  }
  .top5-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  .calendar-cell {
    font-size: 0.75rem;
    min-height: 38px;
  }
  .calendar-cell .cell-label {
    font-size: 0.5rem;
  }
}
