/* ovulation-calc/app.css */

.ovulation-app {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.tool-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  margin-bottom: 2rem;
}

.tool-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.tool-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #EC4899;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #FFFFFF 30%, #F472B6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tool-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 입력 폼 그리드 */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.form-input,
.form-select {
  width: 100%;
  height: 48px;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #F472B6;
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

.irregular-toggle-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.5);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-switch-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-custom {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #EC4899;
}

/* 불규칙 주기 서브 그리드 */
.irregular-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.advanced-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0;
  align-self: flex-start;
}

.advanced-toggle-btn:hover {
  color: var(--primary-accent);
}

.btn-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-calc-main {
  min-height: 52px;
  background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-calc-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

.btn-calc-main:active {
  transform: translateY(0);
}

.secondary-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-tool-secondary {
  flex: 1;
  min-height: 44px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-tool-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 결과 디스플레이 영역 */
.result-section {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1.5rem;
}

.result-card-highlight {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12) 0%, rgba(147, 51, 234, 0.12) 100%);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.highlight-label {
  font-size: 0.85rem;
  color: #F472B6;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.highlight-date {
  font-size: 1.8rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.highlight-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* 요약 그리드 */
.summary-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.summary-mini-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.sm-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.sm-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
}

/* 타임라인 바 */
.timeline-section {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.section-subtitle {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(30, 41, 59, 0.4);
  border-left: 4px solid #64748B;
  transition: all 0.15s ease;
}

.timeline-row.level-ovulation {
  background: rgba(236, 72, 153, 0.2);
  border-left-color: #EC4899;
}

.timeline-row.level-peak {
  background: rgba(244, 114, 182, 0.15);
  border-left-color: #F472B6;
}

.timeline-row.level-high {
  background: rgba(168, 85, 247, 0.15);
  border-left-color: #A855F7;
}

.timeline-row.level-medium {
  background: rgba(59, 130, 246, 0.12);
  border-left-color: #3B82F6;
}

.timeline-date-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.timeline-date {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.timeline-dow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
}

.badge-ovulation { background: #EC4899; color: #FFFFFF; }
.badge-peak { background: #F472B6; color: #1E293B; }
.badge-high { background: #A855F7; color: #FFFFFF; }
.badge-medium { background: #3B82F6; color: #FFFFFF; }
.badge-low { background: #64748B; color: #FFFFFF; }
.badge-post { background: #475569; color: #E2E8F0; }

/* 미니 캘린더 */
.calendar-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.cal-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.cal-month-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-nav-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.cal-nav-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: var(--text-primary);
}

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

.cal-dow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
}

.cal-dow:first-child { color: #F87171; }
.cal-dow:last-child { color: #60A5FA; }

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.3);
  position: relative;
  border: 1px solid transparent;
}

.cal-cell.empty {
  background: transparent;
  pointer-events: none;
}

.cal-cell.is-sunday { color: #F87171; }
.cal-cell.is-saturday { color: #60A5FA; }

.cal-cell.evt-period {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.cal-cell.evt-fertile {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93C5FD;
}

.cal-cell.evt-peak {
  background: rgba(244, 114, 182, 0.3);
  border-color: rgba(244, 114, 182, 0.6);
  color: #FDF2F8;
}

.cal-cell.evt-ovulation {
  background: #EC4899;
  color: #FFFFFF;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.7);
}

.cal-cell.evt-nextPeriod {
  border: 2px dashed rgba(239, 68, 68, 0.8);
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dot-period { background: #EF4444; }
.dot-fertile { background: #3B82F6; }
.dot-peak { background: #F472B6; }
.dot-ovulation { background: #EC4899; }
.dot-next { border: 2px dashed #EF4444; }

/* 단계별 계산 과정 details */
.calc-steps-details {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.calc-steps-summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.calc-steps-summary:hover {
  color: var(--text-primary);
}

.calc-steps-content {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 가이드 아티클 */
.guide-article {
  max-width: 900px;
  margin: 2rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.guide-article h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #FFFFFF 20%, #F472B6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.guide-article h2:first-of-type {
  margin-top: 0;
}

.guide-article h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #F472B6;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.guide-article p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.guide-article ul,
.guide-article ol {
  margin-left: 1.4rem;
  margin-bottom: 1.2rem;
}

.guide-article li {
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.guide-callout {
  background: rgba(15, 23, 42, 0.7);
  border-left: 4px solid #EC4899;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.25rem 0;
}

.guide-callout.warning {
  border-left-color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
}

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

/* 반응형 미디어 쿼리 */
@media (min-width: 640px) {
  .btn-group {
    grid-template-columns: 2fr 1fr 1fr;
  }
}
