/* ============================================================
   共通UIレイヤー（全シミュレーター共通）
   - 上部ナビゲーションバー
   - 印刷 / PDF保存 対応
   - スマホでのテーブル横スクロール対応
   - 相談導線（CTA）
   ============================================================ */

:root {
  --topbar-h: 50px;
  /* ひろしま税理士事務所 ブランドカラー */
  --brand-navy: #1f5f8b;
  --brand-navy-deep: #174766;
  --brand-accent: #39b8c8;
  --brand-accent-deep: #2a8f9e;
  --brand-accent-soft: #ddf5f8;
  --brand-sky: #8fd3de;
  --brand-line: #d9e7ee;
  --brand-soft: #f3f9fc;
  --brand-star: #f5c13b;
}

html {
  scroll-behavior: smooth;
}

/* --- 上部ナビゲーションバー --- */
body.has-topbar {
  padding-top: calc(var(--topbar-h) + 8px) !important;
}

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  font-family: var(--app-font-family, sans-serif);
}

.app-topbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.app-topbar__btn:hover {
  background: var(--brand-soft);
  color: var(--brand-navy);
  border-color: var(--brand-sky);
}

.app-topbar__btn:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.app-topbar__title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .app-topbar__title {
    font-size: 12px;
  }
  .app-topbar__btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* --- テーブル横スクロール（スマホ対応） --- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
  min-width: 100%;
}

/* ============================================================
   統一デザインテーマ
   ============================================================ */

/* --- ページ背景（全ページ共通） --- */
body.app-theme {
  min-height: 100vh;
  color: #1e293b;
  background:
    radial-gradient(50rem 30rem at 100% 0%, rgba(57, 184, 200, 0.13), transparent 60%),
    radial-gradient(40rem 26rem at 0% 100%, rgba(31, 95, 139, 0.09), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, var(--brand-soft) 100%);
  background-attachment: fixed;
}

/* --- ヒーローヘッダー（各シミュレーターのタイトル部） --- */
.app-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border-radius: 1.25rem;
  padding: 2.5rem 1.5rem 2.25rem;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(42rem 22rem at 85% -20%, rgba(57, 184, 200, 0.45), transparent 60%),
    radial-gradient(36rem 20rem at 0% 120%, rgba(143, 211, 222, 0.3), transparent 60%),
    linear-gradient(135deg, var(--brand-navy-deep) 0%, var(--brand-navy) 55%, var(--brand-accent-deep) 100%);
  box-shadow: 0 20px 40px -18px rgba(31, 95, 139, 0.55);
}

.app-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 35%);
  pointer-events: none;
}

.app-hero h1 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: #fff;
}

.app-hero-sub {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: rgba(221, 245, 248, 0.92);
}

.app-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.9rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: var(--brand-accent-soft);
}

/* --- 計算実行ボタン（全ページ共通のグラデーション） --- */
#calculateBtn,
#calculateButton,
#calculate-btn {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-accent-deep) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 24px -8px rgba(31, 95, 139, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

#calculateBtn:hover,
#calculateButton:hover,
#calculate-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 14px 30px -8px rgba(31, 95, 139, 0.6);
}

#calculateBtn:active,
#calculateButton:active,
#calculate-btn:active {
  transform: translateY(0) scale(0.99);
}

/* --- 数値の桁ずれ防止（等幅数字） --- */
table td {
  font-variant-numeric: tabular-nums;
}

/* --- 結果表示のフェードイン --- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes appFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }
  #results:not(.hidden),
  #resultsSection:not(.hidden) {
    animation: appFadeUp 0.45s ease both;
  }
}

/* ============================================================
   相談導線（CTA）
   ============================================================ */

.app-cta {
  margin-top: 2rem;
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(36rem 18rem at 50% -30%, rgba(57, 184, 200, 0.35), transparent 60%),
    linear-gradient(140deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
  box-shadow: 0 20px 40px -20px rgba(31, 95, 139, 0.6);
}

.app-cta__eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  padding: 0.3rem 0.95rem;
  margin-bottom: 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--brand-accent-soft);
}

.app-cta__title {
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 800;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.app-cta__body {
  margin: 0.9rem auto 0;
  max-width: 34rem;
  font-size: 0.87rem;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.88);
}

.app-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.4rem;
}

.app-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.app-cta__btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.app-cta__btn--line {
  background: #06c755;
  color: #fff;
  box-shadow: 0 10px 22px -8px rgba(6, 199, 85, 0.6);
}

.app-cta__btn--ghost {
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
}

.app-cta__note {
  margin-top: 1.1rem;
  font-size: 0.72rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.62);
}

/* --- 事務所クレジット（フッター） --- */
.app-credit {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--brand-line);
  text-align: center;
}

.app-credit__logo {
  height: 34px;
  width: auto;
  margin: 0 auto 0.6rem;
  display: block;
}

.app-credit__text {
  font-size: 0.72rem;
  line-height: 1.9;
  color: #647887;
}

.app-credit__text a {
  color: var(--brand-navy);
  font-weight: 600;
  text-decoration: none;
}

.app-credit__text a:hover {
  text-decoration: underline;
}

/* --- 印刷 / PDF保存 --- */
@media print {
  .app-topbar,
  .app-cta,
  .no-print,
  button {
    display: none !important;
  }
  body,
  body.has-topbar {
    padding: 0 !important;
    background: #fff !important;
  }
  .shadow,
  .shadow-sm,
  .shadow-md,
  .shadow-lg,
  .shadow-xl,
  .shadow-2xl {
    box-shadow: none !important;
  }
  /* 表・カードの途中でページが切れるのを防ぐ */
  table,
  .section-card,
  .summary-card,
  .input-card {
    break-inside: avoid;
  }
  /* ヒーローは背景が印刷されない場合に備えて濃色文字に */
  .app-hero {
    background: none !important;
    box-shadow: none !important;
    color: #1e293b !important;
    border-bottom: 2px solid var(--brand-navy);
    border-radius: 0;
    padding: 0 0 1rem;
  }
  .app-hero h1 { color: #1e293b !important; }
  .app-hero-sub { color: #475569 !important; }
  .app-hero-badge {
    color: #475569 !important;
    border-color: #cbd5e1 !important;
    background: none !important;
  }
  .app-hero::after { display: none; }
}
