/* ============================================================
   common.css — 한국외식업데이터 공통 스타일
   모든 계산기 페이지에서 공유합니다.
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --primary: #1a365d;
  --primary-light: #2a5298;
  --primary-faint: #ebf4ff;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --success: #2f855a;
  --danger: #c53030;
  --warning: #b7791f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --radius: 10px;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

/* ── Float Banner ── */
.float-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1a1a1a;
  color: #fff;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 20px 10px;
  border-radius: 14px;
  text-decoration: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.38), 0 0 0 1px rgba(255,255,255,.08);
  width: calc(100% - 32px);
  max-width: 480px;
  overflow: hidden;
  transition: opacity .3s, transform .3s;
}
.float-banner.shrinking {
  animation: bannerShrink .5s cubic-bezier(.55,.06,.68,.19) forwards !important;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes bannerShrink {
  to { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.9); }
}
.float-banner-gauge {
  position: absolute;
  bottom: 0; left: 0;
  height: 6px;
  width: 100%;
  background: linear-gradient(90deg, #FF5B2E, #FF9A00);
  transform-origin: left center;
  animation: gaugeOut 30s linear .8s both;
}
@keyframes gaugeOut {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.float-banner-img {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.12);
}
.float-banner-text { flex: 1; min-width: 0; line-height: 1.45; }
.float-banner-text strong {
  display: block;
  font-size: 13px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.float-banner-text span { font-size: 11px; color: rgba(255,255,255,.55); }
.float-banner-timer {
  flex-shrink: 0;
  position: relative;
  width: 34px; height: 34px;
}
.float-banner-timer svg {
  position: absolute; top: 0; left: 0;
  transform: rotate(-90deg);
}
.float-banner-timer-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #FF5B2E;
  pointer-events: none;
}
.float-banner-cta {
  flex-shrink: 0;
  background: #FF5B2E; color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 8px 13px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .15s;
}
.float-banner:hover .float-banner-cta { background: #E04420; }
.float-banner-close {
  flex-shrink: 0;
  background: none; border: none;
  color: rgba(255,255,255,.30);
  font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 4px;
  transition: color .15s;
}
.float-banner-close:hover { color: rgba(255,255,255,.75); }

/* ── Mini Banner ── */
.float-mini {
  position: fixed;
  bottom: 24px; right: 16px;
  z-index: 200;
  background: #1a1a1a;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.40), 0 0 0 1px rgba(255,255,255,.08);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  text-decoration: none; color: #fff;
  animation: miniIn .4s cubic-bezier(.34,1.56,.64,1) both;
  width: 120px; text-align: center;
}
.float-mini.visible { display: flex; }
@keyframes miniIn {
  from { opacity: 0; transform: translateY(16px) scale(.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.float-mini img {
  width: 88px; height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
}
.float-mini span {
  font-size: 12px; font-weight: 700;
  color: #FF5B2E;
  line-height: 1.5;
  word-break: keep-all;
}

/* ── Ad Modal ── */
.ad-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayIn .3s ease both;
}
.ad-modal-overlay.visible { display: flex; }
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.ad-modal {
  background: #1a1a1a;
  border-radius: 20px;
  width: 100%; max-width: 420px;
  padding: 28px 24px 32px;
  color: #fff;
  animation: modalScale .4s cubic-bezier(.34,1.2,.64,1) both;
  position: relative; overflow: hidden;
}
@keyframes modalScale {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: scale(1); }
}
@media (max-width: 960px) {
  .ad-modal-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0; /* 각 페이지에서 필요시 하단 오프셋 추가 */
  }
  .ad-modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    animation: modalUp .4s cubic-bezier(.34,1.2,.64,1) both;
  }
  @keyframes modalUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}
.ad-modal-close {
  position: absolute; top: 14px; right: 16px;
  background: rgba(255,255,255,.10); border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px; line-height: 1;
  width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.ad-modal-close:hover { background: rgba(255,255,255,.20); }
.ad-modal-inner {
  display: flex; gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.ad-modal-inner img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  flex-shrink: 0;
}
.ad-modal-body h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; line-height: 1.4; }
.ad-modal-body p  { font-size: 13px; color: rgba(255,255,255,.60); line-height: 1.6; }
.ad-modal-body strong { color: #FF5B2E; }
.ad-modal-cta {
  display: block;
  background: #FF5B2E; color: #fff;
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  font-size: 16px; font-weight: 800;
  text-decoration: none;
  transition: background .15s;
}
.ad-modal-cta:hover { background: #E04420; }
.ad-modal-gauge {
  position: absolute; bottom: 0; left: 0;
  height: 5px; width: 100%;
  background: linear-gradient(90deg, #FF5B2E, #FF9A00);
  transform-origin: left center;
}
.ad-modal-later {
  display: block;
  margin-top: 10px;
  background: none; border: none;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,.40);
  cursor: pointer;
  padding: 6px 0;
  transition: color .15s;
}
.ad-modal-later:hover { color: rgba(255,255,255,.70); }

/* ── Header ── */
.header {
  background: var(--primary);
  color: white;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  position: sticky; top: 0; z-index: 300;
}
.header-icon { height: 34px; width: auto; display: block; object-fit: contain; flex-shrink: 0; }
.header-brand { display: flex; flex-direction: column; justify-content: center; flex-shrink: 0; }
.header-brand h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }

/* ── Header Nav (desktop) ── */
.header-nav {
  display: flex; align-items: stretch;
  height: 100%;
  margin-left: 16px; gap: 0;
}
.header-nav .nav-item {
  display: flex; align-items: center; gap: 5px;
  padding: 0 9px; height: 100%;
  font-size: 0.77rem; font-weight: 600;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s, border-color .15s;
  flex-shrink: 0; user-select: none;
}
.header-nav .nav-item:hover { color: white; }
.header-nav .nav-item.active { color: white; border-bottom-color: var(--accent); }
.header-nav .nav-divider {
  width: 1px; background: rgba(255,255,255,.15);
  margin: 14px 4px; flex-shrink: 0;
}
.header-nav .nav-icon { font-size: 0.9rem; }
.header-nav .nav-badge {
  font-size: 0.58rem; font-weight: 700;
  padding: 1px 5px; border-radius: 99px;
  margin-left: 2px; flex-shrink: 0;
}
.header-nav .nav-badge.soon {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.6);
}

/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: rgba(255,255,255,.12);
  border: none; border-radius: 8px; cursor: pointer; flex-shrink: 0;
}
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: white; border-radius: 2px; transition: all .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile Menu ── */
.mobile-menu {
  display: none;
  position: fixed; top: 60px; left: 0; right: 0;
  background: var(--primary);
  border-top: 1px solid rgba(255,255,255,.10);
  z-index: 290;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.mobile-menu.open { display: flex; }
.mobile-menu .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  font-size: 0.9rem; font-weight: 600;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.mobile-menu .nav-item:hover,
.mobile-menu .nav-item.active {
  background: rgba(255,255,255,.08);
  color: white;
  border-left-color: var(--accent);
}
.mobile-menu .nav-badge.soon {
  font-size: 0.65rem; padding: 2px 6px; border-radius: 99px;
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.6);
  margin-left: auto;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ── Responsive: 헤더 ── */
@media (max-width: 960px) {
  .header { padding: 0 16px; }
  .header-nav { display: none; }
  .hamburger { display: flex; }
}

/* ── 공통 레이아웃 ── */
.page-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}
.page-title {
  font-size: 1.5rem; font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── 카드 ── */
.calc-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 16px;
}
.calc-card + .calc-card { margin-top: 0; }
.card-section-label {
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}

/* ── 입력 필드 ── */
.field-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.field-row:last-child { margin-bottom: 0; }
.field-label {
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}
.field-input-wrap {
  display: flex; align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .15s;
}
.field-input-wrap:focus-within { border-color: var(--primary-light); }
.field-input-wrap input {
  border: none; background: transparent;
  padding: 9px 10px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text);
  text-align: right;
  width: 120px;
  outline: none;
}
.field-input-wrap .unit {
  padding: 0 10px 0 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.field-input-wrap select {
  border: none; background: transparent;
  padding: 9px 10px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

/* ── 결과 카드 ── */
.result-card {
  background: var(--primary);
  border-radius: var(--radius);
  padding: 28px 24px;
  color: white;
  margin-bottom: 16px;
}
.result-main-label {
  font-size: 0.8rem; font-weight: 600;
  opacity: .65;
  margin-bottom: 4px;
}
.result-main-value {
  font-size: 2rem; font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
}
.result-rows { display: flex; flex-direction: column; gap: 8px; }
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 8px;
}
.result-row:first-child { border-top: none; padding-top: 0; }
.result-row .r-label { opacity: .65; }
.result-row .r-value { font-weight: 700; }
.result-row .r-value.accent { color: #fbbf24; }
.result-row .r-value.danger { color: #fc8181; }
.result-row .r-value.success { color: #68d391; }

/* ── 버튼 ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:active { transform: scale(.97); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg); color: var(--text-secondary);
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 11px 20px;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn-secondary:hover { background: #e4eaf0; border-color: #c8d4e0; }
.btn-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 16px;
}

/* ── 구분선 ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── 탭 ── */
.tab-row {
  display: flex;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  flex: 1; padding: 9px 12px;
  background: none; border: none;
  border-radius: 6px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── 알림 박스 ── */
.info-box {
  background: var(--primary-faint);
  border: 1px solid #bee3f8;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.82rem;
  color: var(--primary-light);
  line-height: 1.65;
  margin-bottom: 16px;
}
.warn-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.65;
  margin-bottom: 16px;
}

/* ── Footer ── */
.page-footer {
  text-align: center;
  padding: 40px 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.page-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}
.calc-nav-links {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.calc-nav-links a {
  font-size: 0.8rem; color: var(--primary-light);
  text-decoration: none;
  background: var(--primary-faint);
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid #bee3f8;
  transition: background .15s;
}
.calc-nav-links a:hover { background: #bee3f8; }
