/* ========================================
   パン作り失敗診断ツール - kicchow
   ======================================== */

/* ===== フローティングボタン ===== */
.diag-fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  background: var(--green-main, #4A7A35);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(44, 58, 36, 0.3);
  cursor: pointer;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}
.diag-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(44, 58, 36, 0.4);
}
.diag-fab-icon {
  font-size: 18px;
}

/* スマホでは下のbottom-navと被らないよう位置調整 */
@media (max-width: 768px) {
  .diag-fab {
    bottom: 80px;
    left: 14px;
    padding: 12px 16px;
    font-size: 13px;
  }
}

/* ===== 診断パネル ===== */
.diag-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 100vh;
  background: var(--bg, #FAFAF5);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.diag-panel.open {
  transform: translateX(0);
}
@media (max-width: 480px) {
  .diag-panel { max-width: 100%; }
}

/* ===== パネルヘッダー ===== */
.diag-header {
  background: var(--green-dark, #2C3A24);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.diag-header-title {
  font-family: 'Kaisei Decol', serif;
  font-size: 16px;
  font-weight: 700;
}
.diag-header-sub {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}
.diag-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.diag-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== 進捗バー ===== */
.diag-progress {
  background: rgba(255, 255, 255, 0.15);
  height: 3px;
  width: 100%;
  flex-shrink: 0;
}
.diag-progress-fill {
  background: var(--gold, #D4B896);
  height: 100%;
  width: 0;
  transition: width 0.3s ease;
}

/* ===== チャットエリア ===== */
.diag-chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== 吹き出し ===== */
.diag-panel .bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  animation: diagBubbleIn 0.3s ease;
  word-wrap: break-word;
  white-space: pre-line;
}
@keyframes diagBubbleIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.diag-panel .bubble-bot {
  background: #fff;
  color: var(--text-dark, #2C3A24);
  align-self: flex-start;
  border: 1px solid var(--green-pale, #EAF0E2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.diag-panel .bubble-user {
  background: var(--green-main, #4A7A35);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* ===== 選択肢ボタン ===== */
.diag-panel .choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  align-self: flex-end;
  width: 80%;
  animation: diagBubbleIn 0.3s ease;
}
.diag-panel .choice-btn {
  background: #fff;
  color: var(--green-main, #4A7A35);
  border: 2px solid var(--green-main, #4A7A35);
  border-radius: 14px;
  padding: 10px 16px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.diag-panel .choice-btn:hover {
  background: var(--green-main, #4A7A35);
  color: #fff;
}

/* ===== ゴール画面 ===== */
.diag-panel .result {
  background: #fff;
  border: 1px solid var(--green-pale, #EAF0E2);
  border-radius: 12px;
  padding: 16px;
  margin-top: 4px;
  animation: diagBubbleIn 0.4s ease;
}
.diag-panel .result-label {
  font-size: 11px;
  color: var(--green-main, #4A7A35);
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.diag-panel .result-title {
  font-family: 'Kaisei Decol', serif;
  font-size: 17px;
  color: var(--green-dark, #2C3A24);
  margin-bottom: 12px;
  line-height: 1.4;
}
.diag-panel .result-section {
  margin-bottom: 14px;
}
.diag-panel .result-section:last-child {
  margin-bottom: 0;
}
.diag-panel .result-heading {
  font-size: 12px;
  color: var(--text-light, #8A8070);
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.diag-panel .result-text {
  font-size: 13px;
  color: var(--text-dark, #2C3A24);
  line-height: 1.7;
}
.diag-panel .result-text ul {
  margin: 4px 0 0 0;
  padding-left: 18px;
}
.diag-panel .result-text li {
  margin-bottom: 4px;
}

/* ===== 道具カード ===== */
.diag-panel .tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.diag-panel .tool-card {
  background: var(--green-pale, #EAF0E2);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-dark, #2C3A24);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.diag-panel .tool-card:hover {
  background: #fff;
  border-color: var(--green-light, #8DB87A);
  transform: translateY(-1px);
}
.diag-panel .tool-info {
  flex: 1;
}
.diag-panel .tool-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark, #2C3A24);
  margin-bottom: 2px;
}
.diag-panel .tool-note {
  font-size: 11px;
  color: var(--text-light, #8A8070);
}
.diag-panel .tool-cta {
  background: var(--green-main, #4A7A35);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ===== 操作ボタン ===== */
.diag-panel .diag-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.diag-panel .action-btn {
  flex: 1;
  background: transparent;
  color: var(--green-main, #4A7A35);
  border: 1px solid var(--green-main, #4A7A35);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 12px;
  cursor: pointer;
  min-width: 100px;
}
.diag-panel .action-btn:hover {
  background: var(--green-pale, #EAF0E2);
}
.diag-panel .action-btn.primary {
  background: var(--green-main, #4A7A35);
  color: #fff;
}
.diag-panel .action-btn.primary:hover {
  background: var(--green-dark, #2C3A24);
}

/* ===== タイピングインジケーター ===== */
.diag-panel .typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--green-pale, #EAF0E2);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}
.diag-panel .typing-dot {
  width: 6px;
  height: 6px;
  background: var(--green-light, #8DB87A);
  border-radius: 50%;
  animation: diagTyping 1.4s infinite;
}
.diag-panel .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.diag-panel .typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes diagTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}
