/* うららん ポイント購入画面
 * モバイル前提（〜430px）。
 * ヘッダー・色変数は home.css / profile.css と統一。
 */

:root {
  --c-bg: #F8F8F8;
  --c-surface: #FFFFFF;
  --c-border: #ECECEC;
  --c-text: #2C2C2A;
  --c-text-muted: #7A7770;
  --c-text-hint: #9A968C;
  --c-purple: #7B5BC4;
  --c-purple-soft: #B5A0DC;
  --c-purple-light: #E8DEF6;
  --c-tag-track: #F0F0F0;
  --c-point-icon-bg: #FFE2C9;
  --c-point-icon-fg: #E47C2C;
  --c-discount-bg: #FCE7EE;
  --c-discount-fg: #D14C7A;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー ===== */
.app-header {
  flex: 0 0 auto;
  background: var(--c-surface);
  border-bottom: 0.5px solid var(--c-border);
}
.topbar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  position: relative;
}
.topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
  /* ヘッダー全体の中央に配置（戻るボタンの幅に依らない） */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ===== 本文スクロール領域 ===== */
.purchase-main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 24px;
  scrollbar-width: none;
}
.purchase-main::-webkit-scrollbar { display: none; }

/* ===== 現在のポイントカード ===== */
.balance-card {
  background: var(--c-surface);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.balance-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-point-icon-bg);
  color: var(--c-point-icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  font-family: serif;
}
.balance-body { flex: 1 1 auto; min-width: 0; }
.balance-label {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 2px;
}
.balance-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}

/* ===== タブ ===== */
.purchase-tabs {
  display: flex;
  background: var(--c-tag-track);
  border-radius: 24px;
  padding: 4px;
  margin-bottom: 16px;
}
.purchase-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.purchase-tab.is-active {
  background: var(--c-purple);
  color: #fff;
}

/* ===== タブパネル ===== */
.tab-panel[hidden] { display: none; }

/* ===== パッケージリスト ===== */
.package-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.package-item {
  background: var(--c-surface);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
}
.package-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-point-icon-bg);
  color: var(--c-point-icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  font-family: serif;
}
.package-body {
  flex: 1 1 auto;
  min-width: 0;
}
.package-points {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.25;
  margin-bottom: 4px;
}
.package-discount {
  display: inline-block;
  font-size: 11px;
  color: var(--c-discount-fg);
  background: var(--c-discount-bg);
  border-radius: 10px;
  padding: 3px 10px;
  font-weight: 500;
}
.package-buy {
  flex: 0 0 auto;
  background: var(--c-purple);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-width: 96px;
  text-align: center;
}
.package-buy:active {
  background: #6a4cb0;
  transform: translateY(1px);
}

/* ===== 購入履歴リスト ===== */
.purchase-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-row {
  background: var(--c-surface);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
}
.history-row-body { flex: 1 1 auto; min-width: 0; }
.history-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 2px;
}
.history-row-date {
  font-size: 12px;
  color: var(--c-text-muted);
}
.history-row-points {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 700;
  color: var(--c-text);
}

/* ===== 空状態 ===== */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--c-text-muted);
}
.empty-state p { margin: 0; font-size: 14px; }

/* ===== フッター: 規約リンク ===== */
.purchase-footer {
  flex: 0 0 auto;
  background: var(--c-surface);
  border-top: 0.5px solid var(--c-border);
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  gap: 16px;
}
.purchase-footer-link {
  font-size: 13px;
  color: var(--c-text-muted);
  text-decoration: none;
}
.purchase-footer-link:active {
  opacity: 0.6;
}

/* ===== 完了ダイアログ（profile.css と同構造、ボタン1個版） ===== */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-dialog[aria-hidden="false"] {
  display: flex;
}
.confirm-dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.confirm-dialog-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.confirm-dialog-header {
  padding: 24px 20px 20px;
  text-align: center;
  border-bottom: 0.5px solid var(--c-border);
}
.confirm-dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--c-purple);
  line-height: 1.5;
}
.confirm-dialog-body {
  padding: 28px 20px;
  text-align: center;
  border-bottom: 0.5px solid var(--c-border);
}
.confirm-dialog-desc {
  margin: 0;
  font-size: 14px;
  color: var(--c-text);
  line-height: 1.6;
}
.confirm-dialog-actions {
  display: flex;
}
.confirm-dialog-btn {
  flex: 1;
  border: 0;
  background: #fff;
  color: var(--c-purple);
  padding: 16px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.confirm-dialog-btn:active {
  opacity: 0.6;
}
