/* ===== リセット・基本 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-active: #0f3460;
  --accent: #4f8ef7;
  --accent-light: #e8f0fe;
  --bg: #f7f8fc;
  --white: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --bot-bubble: #ffffff;
  --user-bubble: #4f8ef7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ===== レイアウト ===== */
.app {
  display: flex;
  height: 100vh;
}

/* ===== サイドバー ===== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 8px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 20px;
  color: var(--accent);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item:hover:not(:disabled) {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
}

.nav-item:disabled {
  cursor: default;
  opacity: 0.6;
}

.nav-icon { font-size: 16px; }

.nav-label { flex: 1; }

.badge {
  font-size: 10px;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ===== メインエリア ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ===== チャットコンテナ ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 18px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== メッセージエリア ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== 吹き出し ===== */
.message {
  display: flex;
  gap: 10px;
  max-width: 780px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.bot .message-avatar {
  background: var(--accent);
  color: white;
}

.user .message-avatar {
  background: var(--text-secondary);
  color: white;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  max-width: 600px;
}

.bot .message-bubble {
  background: var(--bot-bubble);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.user .message-bubble {
  background: var(--user-bubble);
  color: white;
  border-top-right-radius: 4px;
}

/* ===== ステップ選択UI ===== */
.step-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.step-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.step-btn:hover {
  background: var(--accent);
  color: white;
}

.step-btn.selected {
  background: var(--accent);
  color: white;
}

/* ===== 日付入力 ===== */
.date-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 50px;
}

.date-input {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.date-input:focus {
  border-color: var(--accent);
}

/* ===== 実行ボタン ===== */
.exec-btn {
  margin-top: 12px;
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.exec-btn:hover { opacity: 0.88; }
.exec-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 結果カード ===== */
.result-card {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.result-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.result-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #f0f2f8;
  border-bottom: 1px solid var(--border);
}

.result-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.copy-btn.copied {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.result-section-body {
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== ローディング ===== */
.loading-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== 入力エリア（下部固定） ===== */
.chat-input-area {
  padding: 16px 28px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

.reset-btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== 準備中画面 ===== */
.coming-soon-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
  padding: 40px;
}

.coming-soon-icon { font-size: 48px; }

.coming-soon-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.coming-soon-desc {
  font-size: 14px;
  text-align: center;
  line-height: 1.8;
  max-width: 360px;
}

/* ===== スクロールバー（Firefox） ===== */
.chat-messages { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
