/* ============================================================
   合同会社BISIN — chatbot.css
   COOLSPA導入相談チャットウィジェット
   ============================================================ */

/* ── Launcher ────────────────────────────────────────────── */
.cb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
  z-index: 9000;
  padding: 0;
}

.cb-launcher__circle {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1E4F8A 0%, #0A2A52 100%);
  border: 2px solid rgba(75, 179, 255, 0.55);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: cb-pulse 3s ease-in-out infinite;
}

.cb-launcher:hover .cb-launcher__circle {
  transform: scale(1.07);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(75, 179, 255, 0.12);
}

.cb-launcher__circle svg {
  width: 30px;
  height: 30px;
  color: #4BB3FF;
}

.cb-launcher__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e05a5a;
  border: 2px solid #061C36;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
}

.cb-launcher__label {
  background: linear-gradient(135deg, #0A2A52, #061C36);
  border: 1px solid rgba(75, 179, 255, 0.40);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #EAF6FF;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

@keyframes cb-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 0 rgba(75,179,255,0.30); }
  50%       { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 10px rgba(75,179,255,0); }
}

/* ── Window ──────────────────────────────────────────────── */
.cb-window {
  position: fixed;
  bottom: 108px;
  right: 24px;
  width: 360px;
  max-height: 640px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(75, 179, 255, 0.20);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 8999;
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cb-window.cb-hidden {
  opacity: 0;
  transform: scale(0.88) translateY(14px);
  pointer-events: none;
}

/* ── Header ──────────────────────────────────────────────── */
.cb-header {
  background: linear-gradient(135deg, #0A2A52 0%, #1E4F8A 100%);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.cb-header__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(75, 179, 255, 0.18);
  border: 1.5px solid rgba(75, 179, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-header__icon svg { width: 22px; height: 22px; color: #4BB3FF; }

.cb-header__info { flex: 1; }

.cb-header__title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.cb-header__sub {
  font-size: 11px;
  color: rgba(75, 179, 255, 0.85);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-header__sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.cb-header__close {
  background: rgba(255, 255, 255, 0.10);
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.cb-header__close:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ── Progress bar ────────────────────────────────────────── */
.cb-progress {
  height: 3px;
  background: rgba(75, 179, 255, 0.15);
  flex-shrink: 0;
}

.cb-progress__fill {
  height: 100%;
  background: #4BB3FF;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Scrollable body ─────────────────────────────────────── */
.cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f6f9fc;
  scrollbar-width: thin;
  scrollbar-color: #c5d8eb transparent;
}

.cb-body::-webkit-scrollbar { width: 4px; }
.cb-body::-webkit-scrollbar-thumb { background: #c5d8eb; border-radius: 2px; }

/* ── Message bubbles ─────────────────────────────────────── */
.cb-bubble-bot {
  background: #fff;
  border: 1px solid #dce8f4;
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: #1a2e45;
  box-shadow: 0 1px 6px rgba(10, 42, 82, 0.07);
  max-width: 92%;
  align-self: flex-start;
}

.cb-bubble-bot strong { color: #0A2A52; }

.cb-bubble-user {
  background: linear-gradient(135deg, #1E4F8A, #0A2A52);
  color: #fff;
  border-radius: 14px;
  border-top-right-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 80%;
  align-self: flex-end;
}

/* ── Typing indicator ────────────────────────────────────── */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #dce8f4;
  border-radius: 14px;
  border-top-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 6px rgba(10, 42, 82, 0.07);
}

.cb-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4BB3FF;
  animation: cb-dot 1.2s ease-in-out infinite;
}

.cb-typing__dot:nth-child(2) { animation-delay: 0.18s; }
.cb-typing__dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes cb-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-4px); }
}

/* ── 2×2 Action grid ─────────────────────────────────────── */
.cb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.cb-grid__btn {
  background: #fff;
  border: 1.5px solid #c8ddf0;
  border-radius: 12px;
  padding: 13px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #0A2A52;
  line-height: 1.35;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  box-shadow: 0 1px 4px rgba(10, 42, 82, 0.07);
}

.cb-grid__btn:hover {
  border-color: #1E6EDB;
  background: #EEF6FF;
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(30, 110, 219, 0.15);
}

.cb-grid__btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.cb-grid__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EEF6FF, #dbeeff);
  border: 1px solid #c8ddf0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-grid__icon svg { width: 18px; height: 18px; color: #1E6EDB; }

/* ── Choice chips ────────────────────────────────────────── */
.cb-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.cb-choice {
  background: #fff;
  border: 1.5px solid #c8ddf0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #1a2e45;
  cursor: pointer;
  text-align: left;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cb-choice::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #4BB3FF;
  flex-shrink: 0;
}

.cb-choice:hover { border-color: #1E6EDB; background: #EEF6FF; }

.cb-choice.cb-selected {
  border-color: #1E6EDB;
  background: #EEF6FF;
  color: #0A2A52;
  font-weight: 600;
}

.cb-choice.cb-selected::before { background: #4BB3FF; border-color: #4BB3FF; }
.cb-choice:disabled { cursor: not-allowed; }

/* ── CTA row (LINE + Form) ───────────────────────────────── */
.cb-cta-row { display: flex; gap: 8px; }

.cb-cta-line {
  flex: 1;
  background: #06C755;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 2px 10px rgba(6, 199, 85, 0.3);
  text-decoration: none;
}

.cb-cta-line:hover { opacity: 0.88; transform: translateY(-1px); }

.cb-cta-form {
  flex: 1;
  background: #fff;
  color: #1a2e45;
  border: 1.5px solid #c8ddf0;
  border-radius: 10px;
  padding: 12px 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.cb-cta-form:hover { border-color: #1E6EDB; background: #EEF6FF; transform: translateY(-1px); }

.cb-cta-line svg,
.cb-cta-form svg { width: 14px; height: 14px; flex-shrink: 0; }

.cb-divider {
  font-size: 11px;
  color: #8fa8c0;
  text-align: center;
  line-height: 1.65;
  padding: 2px 0;
}

/* ── Contact form panel ──────────────────────────────────── */
.cb-summary {
  background: linear-gradient(135deg, #EEF6FF, #dbeeff);
  border: 1px solid #c8ddf0;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 12px;
  color: #1a2e45;
  line-height: 1.7;
  margin-bottom: 10px;
}

.cb-summary__title {
  font-size: 11px;
  font-weight: 700;
  color: #1E4F8A;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-summary__title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: #4BB3FF;
  border-radius: 2px;
}

.cb-summary__row { display: flex; gap: 6px; align-items: baseline; }
.cb-summary__label { color: #1E4F8A; font-weight: 600; font-size: 11px; white-space: nowrap; min-width: 68px; }

.cb-fields { display: flex; flex-direction: column; gap: 9px; }

.cb-field { display: flex; flex-direction: column; gap: 4px; }

.cb-label {
  font-size: 11px;
  font-weight: 700;
  color: #1E4F8A;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-req {
  background: #e05a5a;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
}

.cb-opt {
  background: #8fa8c0;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
}

.cb-input,
.cb-textarea {
  border: 1.5px solid #c8ddf0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: #1a2e45;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  background: #fff;
  width: 100%;
}

.cb-input::placeholder,
.cb-textarea::placeholder { color: #a0b8cc; }

.cb-input:focus,
.cb-textarea:focus { border-color: #4BB3FF; background: #f6fbff; }

.cb-input.cb-error { border-color: #e05a5a; }

.cb-errmsg {
  font-size: 11px;
  color: #e05a5a;
  display: none;
  margin-top: 1px;
}

.cb-textarea { resize: none; height: 72px; line-height: 1.6; }

.cb-submit {
  width: 100%;
  background: linear-gradient(135deg, #1E4F8A, #0A2A52);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  letter-spacing: 0.03em;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 3px 14px rgba(10, 42, 82, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.cb-submit:hover { opacity: 0.88; transform: translateY(-1px); }
.cb-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cb-submit svg { width: 16px; height: 16px; }

.cb-form-note {
  font-size: 10px;
  color: #8fa8c0;
  text-align: center;
  line-height: 1.6;
  margin-top: 2px;
}

/* ── Success screen ──────────────────────────────────────── */
.cb-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 10px 4px;
}

.cb-success__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EEF6FF, #dbeeff);
  border: 2px solid #4BB3FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-success__icon svg { width: 28px; height: 28px; color: #1E6EDB; }

.cb-success__title { font-size: 15px; font-weight: 700; color: #0A2A52; }

.cb-success__desc { font-size: 12px; color: #4a6a85; line-height: 1.75; }

/* ── Fallback contact info (shown when mailto can't open) ── */
.cb-fallback {
  width: 100%;
  background: #f6f9fc;
  border: 1.5px dashed #c8ddf0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.cb-fallback__title {
  font-size: 11px;
  font-weight: 700;
  color: #8fa8c0;
  letter-spacing: 0.04em;
}

.cb-fallback__email {
  font-size: 13px;
  font-weight: 700;
  color: #1E4F8A;
  text-decoration: none;
  word-break: break-all;
}

.cb-fallback__email:hover { text-decoration: underline; }

.cb-fallback__tel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cb-fallback__tel a {
  font-size: 13px;
  font-weight: 600;
  color: #1a2e45;
  text-decoration: none;
}

.cb-fallback__tel a:hover { color: #1E4F8A; text-decoration: underline; }

/* ── Text input footer ───────────────────────────────────── */
.cb-footer {
  background: #fff;
  border-top: 1px solid #e2edf6;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.cb-footer__input {
  flex: 1;
  border: 1.5px solid #c8ddf0;
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 13px;
  color: #1a2e45;
  outline: none;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  transition: border-color 0.2s;
  background: #f6f9fc;
}

.cb-footer__input::placeholder { color: #a0b8cc; }
.cb-footer__input:focus { border-color: #4BB3FF; background: #fff; }

.cb-footer__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E4F8A, #0A2A52);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(10, 42, 82, 0.25);
  transition: transform 0.18s, box-shadow 0.18s;
}

.cb-footer__send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(10, 42, 82, 0.35);
}

.cb-footer__send svg { width: 15px; height: 15px; color: #fff; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 500px) {
  .cb-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 92px;
    max-height: 75vh;
  }
  .cb-launcher {
    right: 14px;
    bottom: 14px;
  }
}
