/* =========================================
   AIお薬相談室 - チャットUIスタイル
   ========================================= */

.soudan-hero {
  background: linear-gradient(135deg, #1a5c2e 0%, #2d8a4e 60%, #3da862 100%);
  padding: 100px 0 60px;
  color: white;
  text-align: center;
}

.soudan-hero h1 {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 900;
  margin-bottom: 12px;
}

.soudan-hero p {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  max-width: 540px;
  margin: 0 auto;
}

.soudan-warning {
  background: #fff3cd;
  border-left: 4px solid #f0a500;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  color: #856404;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.soudan-warning .warn-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }

/* APIキー設定モーダル */
.api-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.api-modal-overlay.show { display: flex; }

.api-modal {
  background: white;
  border-radius: 20px;
  padding: 36px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.api-modal h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #111827;
}

.api-modal p {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.7;
  margin-bottom: 20px;
}

.api-modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
  transition: 0.2s;
  font-family: monospace;
}

.api-modal-input:focus {
  outline: none;
  border-color: #2d8a4e;
  box-shadow: 0 0 0 3px rgba(45,138,78,0.1);
}

.api-modal-actions {
  display: flex;
  gap: 10px;
}

.api-modal-save {
  flex: 1;
  background: #2d8a4e;
  color: white;
  font-weight: 700;
  padding: 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s;
}

.api-modal-save:hover { background: #1e6b3a; }

.api-modal-demo {
  flex: 1;
  background: #f0f2f5;
  color: #374151;
  font-weight: 600;
  padding: 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.api-modal-demo:hover { background: #e2e8f0; }

/* チャット本体 */
.chat-wrapper {
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.chat-header {
  background: linear-gradient(135deg, #2d8a4e, #3da862);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chat-name {
  font-size: 18px;
  font-weight: 700;
}

.chat-status {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
}

.chat-header-actions { display: flex; gap: 8px; }

.chat-action-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s;
  font-family: inherit;
}

.chat-action-btn:hover { background: rgba(255,255,255,0.25); }

.chat-messages {
  height: 440px;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

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

.message.bot { align-self: flex-start; }

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

.bot .message-avatar { background: rgba(45,138,78,0.12); }
.user .message-avatar { background: rgba(45,138,78,0.12); }

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
}

.bot .message-bubble {
  background: white;
  color: #374151;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.user .message-bubble {
  background: linear-gradient(135deg, #2d8a4e, #3da862);
  color: white;
  border-radius: 16px 4px 16px 16px;
}

.message-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  text-align: right;
}

.user .message-time { text-align: left; }

/* タイピング表示 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
}

.typing-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(45,138,78,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.typing-dots {
  background: white;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typing 1.4s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* クイック質問 */
.quick-questions {
  padding: 16px 24px;
  background: white;
  border-top: 1px solid #f0f2f5;
}

.quick-questions p {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 8px;
  font-weight: 600;
}

.quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-btn {
  background: #f0f2f5;
  border: 1px solid #e2e8f0;
  color: #374151;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.quick-btn:hover {
  background: rgba(45,138,78,0.1);
  border-color: rgba(45,138,78,0.3);
  color: #2d8a4e;
}

/* 入力エリア */
.chat-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  line-height: 1.5;
  transition: 0.2s;
  font-family: inherit;
}

.chat-input:focus {
  outline: none;
  border-color: #2d8a4e;
  box-shadow: 0 0 0 3px rgba(45,138,78,0.08);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  background: #2d8a4e;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  transition: 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover { background: #1e6b3a; transform: scale(1.05); }
.chat-send-btn:disabled { background: #d1d5db; cursor: not-allowed; transform: none; }

/* APIキー設定ボタン */
.api-key-section {
  margin-top: 20px;
  text-align: center;
}

.api-key-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0f2f5;
  border: 1px solid #e2e8f0;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.api-key-btn:hover { background: #e2e8f0; color: #374151; }

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 8px;
}

.api-status.connected { color: #2d8a4e; }
.api-status.demo { color: #f0a500; }

.api-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.connected .status-dot { background: #2d8a4e; }
.demo .status-dot { background: #f0a500; }
