/* ══════════════════════════════════════════════
   Chat Form — Fint Création d'Entreprise
   Prefix: cf- (chat form)
   ══════════════════════════════════════════════ */

/* ── Layout ── */
.cf-layout {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  height: 100vh;
  background: #fff;
}

/* ── Illustration panel ── */
.cf-illustration {
  background: #f5f5f5;
  height: 100vh;
  position: sticky;
  top: 0;
}

/* ── Sidebar ── */
.cf-sidebar {
  background: #fff;
  border-right: 1px solid #e5e5e5;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cf-sidebar__logo {
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding-top: 2rem;
}

.cf-sidebar__logo img {
  height: 32px;
  width: auto;
}

.cf-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.cf-sidebar__step {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: default;
  transition: background 0.2s;
}

.cf-sidebar__step.is-active {
  background: #f5f5f5;
}

.cf-sidebar__label {
  font-family: Ppmori, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a3a3a3;
  margin-bottom: 2px;
}

.cf-sidebar__step.is-active .cf-sidebar__label {
  color: #171717;
}

.cf-sidebar__title {
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #a3a3a3;
}

.cf-sidebar__step.is-active .cf-sidebar__title {
  color: #171717;
  font-weight: 600;
}

.cf-sidebar__step.is-completed .cf-sidebar__label,
.cf-sidebar__step.is-completed .cf-sidebar__title {
  color: #72e3ad;
}

/* ── Right column (header + main) ── */
.cf-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Top bar ── */
.cf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.cf-header__dossier {
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #171717;
}

.cf-header__phone {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: Ppmori, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #171717;
  text-decoration: none;
  transition: opacity 0.15s;
  margin-left: auto;
}

.cf-header__phone:hover {
  opacity: 0.7;
}

.cf-header__phone svg {
  width: 18px;
  height: 18px;
}

/* ── Main / Chat ── */
.cf-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.cf-title {
  font-family: Ppmori, sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: #171717;
  margin: 0 0 1.5rem;
  letter-spacing: -0.3px;
}

.cf-chat {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 120px;
  scroll-behavior: smooth;
}

/* ── Messages ── */
.cf-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: cf-fadeSlideUp 0.3s ease both;
}

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

/* iMessage grouping: tighten consecutive same-sender messages */
.cf-message--bot + .cf-message--bot {
  margin-top: -0.65rem;
}

/* Hide avatar on all but the last message in a bot group */
.cf-message--bot:has(+ .cf-message--bot) .cf-avatar {
  visibility: hidden;
}

.cf-message--user {
  justify-content: flex-end;
  animation: cf-pillBounce 0.35s ease both;
}

/* Bot avatar */
.cf-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.cf-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bot bubble */
.cf-bubble {
  max-width: 480px;
  padding: 0.875rem 1.125rem;
  border-radius: 18px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #171717;
  background: #f0f0f0;
}

/* User pill */
.cf-pill {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: 18px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #171717;
  background: #72E3AD;
  max-width: 480px;
}

/* ── Choices ── */
.cf-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
  animation: cf-fadeSlideUp 0.3s ease both;
}

.cf-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.625rem 1.25rem;
  border-radius: 20px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: #525252;
  border: 1.5px solid #525252;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cf-choice svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cf-choice:hover {
  background: #3f3f3f;
  border-color: #3f3f3f;
}

.cf-choice:active {
  transform: scale(0.96);
}

.cf-choice.is-selected {
  background: #171717;
  color: #fff;
  border-color: #171717;
  cursor: default;
}

/* Start button */
.cf-start-btn {
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #171717;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-bottom: 1rem;
  animation: cf-fadeSlideUp 0.3s ease both;
}

.cf-start-btn:hover {
  opacity: 0.85;
}

/* Hint text under question */
.cf-hint {
  font-family: Ppmori, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #a3a3a3;
  margin: -0.5rem 0 1rem 48px;
  animation: cf-fadeSlideUp 0.3s ease both;
}

/* Skip link */
.cf-skip {
  display: block;
  text-align: right;
  font-family: Ppmori, sans-serif;
  font-size: 13px;
  color: #a3a3a3;
  cursor: pointer;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  transition: color 0.15s;
  animation: cf-fadeSlideUp 0.3s ease both;
}

.cf-skip:hover {
  color: #171717;
}

/* ── Multi-choice (checkboxes) ── */
.cf-multi-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
  animation: cf-fadeSlideUp 0.3s ease both;
}

.cf-multi-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  color: #171717;
  background: #fff;
  border: 1.5px solid #d4d4d4;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cf-multi-choice:hover {
  border-color: #171717;
}

.cf-multi-choice.is-checked {
  border-color: #171717;
  background: #f5f5f5;
}

.cf-multi-choice input[type="checkbox"] {
  accent-color: #171717;
  width: 16px;
  height: 16px;
}

.cf-multi-continue {
  padding: 0.625rem 1.5rem;
  border-radius: 9999px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #171717;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.25rem;
}

.cf-multi-continue:hover {
  opacity: 0.85;
}

/* ── Typing animation ── */
.cf-typing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: cf-fadeSlideUp 0.2s ease both;
}

.cf-typing__dots {
  display: flex;
  gap: 4px;
  padding: 0.875rem 1.125rem;
  background: #f0f0f0;
  border-radius: 18px;
}

.cf-typing__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4c4c4;
  animation: cf-typingPulse 1.2s ease-in-out infinite;
}

.cf-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.cf-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* ── Input bar ── */
.cf-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  background: #fff;
  z-index: 10;
}

.cf-input-bar[hidden] {
  display: none;
}

.cf-input-bar input,
.cf-input-bar select {
  flex: 1;
  padding: 0.875rem 1.125rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  color: #171717;
  background: #f5f5f5;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.cf-input-bar input:focus {
  border-color: transparent;
  background: #f5f5f5;
}

.cf-input-bar input::placeholder {
  color: #a3a3a3;
}

.cf-input-bar__send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #171717;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.cf-input-bar__send:hover {
  opacity: 0.85;
}

.cf-input-bar__send svg {
  width: 18px;
  height: 18px;
}

/* Multi-field input */
.cf-multi-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.cf-multi-fields__row {
  display: flex;
  gap: 0.5rem;
}

.cf-multi-fields__row input,
.cf-multi-fields__row select {
  flex: 1;
  padding: 0.875rem 1.125rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  color: #171717;
  background: #f5f5f5;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.cf-multi-fields__row input:focus,
.cf-multi-fields__row select:focus {
  border-color: transparent;
  background: #f5f5f5;
}

.cf-multi-fields__row input::placeholder {
  color: #a3a3a3;
}

/* ── Back button ── */
.cf-back {
  padding: 0.5rem 0;
  background: #fff;
  font-family: Ppmori, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #a3a3a3;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
  text-align: left;
  z-index: 10;
}

.cf-back[hidden] {
  display: none;
}

.cf-back:hover {
  color: #171717;
}

/* ── Scroll-to-bottom button ── */
.cf-scroll-btn {
  position: sticky;
  bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  margin: 0 auto;
  z-index: 11;
  transition: opacity 0.2s, transform 0.2s;
}

.cf-scroll-btn[hidden] {
  display: none;
}

.cf-scroll-btn:hover {
  background: #f5f5f5;
}

.cf-scroll-btn svg {
  width: 18px;
  height: 18px;
  color: #171717;
}

/* ── Bottom bar wrapper (input + back together) ── */
.cf-bottom-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-bottom: 1rem;
  z-index: 10;
}

/* ── Success screen ── */
.cf-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  animation: cf-fadeSlideUp 0.4s ease both;
}

.cf-success__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #72e3ad;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.cf-success__icon svg {
  width: 32px;
  height: 32px;
  color: #171717;
}

.cf-success__title {
  font-family: Ppmori, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #171717;
  margin-bottom: 0.75rem;
}

.cf-success__text {
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #686868;
  max-width: 400px;
  margin-bottom: 2rem;
}

.cf-success__btn {
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #171717;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.cf-success__btn:hover {
  opacity: 0.85;
}

/* ── Rich choices (with description) ── */
.cf-choices--rich {
  flex-direction: column;
  align-items: flex-end;
}

.cf-choice--with-desc {
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  white-space: normal;
  max-width: 380px;
  width: 100%;
}

.cf-choice--with-desc .cf-choice__header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cf-choice__desc {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 2px;
}

.cf-choice--with-desc:hover .cf-choice__desc {
  color: rgba(255, 255, 255, 0.85);
}

/* ── Tips (A savoir) ── */
.cf-tip {
  font-family: Ppmori, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #92700C;
  background: #FFF9E6;
  border: 1px solid #FFE066;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: -0.25rem 0 1rem 48px;
  max-width: 480px;
  animation: cf-fadeSlideUp 0.3s ease both;
}

.cf-tip__icon {
  margin-right: 2px;
}

/* ── Input validation error ── */
.cf-input-error {
  font-family: Ppmori, sans-serif;
  font-size: 12px;
  color: #ef4444;
  padding: 4px 0;
  width: 100%;
}

/* ── Loading screen ── */
.cf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  animation: cf-fadeSlideUp 0.4s ease both;
}

.cf-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e5e5;
  border-top-color: #72e3ad;
  border-radius: 50%;
  animation: cf-spin 0.8s linear infinite;
  margin-bottom: 1.5rem;
}

.cf-loading__text {
  font-family: Ppmori, sans-serif;
  font-size: 14px;
  color: #686868;
}

/* ── Custom scrollbar ── */
.cf-chat::-webkit-scrollbar { width: 4px; }
.cf-chat::-webkit-scrollbar-track { background: transparent; }
.cf-chat::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 2px; }
.cf-chat::-webkit-scrollbar-thumb:hover { background: #a3a3a3; }

/* ── Animations ── */
@keyframes cf-spin {
  to { transform: rotate(360deg); }
}

@keyframes cf-fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cf-pillBounce {
  0% { opacity: 0; transform: scale(0.8) translateY(8px); }
  60% { transform: scale(1.03) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cf-typingPulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .cf-layout {
    grid-template-columns: 1fr;
  }

  .cf-sidebar {
    display: none;
  }

  .cf-illustration {
    display: none;
  }

  .cf-header {
    position: relative;
  }

  .cf-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #72e3ad;
    transition: width 0.4s ease;
    width: var(--cf-progress, 0%);
  }

  .cf-header__phone span {
    display: none;
  }

  .cf-header__dossier {
    font-size: 13px;
  }

  .cf-main {
    padding: 1.25rem 1rem 0;
  }

  .cf-title {
    font-size: 20px;
  }

  .cf-bubble {
    max-width: 85%;
  }

  .cf-pill {
    max-width: 85%;
  }

  .cf-choices {
    gap: 0.375rem;
  }

  .cf-choice {
    font-size: 13px;
    padding: 0.5rem 1rem;
  }

  .cf-choice--with-desc {
    max-width: 100%;
  }

  .cf-tip {
    margin-left: 0;
    max-width: 100%;
  }

  .cf-hint {
    margin-left: 0;
  }
}
