/* 診断ツール - チャット形式スタイルシート */

/* ========== リセット & 基本設定 ========== */
* {
  box-sizing: border-box;
}

:root {
  /* カラーパレット */
  --primary-color: #d4a574;
  --primary-dark: #b8905f;
  --secondary-color: #f5f5f5;
  --accent-color: #8b7355;
  --text-color: #333;
  --text-light: #666;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --bot-bubble-bg: #ffffff;
  --user-bubble-bg: #d4a574;

  /* スペーシング */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* フォント */
  --font-primary: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  --font-serif: 'Noto Serif JP', 'Georgia', serif;

  /* トランジション */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* シャドウ */
  --shadow-sm: 0 2px 4px var(--shadow-color);
  --shadow-md: 0 4px 12px var(--shadow-color);
  --shadow-lg: 0 8px 24px var(--shadow-color);
}

/* ========== フローティングボタン ========== */
.salon-diagnostic-button {
  position: fixed;
  bottom: 40px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  animation: pulse 2s infinite;
}

.salon-diagnostic-button:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(212, 165, 116, 0.4);
}

.salon-diagnostic-button svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.salon-diagnostic-button.hidden {
  display: none;
}

.salon-diagnostic-button-text {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--primary-color);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 8px 24px var(--shadow-color), 0 0 0 0 rgba(212, 165, 116, 0.7);
  }
  50% {
    box-shadow: 0 8px 24px var(--shadow-color), 0 0 0 10px rgba(212, 165, 116, 0);
  }
}

/* ========== チャットウィンドウ ========== */
.salon-diagnostic-chat {
  position: fixed;
  bottom: 40px;
  right: 24px;
  width: 380px;
  height: 600px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-primary);
  animation: slideInUp 0.3s ease;
}

.salon-diagnostic-chat.active {
  display: flex;
}

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

/* ========== チャットヘッダー ========== */
.salon-diagnostic-chat-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

.salon-diagnostic-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.salon-diagnostic-chat-avatar {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.salon-diagnostic-chat-info h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.salon-diagnostic-chat-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.9;
}

.salon-diagnostic-reset,
.salon-diagnostic-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.salon-diagnostic-reset:hover,
.salon-diagnostic-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== チャットメッセージエリア ========== */
.salon-diagnostic-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.salon-diagnostic-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.salon-diagnostic-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.salon-diagnostic-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* ========== メッセージバブル ========== */
.salon-diagnostic-message {
  display: flex;
  gap: 8px;
  animation: messageSlideIn 0.3s ease;
}

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

.salon-diagnostic-message.bot {
  align-items: flex-start;
}

.salon-diagnostic-message.user {
  align-items: flex-end;
  flex-direction: row-reverse;
}

.salon-diagnostic-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.salon-diagnostic-message.user .salon-diagnostic-message-avatar {
  background: #999;
}

.salon-diagnostic-message-content {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.salon-diagnostic-message-bubble {
  background: var(--bot-bubble-bg);
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  line-height: 1.5;
}

.salon-diagnostic-message.bot .salon-diagnostic-message-bubble {
  border-bottom-left-radius: 4px;
}

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

.salon-diagnostic-message-text {
  font-size: 0.9375rem;
  color: var(--text-color);
  margin: 0;
}

.salon-diagnostic-message.user .salon-diagnostic-message-text {
  color: white;
}

.salon-diagnostic-message-emoji {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

/* ========== 選択肢ボタン ========== */
.salon-diagnostic-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.salon-diagnostic-option {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-size: 0.875rem;
}

.salon-diagnostic-option:hover {
  border-color: var(--primary-color);
  background: rgba(212, 165, 116, 0.05);
  transform: translateX(2px);
}

.salon-diagnostic-option-text {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 2px;
}

.salon-diagnostic-option-description {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ========== 結果カード ========== */
.salon-diagnostic-result-card {
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.salon-diagnostic-result-badge {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.salon-diagnostic-result-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 4px 0;
}

.salon-diagnostic-result-subtitle {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin: 0 0 12px 0;
}

.salon-diagnostic-result-price {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.salon-diagnostic-result-price .label {
  color: var(--text-light);
}

.salon-diagnostic-result-price .value {
  font-weight: 600;
  color: var(--primary-color);
}

.salon-diagnostic-result-features {
  margin-bottom: 12px;
}

.salon-diagnostic-result-feature {
  font-size: 0.8125rem;
  color: var(--text-color);
  margin-bottom: 4px;
  padding-left: 16px;
  position: relative;
}

.salon-diagnostic-result-feature:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.salon-diagnostic-result-description {
  font-size: 0.8125rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

/* ========== メールフォーム ========== */
.salon-diagnostic-email-form {
  background: var(--secondary-color);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}

.salon-diagnostic-email-form h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0 0 8px 0;
}

.salon-diagnostic-email-form form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.salon-diagnostic-email-input {
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}

.salon-diagnostic-email-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.salon-diagnostic-email-submit {
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.salon-diagnostic-email-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

/* ========== 連絡先ボタン ========== */
.salon-diagnostic-contact-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  margin-top: 8px;
  transition: all var(--transition-fast);
}

.salon-diagnostic-contact-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* ========== タイピングインジケーター ========== */
.salon-diagnostic-typing {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.salon-diagnostic-typing-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 4px;
  align-items: center;
}

.salon-diagnostic-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.salon-diagnostic-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.salon-diagnostic-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* ========== レスポンシブデザイン ========== */
@media (max-width: 768px) {
  .salon-diagnostic-button {
    width: 56px;
    height: 56px;
    bottom: 32px;
    right: 16px;
  }

  .salon-diagnostic-button svg {
    width: 28px;
    height: 28px;
  }

  .salon-diagnostic-chat {
    width: calc(100% - 32px);
    height: calc(100vh - 80px);
    bottom: 16px;
    right: 16px;
  }
}

@media (max-width: 480px) {
  .salon-diagnostic-chat {
    width: 100%;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .salon-diagnostic-chat-header {
    border-radius: 0;
  }
}
