/*
 * style.css — 採用・会社情報FAQ デザイン
 * スマホ最優先で設計しています
 * このファイルは基本的に触らなくてOKです
 * カラーは config.php で変更できます
 */

/* ─── CSS変数（カラー・サイズ）─────────────────────── */
:root {
  /* カラー（config.phpで上書きされます） */
  --color-primary:      #1c2d4f;
  --color-primary-dark: #111e35;
  --color-accent:       #3d7a6e;
  --color-accent-dark:  #2a5750;

  /* 固定カラー */
  --color-bg:           #f2f4f8;
  --color-surface:      #ffffff;
  --color-border:       #e2e6ef;
  --color-text:         #1a2335;
  --color-text-muted:   #5a6478;
  --color-text-light:   #96a0b5;
  --color-success:      #27ae60;
  --color-ai:           #5b3ea8;

  /* フォント */
  --font: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;

  /* サイズ */
  --header-h:     56px;
  --search-h:     54px;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --radius-full:  999px;

  /* シャドウ */
  --shadow-sm:  0 1px 4px rgba(28,45,79,.08);
  --shadow-md:  0 3px 12px rgba(28,45,79,.10);
  --shadow-lg:  0 6px 24px rgba(28,45,79,.13);

  /* トランジション */
  --tr: .2s cubic-bezier(.4,0,.2,1);
}

/* ─── リセット ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  display: block;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── ヘッダー ──────────────────────────────────────── */
.site-header {
  background: var(--color-primary);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  max-width: 640px;
  margin: 0 auto;
}
.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-avatar svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: rgba(255,255,255,.85);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.header-text { flex: 1; min-width: 0; }
.header-text h1 {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-text p {
  color: rgba(255,255,255,.65);
  font-size: 10.5px;
  margin-top: 1px;
  font-weight: 300;
}
.header-badge {
  font-size: 10px;
  font-weight: 600;
  color: #7ef0c8;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .04em;
}
.header-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7ef0c8;
  display: block;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(.8); }
}

/* ─── 検索バー ──────────────────────────────────────── */
.search-bar-wrap {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 8px 12px;
  position: -webkit-sticky;
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}
.search-bar {
  display: flex;
  align-items: center;
  background: #f2f4f8;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0 12px 0 10px;
  max-width: 640px;
  margin: 0 auto;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.search-bar:focus-within {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(28,45,79,.08);
}
.search-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--color-text-light);
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
  margin-right: 6px;
  transition: stroke var(--tr);
}
.search-bar:focus-within .search-icon { stroke: var(--color-primary); }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--color-text);
  padding: 10px 0;
  outline: none;
}
.search-input::placeholder { color: var(--color-text-light); font-weight: 300; }
.search-clear {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-text-light);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  transition: background var(--tr);
}
.search-clear.visible { display: flex; }
.search-clear:hover { background: var(--color-primary); }
.search-clear svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* ─── メインコンテンツ ──────────────────────────────── */
.main-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 120px;
}

/* ─── 会話ログ ──────────────────────────────────────── */
.chat-log {
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── メッセージ行 ──────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgIn .3s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes msgIn {
  from { opacity:0; transform:translateY(10px) scale(.97); }
  to   { opacity:1; transform:none; }
}
.msg-row.bot  { justify-content: flex-start; }
.msg-row.user { justify-content: flex-end; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: var(--shadow-sm);
}
.msg-avatar svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: rgba(255,255,255,.85);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.msg-avatar.ai { background: var(--color-ai); }

/* ─── 吹き出し ──────────────────────────────────────── */
.bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.85;
  word-break: break-word;
  overflow-wrap: break-word;
}
.msg-row.bot  .bubble {
  background: var(--color-primary);
  color: #fff;
  border-bottom-left-radius: 4px;
}
.msg-row.user .bubble {
  background: var(--color-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-size: 13px;
}

/* AI吹き出し */
.bubble.ai-bubble {
  background: linear-gradient(135deg, var(--color-ai), #7a5aa8);
  color: #fff;
  border-bottom-left-radius: 4px;
}
.ai-label {
  font-size: 10px;
  opacity: .75;
  display: block;
  margin-bottom: 5px;
  letter-spacing: .1em;
  font-weight: 600;
}

/* 吹き出し内リンク */
.bubble a,
.bubble .cta-inline {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
  transition: background var(--tr);
}
.bubble a:hover { background: rgba(255,255,255,.3); }

/* ─── タイピングインジケーター ──────────────────────── */
.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  animation: typingAnim 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingAnim {
  0%,60%,100% { transform:translateY(0); opacity:.45; }
  30%          { transform:translateY(-6px); opacity:1; }
}

/* AIストリーミングカーソル */
.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: rgba(255,255,255,.8);
  margin-left: 2px;
  animation: blink .7s ease-in-out infinite;
  vertical-align: text-bottom;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ─── 選択肢エリア ──────────────────────────────────── */
.choices-area {
  padding: 4px 14px 16px;
}

.choices-block {
  margin-bottom: 8px;
  animation: msgIn .3s cubic-bezier(.34,1.4,.64,1) .05s both;
}

.choices-label {
  font-size: 10px;
  color: var(--color-text-light);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 2px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.choices-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.btn-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.btn-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

/* ─── ボタン（共通） ────────────────────────────────── */
.faq-btn {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: all var(--tr);
  min-height: 48px;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.faq-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity var(--tr);
}
.faq-btn:hover,
.faq-btn:focus-visible {
  border-color: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  outline: none;
}
.faq-btn:hover::before,
.faq-btn:focus-visible::before { opacity: 1; }
.faq-btn:active { transform: translateY(0); }
.faq-btn > * { position: relative; z-index: 1; }

.btn-icon {
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.btn-body { flex: 1; }
.btn-name {
  font-weight: 500;
  font-size: 13px;
  display: block;
}
.btn-desc {
  font-size: 10.5px;
  opacity: .6;
  margin-top: 2px;
  font-weight: 300;
  display: block;
}
.btn-q-mark {
  font-size: 11px;
  opacity: .4;
  flex-shrink: 0;
}

/* ─── アクセントボタン（応募など） ─────────────────── */
.faq-btn.accent {
  background: var(--color-accent);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 3px 12px rgba(61,122,110,.3);
}
.faq-btn.accent::before { background: var(--color-accent-dark); }
.faq-btn.accent:hover { box-shadow: 0 4px 18px rgba(61,122,110,.4); }

/* AIボタン */
.faq-btn.ai {
  background: var(--color-ai);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(91,62,168,.25);
}
.faq-btn.ai::before { background: #3d2a7a; }

/* セカンダリボタン（戻るなど） */
.faq-btn.secondary {
  background: #f2f4f8;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
}
.faq-btn.secondary::before { background: #e2e6ef; }
.faq-btn.secondary:hover { color: var(--color-primary); }

/* ─── 解決確認ボタン（2列） ──────────────────────── */
.resolve-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ─── 検索ハイライト ─────────────────────────────── */
mark.hl {
  background: rgba(61,122,110,.2);
  border-radius: 3px;
  padding: 0 2px;
  color: inherit;
}

/* ─── 下部ヒント ──────────────────────────────────── */
.bottom-hint {
  position: fixed;
  bottom: 48px;
  left: 0;
  right: 0;
  z-index: 50;
  pointer-events: none;
}
.bottom-hint span {
  display: block;
  max-width: 640px;
  margin: 0 auto;
  background: rgba(255,255,255,.92);
  border-top: 1px solid var(--color-border);
  padding: 9px 16px;
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-align: center;
  backdrop-filter: blur(4px);
}

/* ─── リセットボタン ─────────────────────────────── */
.reset-btn {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--color-border);
  font-family: var(--font);
  font-size: 11px;
  color: var(--color-text-light);
  cursor: pointer;
  letter-spacing: .06em;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(4px);
  z-index: 50;
  transition: color var(--tr);
}
.reset-btn:hover { color: var(--color-primary); }

/* ─── アクセシビリティ ───────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ─── PC調整（601px以上） ────────────────────────── */
@media (min-width: 601px) {
  html { font-size: 15px; }
  .bubble { max-width: 78%; }
  .chat-log { padding: 20px 16px 10px; }
  .choices-area { padding: 4px 16px 20px; }
  .header-inner { padding: 12px 20px; }
  .search-bar-wrap { padding: 10px 16px; }
}
