/* うららん 履歴一覧画面
 * モバイル前提（〜430px）。PCでは中央寄せして固定幅。
 * 色変数・ヘッダー・購入ボタン・タブバーは 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-tag-track: #F0F0F0;
  --c-purple: #7B5BC4;
  --c-purple-soft: #B5A0DC;
  --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-surface);
  display: flex;
  flex-direction: column;
}

/* ===== App header ===== */
.app-header {
  flex: 0 0 auto;
  background: var(--c-surface);
}

/* ----- Top row: point balance / buy button ----- */
.topbar {
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

/* ----- Section title（ホームと同じスタイル） ----- */
.section-title {
  font-size: 17px;
  font-weight: 500;
  padding: 16px 16px 8px;
  margin: 0;
}
.topbar-point {
  font-size: 14px;
  color: #5A5A60;
  font-weight: 500;
}
.topbar-buy {
  font-size: 13px;
  color: var(--c-purple);
  border: 1px solid var(--c-purple-soft);
  border-radius: 6px;
  padding: 5px 16px;
  background: var(--c-surface);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
.topbar-buy:hover { background: #F8F5FA; }

/* ----- Search bar ----- */
.searchbar {
  padding: 4px 16px 12px;
}
.searchbar-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-tag-track);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--c-text-hint);
}
.searchbar-icon { flex: 0 0 16px; }
.searchbar-input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--c-text);
  padding: 0;
}
.searchbar-input::placeholder { color: var(--c-text-hint); }

/* ===== 履歴リスト ===== */
.history-list-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.history-list-wrap::-webkit-scrollbar { display: none; }

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--c-border);
  cursor: pointer;
  background: var(--c-surface);
}
.history-item:active {
  background: #F4F0F8;
}

.history-avatar {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--av-color, #C4A4DE);
  position: relative;
}
.history-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-body {
  flex: 1 1 auto;
  min-width: 0;
  /* 名前 → プレビュー → 時刻 の縦並び */
}
.history-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-purple);
  line-height: 1.3;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-preview {
  font-size: 13px;
  color: var(--c-text);
  line-height: 1.45;
  /* 2行で打ち切り */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}
.history-time {
  font-size: 12px;
  color: var(--c-text-muted);
  text-align: right;
  margin-top: 4px;
}

/* ===== 空状態 ===== */
.history-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--c-text-muted);
}
.history-empty p { margin: 0 0 16px; font-size: 14px; }
.history-empty-link {
  display: inline-block;
  color: var(--c-purple);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--c-purple-soft);
  border-radius: 6px;
  padding: 8px 18px;
}

/* ===== Bottom tab bar ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--c-surface);
  border-top: 0.5px solid var(--c-border);
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--c-text-hint);
  background: transparent;
  border: 0;
  padding: 4px 0;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.tab svg { width: 22px; height: 22px; }
.tab.is-active { color: var(--c-purple); }
