/* ===================================================
   EveryPet AI 정밀 급여량 계산기 - 메인 스타일시트
   =================================================== */

/* ── 기본 리셋 & 변수 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #F97316;
  --primary-dark:   #EA580C;
  --primary-light:  #FFF7ED;
  --primary-mid:    #FFEDD5;
  --secondary:      #3B82F6;
  --success:        #22C55E;
  --warning:        #EAB308;
  --danger:         #EF4444;
  --text-dark:      #1E293B;
  --text-mid:       #475569;
  --text-light:     #94A3B8;
  --border:         #E2E8F0;
  --bg-page:        #F8FAFC;
  --bg-card:        #FFFFFF;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.12);
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --transition:     .22s ease;
  --font:           'Noto Sans KR', sans-serif;
}

html, body { overflow-x: hidden; width: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 15px;
}

/* ── 페이지 레이아웃 ── */
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* ── 헤더 ── */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 32px 24px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.header-inner { position: relative; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.logo-icon { font-size: 2.4rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.logo-brand { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.5px; }
.logo-sub   { display: block; font-size: 1.05rem; font-weight: 500; opacity: .88; }
.header-desc {
  font-size: .88rem; opacity: .82; max-width: 520px; margin: 0 auto;
  line-height: 1.5;
}

/* ── 메인 콘텐츠 ── */
.main-content { flex: 1; padding: 28px 16px 40px; }
.calculator-container { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* ── 카드 ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-dark);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 22px; padding-bottom: 14px;
  border-bottom: 2px solid var(--primary-mid);
}
.card-title i { color: var(--primary); font-size: 1.1rem; }

.step-badge {
  background: var(--primary);
  color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: .5px;
}

/* ── 폼 레이아웃 ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group--full { grid-column: 1 / -1; }

label {
  font-size: .82rem; font-weight: 600; color: var(--text-mid);
  display: flex; align-items: center; gap: 4px;
}
.required { color: var(--primary); }

/* ── 셀렉트 ── */
.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); pointer-events: none; font-size: .8rem;
}
select {
  width: 100%; padding: 11px 36px 11px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font-family: var(--font); font-size: .92rem;
  color: var(--text-dark); appearance: none; cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.15); }
select:disabled { background: #F8FAFC; color: var(--text-light); cursor: not-allowed; }

/* ── 인풋 ── */
input[type="number"], input[type="text"] {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .92rem; color: var(--text-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.15); }
input[readonly] { background: #F8FAFC; color: var(--text-mid); cursor: default; }
input::placeholder { color: var(--text-light); }

/* 성분 그리드 */
.nutrient-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* kcal 행 */
.kcal-input-wrap { display: flex; gap: 8px; }
.kcal-input-wrap input { flex: 1; }
#calc-kcal-btn {
  flex-shrink: 0; padding: 0 16px;
  background: var(--primary-mid); border: none; border-radius: var(--radius-sm);
  color: var(--primary-dark); font-size: .82rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: background var(--transition);
}
#calc-kcal-btn:hover { background: var(--primary); color: #fff; }

.field-hint { font-size: .75rem; color: var(--text-light); margin-top: 4px; line-height: 1.4; }

/* 직접입력 안내 */
.manual-notice {
  background: #EFF6FF; border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .83rem; color: #1D4ED8;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}

/* ── 활동량 카드 ── */
.activity-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: stretch; }
.activity-card { cursor: pointer; display: flex; }
.activity-card input[type="radio"] { display: none; }
.activity-card-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 16px 10px;
  border: 2px solid var(--border); border-radius: var(--radius-md);
  background: #fff; text-align: center;
  transition: all var(--transition);
  width: 100%; height: 100%;
}
.activity-card input:checked + .activity-card-inner {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.activity-card:hover .activity-card-inner { border-color: var(--primary); }
.activity-icon { font-size: 1.8rem; }
.activity-name { font-size: .9rem; font-weight: 700; color: var(--text-dark); }
.activity-desc { font-size: .73rem; color: var(--text-mid); line-height: 1.4; }

/* ── 무게 입력 ── */
.weight-input-wrap { display: flex; align-items: center; gap: 0; }
.weight-input-wrap input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.unit {
  background: var(--primary-mid); color: var(--primary-dark);
  padding: 11px 14px; border: 1.5px solid var(--border);
  border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-weight: 600; font-size: .88rem; white-space: nowrap;
}

/* 크기 안내 */
.size-guide {
  background: #F0FDF4; border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .82rem; color: #166534;
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 0;
}
.size-guide i { flex-shrink: 0; margin-top: 2px; }

/* ── 툴팁 ── */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-icon { color: var(--text-light); cursor: help; font-size: .85rem; }
.tooltip-text {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); width: 220px;
  background: var(--text-dark); color: #fff; border-radius: 6px;
  padding: 8px 10px; font-size: .75rem; line-height: 1.45;
  font-weight: 400; z-index: 100; white-space: normal;
  box-shadow: var(--shadow-md);
}
.tooltip-text::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--text-dark);
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ── 계산 버튼 ── */
.calc-btn {
  width: 100%; padding: 17px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-family: var(--font); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 10px; box-shadow: 0 4px 14px rgba(249,115,22,.4);
  transition: transform .18s, box-shadow .18s;
  letter-spacing: -.2px;
}
.calc-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(249,115,22,.45); }
.calc-btn:active { transform: translateY(0);    box-shadow: 0 2px 8px  rgba(249,115,22,.35); }

/* ── 결과 섹션 ── */
.result-section { display: flex; flex-direction: column; gap: 18px; animation: fadeInUp .5s ease; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 체형 판정 카드 */
.body-condition-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 24px 28px;
  border: 1px solid var(--border);
}
.bcc-title {
  font-size: 1rem; font-weight: 700; color: var(--text-dark);
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
}
.bcc-title i { color: var(--secondary); }

.bcc-bar-wrap { margin-bottom: 6px; }
.bcc-bar {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-radius: 40px; overflow: hidden; height: 22px;
}
.bcc-segment { display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; }
.bcc-thin   { background: #60A5FA; }
.bcc-normal { background: #22C55E; }
.bcc-over   { background: #F97316; }

.bcc-marker-wrap { position: relative; height: 0; }
.bcc-marker {
  position: absolute; top: -3px; width: 16px; height: 16px;
  background: var(--text-dark); border: 3px solid #fff;
  border-radius: 50%; transform: translateX(-50%);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: left .6s cubic-bezier(.4,0,.2,1);
}

.bcc-labels {
  display: flex; justify-content: space-between;
  font-size: .75rem; color: var(--text-light);
  margin-top: 10px; padding: 0 2px;
}

.bcc-result-text {
  margin-top: 14px; padding: 12px 16px;
  border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600;
  line-height: 1.5;
}
.bcc-thin-bg    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.bcc-normal-bg  { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.bcc-over-bg    { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }

/* 급여량 메인 카드 */
.feed-result-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 24px rgba(249,115,22,.35);
  padding: 28px;
  color: #fff;
  text-align: center;
}
.feed-result-header {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 1rem; font-weight: 600; opacity: .9;
  margin-bottom: 16px;
}
.feed-result-header i { font-size: 1.2rem; }

.amount-main { font-size: 3rem; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.amount-sub  { font-size: .88rem; opacity: .85; margin-top: 8px; line-height: 1.5; }

.feed-times-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 20px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-md); padding: 16px;
}
.feed-time-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ft-label { font-size: .8rem; opacity: .85; }
.ft-value { font-size: 1.45rem; font-weight: 700; }

/* 계산 근거 상세 */
.result-detail-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 24px 28px;
  border: 1px solid var(--border);
}
.detail-title {
  font-size: .95rem; font-weight: 700; color: var(--text-dark);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.detail-title i { color: var(--primary); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item {
  background: #F8FAFC; border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.detail-item .di-label { font-size: .75rem; color: var(--text-light); margin-bottom: 2px; }
.detail-item .di-value { font-size: .92rem; font-weight: 600; color: var(--text-dark); }
.detail-item.di-highlight { background: var(--primary-light); border: 1px solid #FED7AA; }
.detail-item.di-highlight .di-value { color: var(--primary-dark); }

/* 급여 가이드 */
.guide-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 24px 28px;
  border: 1px solid var(--border);
}
.guide-title {
  font-size: .95rem; font-weight: 700; color: var(--text-dark);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.guide-title i { color: var(--warning); }
.guide-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.guide-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .87rem; color: var(--text-mid); line-height: 1.5;
}
.guide-list li::before {
  content: '✓'; flex-shrink: 0;
  width: 20px; height: 20px;
  background: var(--success); color: #fff;
  border-radius: 50%; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

/* 주의사항 */
.warning-card {
  background: #FFFBEB; border: 1px solid #FDE68A;
  border-radius: var(--radius-md); padding: 16px 20px;
  display: flex; align-items: flex-start; gap: 12px;
  font-size: .83rem; color: #92400E; line-height: 1.5;
}
.warning-card i { flex-shrink: 0; font-size: 1.1rem; color: var(--warning); margin-top: 2px; }
.warning-card strong { display: block; font-weight: 700; margin-bottom: 4px; color: #78350F; }

/* 다시 계산 버튼 */
.reset-btn {
  width: 100%; padding: 14px;
  background: #fff; color: var(--text-mid);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 8px; transition: all var(--transition);
}
.reset-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── 푸터 ── */
.site-footer {
  background: var(--text-dark); color: rgba(255,255,255,.55);
  text-align: center; padding: 18px 16px;
  font-size: .78rem;
}

/* ── 유효성 검사 오류 ── */
.input-error { border-color: var(--danger) !important; }
.error-msg {
  font-size: .75rem; color: var(--danger);
  margin-top: 2px; display: flex; align-items: center; gap: 4px;
}

/* ── 로딩 스피너 ── */
.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 30px;
  font-size: .95rem; color: var(--text-mid);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 반응형 ── */
@media (max-width: 600px) {
  .site-header { padding: 22px 16px 20px; }
  .logo-brand { font-size: 1.5rem; }
  .logo-sub { font-size: .9rem; }
  .card { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .nutrient-grid { grid-template-columns: 1fr; }
  .activity-cards { grid-template-columns: 1fr; gap: 8px; }
  .activity-card-inner { flex-direction: row; text-align: left; padding: 12px 16px; }
  .activity-icon { font-size: 1.5rem; }
  .amount-main { font-size: 2.4rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .feed-times-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px 12px 32px; }
  .calc-btn { font-size: 1rem; padding: 15px; }
}

@media (max-width: 380px) {
  .logo { flex-direction: column; gap: 6px; }
}
