/* ── BISIN Beauty Salon Chatbot Widget ── */
/* 全クラスに cb- プレフィックス。既存CSSと完全分離。 */

:root {
  --cb-dark:   #2f2a26;
  --cb-dark2:  #54463d;
  --cb-accent: #b99c87;
  --cb-accent-d: #8a6e59;
  --cb-bg:     #fdf9f5;
  --cb-card:   rgba(255,255,255,0.96);
  --cb-line:   #e8dfd6;
  --cb-muted:  #9a897c;
  --cb-text:   #2f2a26;
  --cb-line-green: #06C755;
  --cb-radius: 20px;
}

/* ── Launcher button ── */
.cb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cb-dark), var(--cb-dark2));
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(47,42,38,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: cb-pulse 3s ease-in-out infinite;
}

.cb-launcher:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 36px rgba(47,42,38,0.45);
  animation: none;
}

@keyframes cb-pulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(47,42,38,0.38), 0 0 0 0 rgba(185,156,135,0); }
  50%       { box-shadow: 0 8px 28px rgba(47,42,38,0.38), 0 0 0 10px rgba(185,156,135,0.22); }
}

.cb-launcher svg { width: 26px; height: 26px; }

/* Unread badge */
.cb-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #e05a5a;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Chat window ── */
.cb-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 340px;
  max-height: 570px;
  background: var(--cb-bg);
  border-radius: var(--cb-radius);
  box-shadow: 0 20px 60px rgba(47,42,38,0.22), 0 4px 16px rgba(47,42,38,0.10);
  border: 1px solid rgba(232,223,214,0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 8999;
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

/* ── Header ── */
.cb-header {
  background: linear-gradient(135deg, var(--cb-dark), var(--cb-dark2));
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cb-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cb-accent), var(--cb-accent-d));
  border: 2px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.cb-header-title {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.cb-header-sub {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-header-sub::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4cd964;
  border-radius: 50%;
  flex-shrink: 0;
}

.cb-close-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
  flex-shrink: 0;
}

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

/* ── Message area ── */
.cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cb-body::-webkit-scrollbar { width: 4px; }
.cb-body::-webkit-scrollbar-track { background: transparent; }
.cb-body::-webkit-scrollbar-thumb { background: rgba(185,156,135,0.35); border-radius: 4px; }

/* ── Chat bubbles ── */
.cb-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 90%;
}

.cb-msg.cb-bot { align-self: flex-start; }
.cb-msg.cb-user { align-self: flex-end; flex-direction: row-reverse; }

.cb-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cb-accent), var(--cb-accent-d));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  align-self: flex-end;
}

.cb-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.7;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

.cb-bot .cb-bubble {
  background: var(--cb-card);
  border: 1px solid rgba(232,223,214,0.8);
  border-bottom-left-radius: 4px;
  color: var(--cb-text);
  box-shadow: 0 2px 8px rgba(47,42,38,0.06);
}

.cb-user .cb-bubble {
  background: linear-gradient(135deg, var(--cb-dark), var(--cb-dark2));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-bubble strong { font-weight: 800; }
.cb-bubble br { display: block; content: ""; margin-bottom: 2px; }

.cb-bubble .cb-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(232,223,214,0.6);
  padding: 5px 0;
  font-size: 11.5px;
}
.cb-bubble .cb-price-row:last-child { border-bottom: none; }
.cb-bubble .cb-price-name { color: var(--cb-text); font-weight: 600; }
.cb-bubble .cb-price-val { font-weight: 900; color: var(--cb-accent-d); white-space: nowrap; margin-left: 8px; }
.cb-bubble .cb-price-note { font-size: 10px; color: var(--cb-muted); display: block; font-weight: 400; }
.cb-bubble .cb-store-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cb-accent-d);
  background: rgba(185,156,135,0.12);
  border: 1px solid rgba(185,156,135,0.25);
  border-radius: 999px;
  padding: 2px 9px;
  display: inline-block;
  margin: 6px 0 5px;
}
.cb-bubble .cb-highlight {
  display: inline-block;
  background: rgba(201,163,75,0.15);
  border: 1px solid rgba(201,163,75,0.3);
  border-radius: 6px;
  padding: 2px 7px;
  color: #7a5c00;
  font-size: 10.5px;
  font-weight: 800;
  margin: 2px 3px 2px 0;
}

/* ── Typing indicator ── */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--cb-card);
  border: 1px solid rgba(232,223,214,0.8);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.cb-typing span {
  width: 6px; height: 6px;
  background: var(--cb-accent);
  border-radius: 50%;
  animation: cb-dot 1.2s ease-in-out infinite;
}
.cb-typing span:nth-child(2) { animation-delay: 0.18s; }
.cb-typing span:nth-child(3) { animation-delay: 0.36s; }

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

/* ── Topic grid ── */
.cb-topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
  margin-top: 4px;
}

.cb-topic-btn {
  background: rgba(255,255,255,0.96);
  border: 1.5px solid var(--cb-line);
  border-radius: 10px;
  padding: 9px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cb-text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.14s;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.4;
}

.cb-topic-btn:hover:not(:disabled) {
  border-color: var(--cb-accent);
  background: rgba(185,156,135,0.08);
  transform: translateY(-1px);
}

.cb-topic-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* ── Related topics / chips ── */
.cb-related {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 95%;
}

.cb-related__chip {
  background: rgba(255,255,255,0.96);
  border: 1.5px solid var(--cb-line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cb-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

.cb-related__chip:hover {
  border-color: var(--cb-accent);
  background: rgba(185,156,135,0.08);
}

.cb-related__form-btn {
  background: linear-gradient(135deg, var(--cb-dark), var(--cb-dark2));
  border: none;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

.cb-related__form-btn:hover { opacity: 0.85; }

/* ── Footer input ── */
.cb-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(232,223,214,0.8);
  display: flex;
  gap: 7px;
  background: rgba(253,249,245,0.95);
}

.cb-input {
  flex: 1;
  border: 1.5px solid var(--cb-line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--cb-text);
  background: #fff;
  outline: none;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  transition: border-color 0.15s;
}

.cb-input:focus { border-color: var(--cb-accent); }
.cb-input::placeholder { color: var(--cb-muted); }

.cb-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-dark), var(--cb-dark2));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.cb-send-btn:hover { opacity: 0.85; transform: scale(1.06); }
.cb-send-btn svg { width: 15px; height: 15px; }

/* ── Form panel ── */
.cb-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  align-self: flex-start;
  width: 100%;
  max-width: 295px;
}

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

.cb-field label {
  font-size: 10px;
  font-weight: 800;
  color: var(--cb-muted);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.cb-field label .cb-req {
  color: #e05a5a;
  font-size: 9px;
}

.cb-field input,
.cb-field textarea {
  border: 1.5px solid var(--cb-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--cb-text);
  background: #fff;
  outline: none;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.cb-field input:focus,
.cb-field textarea:focus { border-color: var(--cb-accent); }

.cb-field textarea {
  resize: vertical;
  min-height: 64px;
}

.cb-field-error {
  color: #e05a5a;
  font-size: 10px;
  font-weight: 700;
  display: none;
}

.cb-submit-btn {
  background: linear-gradient(135deg, var(--cb-dark), var(--cb-dark2));
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  padding: 11px 18px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  margin-top: 4px;
}
.cb-submit-btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── CTA row (LINE + inquiry) ── */
.cb-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-self: flex-start;
}

.cb-cta-line {
  background: var(--cb-line-green);
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  text-decoration: none;
}
.cb-cta-line:hover { opacity: 0.88; }

.cb-cta-form {
  background: rgba(255,255,255,0.96);
  border: 1.5px solid var(--cb-line);
  border-radius: 999px;
  color: var(--cb-text);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}
.cb-cta-form:hover { border-color: var(--cb-accent); }

/* ── B2B CTA ── */
.cb-b2b-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  background: linear-gradient(135deg, #1E4F8A, #0A2A52);
  color: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 11.5px;
  font-weight: 800;
  text-decoration: none;
  transition: opacity 0.15s;
  border: none;
  cursor: pointer;
}
.cb-b2b-link:hover { opacity: 0.88; }

/* ── Success screen ── */
.cb-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 8px;
  gap: 8px;
  align-self: flex-start;
  max-width: 295px;
}

.cb-success-icon { font-size: 2rem; }

.cb-success-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--cb-text);
  line-height: 1.4;
}

.cb-success-sub {
  font-size: 11px;
  color: var(--cb-muted);
  line-height: 1.65;
}

.cb-fallback {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--cb-line);
  border-radius: 12px;
  font-size: 11px;
  color: var(--cb-muted);
  text-align: left;
  width: 100%;
}

.cb-fallback__title {
  font-size: 10px;
  font-weight: 800;
  color: var(--cb-muted);
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

.cb-fallback a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(232,223,214,0.6);
  color: var(--cb-text);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 600;
  transition: color 0.15s;
}
.cb-fallback a:last-child { border-bottom: none; }
.cb-fallback a:hover { color: var(--cb-accent-d); }

/* ── Header badge ── */
.cb-header-badge {
  display: inline-block;
  margin-top: 4px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.82);
  letter-spacing: 0.04em;
}

/* ── Booking CTA (LINE + HotPepper) ── */
.cb-booking-cta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  align-self: flex-start;
  width: 100%;
  max-width: 295px;
}

.cb-cta-line--full {
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

.cb-hp-row {
  display: flex;
  gap: 5px;
}

.cb-hp-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  cursor: pointer;
  border: none;
  text-align: center;
  line-height: 1.3;
}

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

.cb-hp-btn.cb-hp-tenjin {
  background: linear-gradient(135deg, #c97a3b, #a85e2a);
  color: #fff;
}

.cb-hp-btn.cb-hp-ogori {
  background: linear-gradient(135deg, var(--cb-accent), var(--cb-accent-d));
  color: #fff;
}

/* ── Mobile adjustments ── */
@media (max-width: 760px) {
  .cb-launcher {
    right: 14px;
    bottom: 25vh;
  }

  .cb-window {
    right: 12px;
    bottom: calc(25vh + 72px);
    max-height: calc(75vh - 32px);
  }
}

@media (max-width: 400px) {
  .cb-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: calc(25vh + 72px);
  }
  .cb-launcher {
    right: 12px;
    bottom: 25vh;
  }
}
