/* ============================================
   Professional-Matching Chat -- dedicated page (round26)
   /get-matched, linked from the header nav beside "Free Consultation".
   Replaces the earlier floating-widget version: this is a full page, styled
   like a fresh Claude conversation -- centered hero + big input until the
   first message, then a scrolling transcript with a pinned input bar.
   ============================================ */

.kd-chatpage {
  --kd-chatpage-offset: 132px; /* approx height of topbar + sticky header above this section */
  position: relative;
  /* round37: was 820px -- matches the site's standard wide-content width (see
     profile_page.css/profession_page.css/claude_css.css) instead of a narrow centered
     column, so the conversation and matched-professional cards actually use the space
     instead of leaving large empty margins on both sides. */
  max-width: 1200px;
  margin: 0 auto;
  /* Fixed (not min-) height + overflow:hidden so the OUTER page never scrolls past this
     section -- only .kd-chatpage__messages below scrolls internally. Previously this used
     min-height, which let the whole document grow, so "scroll to bottom" after each message
     jumped past the footer instead of just revealing the latest message. */
  height: calc(100vh - var(--kd-chatpage-offset));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Poppins', sans-serif;
  padding: 0 20px;
}

/* ---------------- Hero (pre-first-message) ---------------- */

.kd-chatpage__hero {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.kd-chatpage__hero.is-hidden {
  display: none;
}

.kd-chatpage__hero-inner {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
  padding: 40px 0;
}

.kd-chatpage__hero-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--kd-blue) 0%, var(--kd-blue-dark) 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(30, 91, 170, 0.25);
}

.kd-chatpage__hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--kd-text-primary, #1A1A1A);
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.kd-chatpage__hero-subtitle {
  font-size: 15px;
  color: var(--kd-text-secondary, #4B5563);
  margin: 0 0 28px;
  line-height: 1.5;
}

.kd-chatpage__hero-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #FFFFFF;
  border: 1.5px solid var(--kd-border, #E5E7EB);
  border-radius: 20px;
  padding: 12px 12px 12px 20px;
  box-shadow: 0 4px 20px rgba(20, 20, 43, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kd-chatpage__hero-form:focus-within {
  border-color: var(--kd-blue);
  box-shadow: 0 4px 20px rgba(30, 91, 170, 0.15);
}

.kd-chatpage__hero-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  max-height: 160px;
  padding: 6px 0;
  background: transparent;
  color: var(--kd-text-primary, #1A1A1A);
}

.kd-chatpage__hero-send,
.kd-chatpage__send {
  background: var(--kd-blue);
  color: #FFFFFF;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.kd-chatpage__hero-send:hover,
.kd-chatpage__send:hover {
  background: var(--kd-blue-hover);
}

.kd-chatpage__hero-send:disabled,
.kd-chatpage__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kd-chatpage__suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.kd-chatpage__suggestion {
  background: var(--kd-bg-page, #F8F9FB);
  border: 1px solid var(--kd-border, #E5E7EB);
  color: var(--kd-text-secondary, #4B5563);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kd-chatpage__suggestion:hover {
  background: #FFFFFF;
  border-color: var(--kd-blue);
  color: var(--kd-blue);
}

/* ---------------- Conversation (post-first-message) ---------------- */

.kd-chatpage__conversation {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* required so the __messages child below can actually scroll within flex */
  padding-top: 8px;
}

.kd-chatpage__conversation.is-visible {
  display: flex;
}

/* round41: floating "New chat" button, deliberately OUTSIDE .kd-chatpage (see
   chat_page.php) so it's always reachable without ever taking up vertical room inside the
   conversation -- the "Get Matched" title + inline "New chat" bar that used to sit above
   the transcript were removed for exactly that reason (max chat area was requested).
   Stacked above the site's existing floating buttons: back-to-top sits at bottom:81px
   right:28px (public/css/style.css) and the "Need Help Finding Someone?" pill sits at
   bottom:24px right:24px (public/css/claude_css.css) -- this sits above both. */
.kd-chatpage__floating-newchat {
  position: fixed;
  right: 28px;
  bottom: 140px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--kd-blue);
  color: #FFFFFF;
  border: none;
  padding: 12px 18px;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(30, 91, 170, 0.35);
  transition: all 0.15s ease;
}

.kd-chatpage__floating-newchat:hover {
  background: var(--kd-blue-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(30, 91, 170, 0.45);
}

@media (max-width: 640px) {
  .kd-chatpage__floating-newchat {
    right: 16px;
    bottom: 128px;
    padding: 12px;
    border-radius: 50%;
  }
  .kd-chatpage__floating-newchat__text {
    display: none;
  }
}

.kd-chatpage__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 24px;
  /* round37: still fully scrollable with the wheel/trackpad/keys -- just no visible
     scrollbar track, matching Claude's own conversation UI (was showing a thick default
     OS scrollbar down the right edge, read by the user as unwanted "side scroll"). */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge/IE */
}

.kd-chatpage__messages::-webkit-scrollbar {
  display: none; /* Chrome/Edge/Safari */
}

.kd-chatpage__hero {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.kd-chatpage__hero::-webkit-scrollbar {
  display: none;
}

/* round37: while /get-matched is open (class toggled by match_chat_page.js), hide the
   browser's page-level scrollbar track too -- the page can still be scrolled normally,
   it just never shows a visible scrollbar, same treatment as the panels above. */
body.kd-chatpage-active {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.kd-chatpage-active::-webkit-scrollbar {
  display: none;
}

.kd-chatpage__msg {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
}

.kd-chatpage__msg--bot {
  background: var(--kd-bg-page, #F8F9FB);
  color: var(--kd-text-primary, #1A1A1A);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.kd-chatpage__msg--user {
  background: var(--kd-blue);
  color: #FFFFFF;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.kd-chatpage__msg--typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}

.kd-chatpage__msg--typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--kd-text-muted, #9CA3AF);
  animation: kdChatTyping 1s infinite ease-in-out;
}

.kd-chatpage__msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.kd-chatpage__msg--typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* Matched professional cards render via home/professional_card.php, reusing the
   existing .kdp-card / .kd-card__* styles as-is. */
.kd-chatpage__results {
  align-self: stretch;
  max-width: 100%;
}

.kd-match-group {
  align-self: stretch;
  margin-bottom: 8px;
}

.kd-match-group__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--kd-text-muted, #9CA3AF);
  margin: 4px 0 10px;
}

.kd-match-group__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.kd-chatpage__contact-form {
  align-self: stretch;
  background: var(--kd-bg-page, #F8F9FB);
  border: 1px solid var(--kd-border, #E5E7EB);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.kd-chatpage__contact-form__row {
  display: flex;
  gap: 10px;
}

.kd-chatpage__contact-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--kd-border, #E5E7EB);
  font-size: 13.5px;
  font-family: 'Poppins', sans-serif;
}

.kd-chatpage__contact-form input:focus {
  outline: none;
  border-color: var(--kd-blue);
}

.kd-chatpage__contact-form button {
  background: var(--kd-orange);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
}

.kd-chatpage__contact-form button:hover {
  background: var(--kd-orange-dark);
}

.kd-chatpage__contact-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.kd-chatpage__contact-form__error {
  color: #D14343;
  font-size: 12.5px;
  display: none;
}

.kd-chatpage__contact-form__error.is-visible {
  display: block;
}

.kd-chatpage__contact-success {
  align-self: flex-start;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
  font-size: 13.5px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 78%;
}

/* ---------------- Pinned bottom input bar ---------------- */

.kd-chatpage__inputbar {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  padding: 14px 0 20px;
  border-top: 1px solid var(--kd-border, #E5E7EB);
}

.kd-chatpage__inputbar.is-visible {
  display: flex;
}

.kd-chatpage__input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border-radius: 24px;
  border: 1.5px solid var(--kd-border, #E5E7EB);
  font-size: 14.5px;
  font-family: 'Poppins', sans-serif;
}

.kd-chatpage__input:focus {
  outline: none;
  border-color: var(--kd-blue);
}

@media (max-width: 640px) {
  .kd-chatpage {
    --kd-chatpage-offset: 118px;
    padding: 0 14px;
  }
  .kd-chatpage__hero-title {
    font-size: 22px;
  }
  .kd-chatpage__hero-subtitle {
    font-size: 13.5px;
  }
  .kd-chatpage__msg {
    max-width: 90%;
  }
  .kd-match-group__cards {
    grid-template-columns: 1fr;
  }
}
