/* ========================================
   AIスクールLP チャットボット 専用スタイル
   ※既存 styles.css への影響を避けるため独立
   ======================================== */

/* フロートチャットアイコン（画面左下） */
.lp-chatbot-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
  transition: all 0.3s ease;
  z-index: 999;
  border: none;
}

.lp-chatbot-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.lp-chatbot-trigger:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.lp-chatbot-trigger-icon {
  font-size: 1.5rem;
  color: white;
}

.lp-chatbot-header-icon {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.25rem;
}

/* チャットウィンドウ（左下のアイコン上に表示） */
.lp-chatbot-window {
  position: fixed;
  bottom: 90px;
  left: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 500px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.lp-chatbot-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

@media screen and (max-width: 768px) {
  .lp-chatbot-window {
    bottom: 90px;
    left: 20px;
    right: 20px;
    width: auto;
    height: 70vh;
  }
}

/* ヘッダー */
.lp-chatbot-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.lp-chatbot-header-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lp-chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s ease;
}

.lp-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* メッセージエリア */
.lp-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
}

.lp-chatbot-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  font-size: 0.9rem;
  word-wrap: break-word;
}

.lp-chatbot-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Botメッセージ：アバターを吹き出しの左上に配置 */
.lp-chatbot-msg.bot {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 95%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.lp-chatbot-msg-avatar {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(102, 126, 234, 0.3);
}

.lp-chatbot-msg-bubble {
  background: white;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.lp-chatbot-msg.loading {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 95%;
  padding: 0;
  background: transparent;
  border: none;
}

.lp-chatbot-msg.loading .lp-chatbot-msg-bubble {
  background: white;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.lp-chatbot-msg.loading {
  animation: lp-chatbot-pulse 1.5s ease-in-out infinite;
}

@keyframes lp-chatbot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 入力エリア */
.lp-chatbot-input-area {
  position: relative;
  padding: 1rem;
  background: white;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  min-height: 80px;
}

/* 同意オーバーレイ表示時は入力欄を拡張 */
.lp-chatbot-input-area.has-consent-overlay {
  min-height: 220px;
}

/* メール送信案内オーバーレイ表示時は入力欄を拡張 */
.lp-chatbot-input-area.has-email-offer-overlay {
  min-height: 200px;
}

.lp-chatbot-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.lp-chatbot-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 0.9rem;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.lp-chatbot-input:focus {
  outline: none;
  border-color: #667eea;
}

.lp-chatbot-input::placeholder {
  color: #94a3b8;
}

.lp-chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lp-chatbot-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.lp-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* メール入力フォーム（needsEmail時） */
.lp-chatbot-email-form {
  padding: 1rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  margin-top: 0.5rem;
}

.lp-chatbot-email-form label {
  display: block;
  font-size: 0.85rem;
  color: #0369a1;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.lp-chatbot-email-input {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.lp-chatbot-email-input:focus {
  outline: none;
  border-color: #0ea5e9;
}

.lp-chatbot-email-submit {
  padding: 0.5rem 1rem;
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lp-chatbot-email-submit:hover {
  background: #0284c7;
}

/* 同意オーバーレイ（入力欄に被せる） */
.lp-chatbot-consent-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
  border-top: 1px solid #e2e8f0;
}

.lp-chatbot-consent-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lp-chatbot-consent-modal {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: visible;
}

.lp-chatbot-consent-modal h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #1c1c40;
}

.lp-chatbot-consent-modal p,
.lp-chatbot-consent-modal .lp-chatbot-consent-text {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
  white-space: nowrap;
}

.lp-chatbot-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.lp-chatbot-consent-check input {
  margin-top: 0.25rem;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.lp-chatbot-consent-check label {
  font-size: 0.95rem;
  color: #333;
  cursor: pointer;
  padding: 0.25rem 0;
  white-space: nowrap;
}

.lp-chatbot-consent-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.lp-chatbot-consent-btn {
  padding: 0.6rem 1.2rem;
  min-height: 44px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
}

.lp-chatbot-consent-btn.cancel {
  background: #f1f5f9;
  color: #64748b;
}

.lp-chatbot-consent-btn.cancel:hover {
  background: #e2e8f0;
}

.lp-chatbot-consent-btn.confirm {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.lp-chatbot-consent-btn.confirm:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
}

.lp-chatbot-consent-btn.confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* メール送信案内オーバーレイ（往復3回以上で表示） */
.lp-chatbot-email-offer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
  border-top: 1px solid #e2e8f0;
}

.lp-chatbot-email-offer-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lp-chatbot-email-offer-modal {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.lp-chatbot-email-offer-text {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: #333;
  line-height: 1.6;
}

.lp-chatbot-email-offer-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.lp-chatbot-email-offer-btn {
  padding: 0.6rem 1.2rem;
  min-height: 44px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
}

.lp-chatbot-email-offer-btn.continue {
  background: #f1f5f9;
  color: #64748b;
}

.lp-chatbot-email-offer-btn.continue:hover {
  background: #e2e8f0;
}

.lp-chatbot-email-offer-btn.submit {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.lp-chatbot-email-offer-btn.submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}
