/* utility-header.css — 생활계산소 헤더/푸터 셸 (§5, §7)
   기존 default.css 의 고정폭(min-width:1200px)·float 레이아웃을 중화하고 흰색 기반 중앙정렬로 재구성. */

/* default.css 레이아웃 중화 (모든 테마 페이지 공통) */
#hd, #wrapper, #ft { min-width: 0 !important; width: 100%; }
#wrapper { width: auto !important; }
#container_wr { max-width: none !important; width: auto !important; float: none !important; }
#container { float: none !important; width: 100% !important; max-width: var(--container); margin: 0 auto !important; padding: 0 var(--sp-8); box-sizing: border-box; }
#container:after { content: none; }
body { background: var(--color-bg); }
body.ucalc-menu-open { overflow: hidden; }
hr { display: none; }

/* 헤더 */
.uhd { position: sticky; top: 0; z-index: 900; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.uhd-inner { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-8); height: 72px; box-sizing: border-box;
  display: flex; align-items: center; gap: var(--sp-6); }
.uhd-logo { font-family: var(--font-sans); font-size: 22px; font-weight: 800; color: var(--color-primary); text-decoration: none; white-space: nowrap; letter-spacing: -.02em; }
.uhd-logo b { color: var(--color-text); }
.uhd-gnb { flex: 1; }
.uhd-gnb-ul { list-style: none; display: flex; gap: var(--sp-2); margin: 0; padding: 0; }
.uhd-gnb-ul > li { position: relative; }
.uhd-gnb-ul > li > a { display: inline-flex; align-items: center; height: 72px; padding: 0 14px; font-size: 16px; font-weight: 600; color: var(--color-text); text-decoration: none; }
.uhd-gnb-ul > li > a:hover, .uhd-gnb-ul > li > a:focus-visible { color: var(--color-primary); }
.uhd-gnb-ul > li.has-sub > a::after { content: ''; width: 6px; height: 6px; margin-left: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.uhd-sub { position: absolute; top: calc(100% - 1px); left: 0; z-index: 20; display: none; min-width: 190px; margin: 0; padding: 8px; list-style: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow-card-hover); }
.uhd-gnb-ul > li:last-child .uhd-sub { right: 0; left: auto; }
.uhd-gnb-ul > li:hover > .uhd-sub, .uhd-gnb-ul > li:focus-within > .uhd-sub { display: block; }
.uhd-sub a { display: block; padding: 10px 12px; border-radius: 7px; color: var(--color-text); text-decoration: none; white-space: nowrap; }
.uhd-sub a:hover, .uhd-sub a:focus-visible { color: var(--color-primary); background: var(--color-surface-soft); }
.uhd-search { display: flex; align-items: center; }
.uhd-search input { width: 220px; height: 42px; padding: 0 14px; font-size: 14px; border: 1px solid var(--color-border-strong); border-radius: 999px; background: var(--color-surface-soft); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast); }
.uhd-search input:focus { background: var(--color-surface); }
.uhd-login { font-size: 14px; color: var(--color-text-secondary); text-decoration: none; white-space: nowrap; }
.uhd-login:hover { color: var(--color-primary); }
.uhd-ham { display: none; flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; flex-direction: column; justify-content: center; gap: 5px; }
.uhd-ham:hover { background: var(--color-surface-soft); }
.uhd-ham span { display: block; width: 22px; height: 2px; background: var(--color-text); margin: 0 auto; }

/* 모바일 drawer */
.uhd-drawer { position: fixed; inset: 0; z-index: 950; display: none; }
.uhd-drawer[hidden] { display: none !important; }
.uhd-drawer.is-open { display: block; }
.uhd-drawer-dim { position: absolute; inset: 0; background: rgba(16,24,40,.45); }
.uhd-drawer-panel { position: absolute; top: 0; right: 0; width: 82%; max-width: 360px; height: 100%; background: #fff; padding: var(--sp-6); overflow-y: auto; }
.uhd-drawer-close { float: right; width: 40px; height: 40px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.uhd-dnav { list-style: none; margin: 48px 0 0; padding: 0; }
.uhd-dnav > li { border-bottom: 1px solid var(--color-border); }
.uhd-dnav > li > a { display: block; padding: 14px 4px; font-size: 17px; font-weight: 600; color: var(--color-text); text-decoration: none; }
.uhd-dnav .uhd-dsub { list-style: none; margin: 0 0 10px; padding: 0 0 0 10px; }
.uhd-dnav .uhd-dsub a { display: block; padding: 8px 4px; font-size: 15px; color: var(--color-text-secondary); text-decoration: none; }
.uhd-setup { font-size: 13px; color: var(--color-text-secondary); padding: 10px 0; }
.uhd-setup-drawer { margin-top: 48px; }

@media (max-width: 1023px) {
  .uhd-gnb, .uhd-only-pc { display: none; }
  .uhd-ham { display: flex; }
  .uhd-search input { width: 150px; }
}
@media (max-width: 767px) {
  .uhd-inner { height: 60px; padding: 0 20px; gap: var(--sp-3); }
  #container { padding: 0 20px; }
  .uhd-search { display: none; }
  .uhd-logo { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

/* 푸터 */
#ft { background: var(--color-surface); border-top: 1px solid var(--color-border); margin-top: var(--sp-8); }
#ft_wr { display: block; width: 100%; max-width: var(--container); margin: 0 auto; padding: var(--sp-8) var(--sp-8) var(--sp-4); box-sizing: border-box; text-align: center; }
.ucalc-foot-brand { font-size: 18px; font-weight: 800; color: var(--color-primary); letter-spacing: -.02em; }
.ucalc-foot-desc { font-size: 13px; color: var(--color-text-secondary); margin: 8px auto 12px; max-width: 560px; }
#ft_copy { width: 100% !important; max-width: 100%; margin: 0 auto; padding: 12px 0 0; box-sizing: border-box; border-top: 1px solid var(--color-border); font-size: 12px; color: var(--color-text-secondary); }
.ucalc-foot-links { width: 100%; box-sizing: border-box; }
#top_btn { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); cursor: pointer;
  z-index: 800; box-shadow: var(--shadow-card); font-size: 18px; line-height: 1; opacity: 0; visibility: hidden; transition: opacity .2s ease; }
#top_btn.is-show { opacity: 1; visibility: visible; }

/* 로그인/인증 페이지 */
.ucalc-auth { max-width: 420px; margin: var(--sp-16) auto; padding: 0 var(--sp-4); }
.ucalc-auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: var(--sp-8); }
.ucalc-auth-title { font-size: 24px; font-weight: 700; text-align: center; margin: 0 0 var(--sp-2); font-family: var(--font-sans); }
.ucalc-auth-sub { font-size: 14px; color: var(--color-text-secondary); text-align: center; margin: 0 0 var(--sp-6); }
.ucalc-auth-field { margin-bottom: var(--sp-4); }
.ucalc-auth-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: var(--sp-2); }
.ucalc-auth-field input[type="text"], .ucalc-auth-field input[type="password"] {
  width: 100%; min-height: 48px; padding: 0 var(--sp-4); font-size: 16px; font-family: var(--font-sans);
  border: 1px solid var(--color-border); border-radius: var(--radius-input); background: var(--color-surface); }
.ucalc-auth-field input:focus { border-color: var(--color-primary) !important; box-shadow: none; outline: none; }
.ucalc-auth .ucalc-btn { width: 100%; margin-top: var(--sp-2); }
.ucalc-auth-opts { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-4); font-size: 14px; }
.ucalc-auth-opts label { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-secondary); }
.ucalc-auth-opts a { color: var(--color-text-secondary); text-decoration: none; }
.ucalc-auth-opts a:hover { color: var(--color-primary); }

/* ===== 구 default.css 전역 규칙 중화 (생활계산소 범위) ===== */
.ucalc-detail, .ucalc-home, .ucalc-list, .uhd, #ft, .ucalc-cookie-banner, .ucalc-foot-links { font-size: 16px; }
.ucalc-detail h1, .ucalc-detail h2, .ucalc-detail h3, .ucalc-detail h4,
.ucalc-home h1, .ucalc-home h2, .ucalc-home h3,
.ucalc-list h1, .uhd-logo, .ucalc-card-title, .ucalc-section-title { font-family: var(--font-sans); }
/* default.css 가 legend 를 숨김 → 폼 그룹 라벨 복구 */
.ucalc-detail legend, .ucalc-home legend, .ucalc-list legend, .ucalc-group legend {
  position: static !important; width: auto !important; height: auto !important;
  font-size: 14px !important; line-height: 1.5 !important; text-indent: 0 !important;
  overflow: visible !important; margin: 0 0 var(--sp-2) !important; clip: auto !important;
}
/* 폼 컨트롤 폰트 + 포커스(파란 그림자/강제 테두리) 중화 */
.ucalc-input, .ucalc-btn, .uhd-search input, .ucalc-form select, .ucalc-form input { font-family: var(--font-sans); }
.ucalc-input:focus, .uhd-search input:focus, .ucalc-form select:focus, .ucalc-form input:focus {
  box-shadow: var(--shadow-focus) !important; border: 1px solid var(--color-primary) !important; outline: none;
}
.ucalc-content a { color: var(--color-primary); text-decoration: underline; }

@media (max-width: 767px) {
  #ft_wr { padding: var(--sp-8) 20px var(--sp-4); }
  .ucalc-foot-links { padding-right: 20px; padding-left: 20px; }
}
