/* =========================================================
   CROSS Graph — ユーザー画面 共通スタイル
   Bootstrap 5.3 を前提とした上書き・拡張
   ========================================================= */

:root {
  --cross-navy: #16344f;
  --cross-navy-soft: #1f4568;
  --cross-accent: #2e6e8e;
  --cross-gold: #c9a85c;
  --cross-bg: #f7f9fb;
  --cross-border: #e6ecf2;
  --cross-text: #2b3f52;
  --cross-muted: #8195a7;
  --sidebar-width: 232px;
}

body {
  background: var(--cross-bg);
  color: var(--cross-text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 0.875rem;
}

.font-serif { font-family: "Playfair Display", "Noto Serif JP", serif; }

/* ---------- サイドバー（白） ---------- */
.user-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--cross-border);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  overflow-y: auto;
}

.user-sidebar .brand {
  padding: 1.1rem 1.15rem 0.9rem;
}

.user-sidebar .brand .brand-name {
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--cross-navy);
}

.user-sidebar .brand .brand-sub {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cross-muted);
}

.user-sidebar .nav-link {
  color: var(--cross-text);
  padding: 0.5rem 1.15rem;
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-left: 3px solid transparent;
}

.user-sidebar .nav-link i {
  width: 1.05rem;
  text-align: center;
  color: var(--cross-muted);
  font-size: 0.95rem;
}

.user-sidebar .nav-link:hover { background: #f3f7fa; }

.user-sidebar .nav-link.active {
  background: #eef4f9;
  border-left-color: var(--cross-navy);
  color: var(--cross-navy);
  font-weight: 600;
}

.user-sidebar .nav-link.active i { color: var(--cross-navy); }

.user-sidebar .nav-link .badge { margin-left: auto; font-size: 0.58rem; }

.user-sidebar hr {
  margin: 0.6rem 1.15rem;
  border-color: var(--cross-border);
  opacity: 1;
}

.user-sidebar .nav-section {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cross-muted);
  padding: 0.8rem 1.15rem 0.3rem;
}

/* AI ADVISORS */
.advisor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  padding: 0.3rem 1.15rem 0.6rem;
}

.advisor {
  text-align: center;
  font-size: 0.58rem;
  color: var(--cross-muted);
}

.advisor .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  margin: 0 auto 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}

.user-sidebar .sidebar-footer {
  margin-top: auto;
  padding: 0.8rem 1.15rem 1rem;
  border-top: 1px solid var(--cross-border);
  font-size: 0.74rem;
}

.btn-upgrade {
  border: 1px solid var(--cross-border);
  border-radius: 0.55rem;
  width: 100%;
  font-size: 0.78rem;
  color: var(--cross-navy);
  background: #fff;
  padding: 0.45rem;
}

.btn-upgrade:hover { background: #f3f7fa; }

/* ---------- メイン ---------- */
.user-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.user-topbar {
  background: #fff;
  border-bottom: 1px solid var(--cross-border);
  padding: 0.6rem 1.5rem;
  font-size: 0.8rem;
  color: var(--cross-muted);
  display: flex;
  align-items: center;
}

.user-content { padding: 2rem 1.5rem 3rem; flex: 1; }

/* ヒーロー（Slidekick / Chatalyst 中央タイトル） */
.hero-title {
  font-family: "Playfair Display", "Noto Serif JP", serif;
  font-size: 2.6rem;
  color: var(--cross-navy);
  text-align: center;
}

.hero-lead {
  text-align: center;
  color: var(--cross-muted);
  font-size: 0.9rem;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #eef4f9;
  color: var(--cross-accent);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
}

/* ---------- チャット入力ボックス ---------- */
.chat-box {
  background: #fff;
  border: 1px solid var(--cross-border);
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(22, 52, 79, 0.06);
  padding: 1rem 1.1rem 0.8rem;
}

.chat-box textarea {
  border: none;
  resize: none;
  font-size: 0.9rem;
  box-shadow: none !important;
  padding: 0;
}

.chat-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--cross-border);
}

.mode-btn {
  border: 1px solid var(--cross-border);
  background: #fff;
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 0.3rem 0.8rem;
  color: var(--cross-text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mode-btn:hover { background: #f3f7fa; }

.mode-btn.active {
  background: #eef4f9;
  border-color: var(--cross-accent);
  color: var(--cross-accent);
  font-weight: 600;
}

.send-btn {
  width: 38px; height: 38px;
  border-radius: 0.7rem;
  background: var(--cross-navy);
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover { background: var(--cross-navy-soft); color: #fff; }

/* 添付ファイル（選択中チップ） */
.attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.attach-row:empty { display: none; }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #eef4f9;
  border: 1px solid #d6e3ee;
  border-radius: 0.55rem;
  padding: 0.35rem 0.4rem 0.35rem 0.55rem;
  font-size: 0.74rem;
  color: var(--cross-text);
  max-width: 220px;
}

.attach-chip .file-ico {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border-radius: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
}

.attach-chip .file-ico.pdf { background: #c0392b; }
.attach-chip .file-ico.xls { background: #1d7a4f; }
.attach-chip .file-ico.doc { background: #2b5d9c; }
.attach-chip .file-ico.img { background: #7b3fa0; }
.attach-chip .file-ico.gen { background: #5d6f80; }

.attach-chip .file-meta { min-width: 0; line-height: 1.2; }
.attach-chip .file-name {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-chip .file-sub { font-size: 0.64rem; color: var(--cross-muted); }

.attach-chip .attach-x {
  border: none;
  background: none;
  color: var(--cross-muted);
  padding: 0 0.1rem;
  line-height: 1;
  font-size: 0.85rem;
}
.attach-chip .attach-x:hover { color: #b03434; }

.attach-chip.uploading .file-name::after {
  content: "アップロード中…";
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--cross-accent);
}

/* 単一/デッキ タブ */
.pill-tabs {
  display: inline-flex;
  background: #eef2f6;
  border-radius: 999px;
  padding: 0.25rem;
}

.pill-tabs .nav-link {
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--cross-muted);
  padding: 0.35rem 1.2rem;
}

.pill-tabs .nav-link.active {
  background: #fff;
  color: var(--cross-navy);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(22, 52, 79, 0.12);
}

/* ---------- カード共通 ---------- */
.card {
  border: 1px solid var(--cross-border);
  border-radius: 0.7rem;
  box-shadow: 0 1px 2px rgba(22, 52, 79, 0.04);
}

.section-title {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--cross-muted);
}

/* テンプレートサムネイル */
.tpl-card { cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }

.tpl-card:hover {
  box-shadow: 0 6px 18px rgba(22, 52, 79, 0.12);
  transform: translateY(-2px);
}

.tpl-card.selected { outline: 2px solid var(--cross-accent); }

.tpl-card .thumb {
  height: 110px;
  border-radius: 0.7rem 0.7rem 0 0;
  background: linear-gradient(135deg, #f0f4f9 0%, #dde7f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cross-accent);
  font-size: 1.8rem;
  border-bottom: 1px solid var(--cross-border);
}

/* ---------- バッジ ---------- */
.badge-status {
  font-weight: 500;
  padding: 0.3em 0.7em;
  border-radius: 999px;
  font-size: 0.7rem;
}

.badge-status.available { background: #e3f4ec; color: #1d7a4f; }
.badge-status.processing { background: #fff4dc; color: #9a6b00; }
.badge-status.failed { background: #fdeaea; color: #b03434; }
.badge-status.purchased { background: #e6eef8; color: #2b5d9c; }
.badge-status.locked { background: #eef1f5; color: #5d6f80; }

/* ---------- アップロードゾーン ---------- */
.upload-zone {
  border: 2px dashed #c8d6e2;
  border-radius: 0.9rem;
  background: #fff;
  padding: 2.6rem 1rem;
  text-align: center;
  color: var(--cross-muted);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--cross-accent);
  background: #f4f9fc;
}

.upload-zone .upload-icon {
  width: 52px; height: 52px;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  background: #eef4f9;
  color: var(--cross-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* ---------- Data Store ---------- */
.ds-cat-link {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 0.45rem;
  color: var(--cross-text);
  text-decoration: none;
  font-size: 0.83rem;
}

.ds-cat-link:hover { background: #f3f7fa; }
.ds-cat-link.active { background: #eef4f9; color: var(--cross-navy); font-weight: 600; }
.ds-cat-link .count { margin-left: auto; color: var(--cross-muted); font-size: 0.74rem; }

.report-card .report-cover {
  height: 150px;
  border-radius: 0.7rem 0.7rem 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.8rem;
  color: #fff;
  position: relative;
}

.report-card .report-cover .ribbon {
  position: absolute;
  top: 10px; left: 10px;
}

.report-card .report-cover .fmt {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 0.64rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

.price { font-family: "Playfair Display", serif; font-size: 1.15rem; color: var(--cross-navy); }
.price-old { text-decoration: line-through; color: var(--cross-muted); font-size: 0.78rem; }

/* ---------- Learning Hub ---------- */
.featured-hero {
  border-radius: 1rem;
  background: linear-gradient(120deg, #4c2a85 0%, #7b3fa0 55%, #a050b8 100%);
  color: #fff;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.filter-chip {
  border: 1px solid var(--cross-border);
  background: #fff;
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 0.32rem 0.9rem;
  color: var(--cross-text);
}

.filter-chip.active {
  background: var(--cross-navy);
  border-color: var(--cross-navy);
  color: #fff;
}

.course-card .course-cover {
  height: 120px;
  border-radius: 0.7rem 0.7rem 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.6rem 0.7rem;
  color: #fff;
}

.course-meta { font-size: 0.72rem; color: var(--cross-muted); }

.progress-thin { height: 6px; border-radius: 999px; }

/* ---------- 受講画面 ---------- */
.course-header {
  background: linear-gradient(120deg, #11293f 0%, #1b3f60 70%, #24527c 100%);
  color: #fff;
  padding: 1.6rem 1.5rem;
}

.course-header .course-title {
  font-family: "Playfair Display", "Noto Serif JP", serif;
  font-size: 1.5rem;
}

.curriculum-list .module-head {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cross-navy);
  padding: 0.7rem 1rem 0.3rem;
}

.curriculum-list .lesson-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--cross-text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.curriculum-list .lesson-link:hover { background: #f3f7fa; }

.curriculum-list .lesson-link.current {
  background: #eef4f9;
  border-left-color: var(--cross-navy);
  font-weight: 600;
  color: var(--cross-navy);
}

.curriculum-list .lesson-link .done-ico { color: #1d7a4f; }
.curriculum-list .lesson-link .todo-ico { color: #c4d2de; }

.video-stage {
  background: linear-gradient(135deg, #122c44 0%, #1d4368 100%);
  border-radius: 0.8rem;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
}

.video-stage .play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 出典 ---------- */
.citation-note {
  background: #fff;
  border: 1px solid var(--cross-border);
  border-left: 3px solid var(--cross-gold);
  border-radius: 0.5rem;
  font-size: 0.78rem;
  color: var(--cross-muted);
  padding: 0.7rem 0.9rem;
}

/* ---------- チャット会話スレッド（Chatalyst 結果） ---------- */
.chat-thread {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.chat-msg { display: flex; gap: 0.7rem; margin-bottom: 1.4rem; }
.chat-msg.user { justify-content: flex-end; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
}

.bubble { max-width: 80%; }

.bubble .msg-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--cross-navy);
  margin-bottom: 0.25rem;
}

.bubble .msg-name .msg-time {
  font-weight: 400;
  color: var(--cross-muted);
  margin-left: 0.5rem;
}

.bubble .msg-body {
  background: #fff;
  border: 1px solid var(--cross-border);
  border-radius: 0.2rem 0.9rem 0.9rem 0.9rem;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.75;
  box-shadow: 0 1px 2px rgba(22, 52, 79, 0.04);
}

.chat-msg.user .bubble .msg-body {
  background: var(--cross-navy);
  color: #fff;
  border-color: var(--cross-navy);
  border-radius: 0.9rem 0.2rem 0.9rem 0.9rem;
}

.bubble .msg-body p:last-child { margin-bottom: 0; }
.bubble .msg-body ul { margin: 0.4rem 0 0.2rem; padding-left: 1.1rem; }
.bubble .msg-body ul li { margin-bottom: 0.2rem; }

/* ツール実行トレース（ウェブ検索 / RAG / エージェント） */
.tool-trace {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--cross-muted);
  margin-bottom: 0.5rem;
}

.tool-trace .trace-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #eef4f9;
  color: var(--cross-accent);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-weight: 600;
}

/* 出典チップ（RAG citations） */
.cite-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }

.cite-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--cross-border);
  border-left: 3px solid var(--cross-gold);
  border-radius: 0.4rem;
  font-size: 0.7rem;
  color: var(--cross-text);
  padding: 0.25rem 0.55rem;
  text-decoration: none;
}

.cite-chip:hover { background: #f8f5ee; }
.cite-chip .cite-src { color: var(--cross-muted); }

/* インライン引用番号 */
.cite-ref {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--cross-accent);
  background: #eef4f9;
  border-radius: 4px;
  padding: 0 0.25rem;
  vertical-align: super;
  margin-left: 1px;
}

/* メッセージ下のアクション */
.msg-actions { display: flex; gap: 0.7rem; margin-top: 0.55rem; }
.msg-actions button {
  border: none;
  background: none;
  color: var(--cross-muted);
  font-size: 0.74rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.msg-actions button:hover { color: var(--cross-accent); }

/* 入力ドック（画面下に固定） */
.chat-dock {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(247,249,251,0) 0%, var(--cross-bg) 38%);
  padding: 1.2rem 0 0.2rem;
}

/* タイピングインジケータ */
.typing span {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--cross-muted);
  animation: typing-bounce 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 991.98px) {
  .user-sidebar { display: none; }
  .user-main { margin-left: 0; }
  .hero-title { font-size: 2rem; }
  .bubble { max-width: 90%; }
}
