/* ==================================================
   CHAT CARD
================================================== */

.yuj-chat-card {
  width: 100%;
  height: clamp(540px, 78vh, 600px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border: 1px solid #d9d8e0;
  background: #f8f8f8;
  border-radius: 24px;
  overflow: hidden;
  box-sizing: border-box;
}

/* ==================================================
   HEADER
================================================== */

.yuj-chat-header {
  flex: 0 0 auto;
  padding: 30px 32px 12px;

  background: #f8f8f8;

  position: relative;
  z-index: 5;
}

.yuj-chat-header h2 {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.2vw, 38px);
  font-weight: 600;
  line-height: 1.15;

  color: #111;
}

.yuj-chat-header p {
  margin: 0 !important;

  font-size: 18px;
  line-height: 1.5;

  color: #666;
}

/* ==================================================
   SCROLL AREA
================================================== */

.yuj-chat-scroll {
  flex: 1 1 auto;

  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 18px 32px 30px;

  scroll-behavior: smooth;

  overscroll-behavior: contain;
}

.yuj-chat-scroll::-webkit-scrollbar {
  width: 5px;
}

.yuj-chat-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.yuj-chat-scroll::-webkit-scrollbar-thumb {
  background: #d2d2d2;
  border-radius: 20px;
}

/* ==================================================
   HISTORY
================================================== */

.yuj-chat-history {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
}

/* ==================================================
   BOT TURN
================================================== */

.chat-bot-turn {
  width: 100%;

  animation: chatFadeIn 0.35s ease both;
}

.chat-bot-message {
  display: flex;

  align-items: flex-start;

  gap: 12px;

  max-width: 90%;
}

.chat-bot-dot {
  width: 9px;
  height: 9px;

  min-width: 9px;

  margin-top: 12px;

  border-radius: 50%;

  background: #ff9500;
  display: none;
}

.chat-bot-bubble {
  padding: 12px;
  border-radius: 12px 12px 12px 0;
  background: #edecf7;
  color: #4b3bc4;
  font-weight: 500;
}

.chat-bot-bubble strong {
  font-weight: 600;
}

.chat-helper {
  display: block;

  margin-top: 5px;

  font-size: 13px;

  color: #777;
}

/* ==================================================
   USER MESSAGE
================================================== */

.chat-user-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  animation: chatFadeIn 0.3s ease both;
  display: none;
}

.chat-user-bubble {
  max-width: 72%;
  padding: 12px;
  background: #ffefd7;
  color: #3c3c3c;
  border-radius: 12px 12px 0 12px;
}

.chat-user-answer + .chat-user-answer {
  margin-top: 4px;
}

/* ==================================================
   OPTIONS
================================================== */

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chat-option {
  appearance: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #d4d4d4;
  background: #fff;
  color: #3c3c3c;
  padding: 8px 10px !important;
  border-radius: 6px;
  font-size: 16px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: pointer;
  text-transform: capitalize;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.chat-option:hover {
  border-color: #f59301;
}
.chat-options button {
  margin: 0;
}

.chat-option.is-selected {
  border-color: #f59301;

  background: #fff2e2;

  color: #222;
}

.chat-option:disabled {
  cursor: default;

  opacity: 0.5;
}

.chat-option.is-selected:disabled {
  opacity: 1;
}

/* ==================================================
   TYPING
================================================== */

.chat-typing-row {
  display: flex;

  align-items: center;

  gap: 6px;

  padding-left: 21px;

  min-height: 30px;

  animation: chatFadeIn 0.25s ease both;
}

.chat-typing-row span {
  width: 12px;
  height: 12px;

  border-radius: 50%;

  background: #aaa0e7;

  animation: yujTyping 1.1s infinite ease-in-out;
}

.chat-typing-row span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-row span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes yujTyping {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ==================================================
   CONTACT DETAILS
================================================== */

.yuj-chat-contact {
  display: none;

  margin-top: 30px;

  animation: chatFadeIn 0.4s ease both;
}

.yuj-chat-contact.is-visible {
  display: block;
}

.chat-contact-grid {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 18px;
}

.chat-field label {
  display: block;

  margin-bottom: 7px;

  font-weight: 500;

  color: #000;
}

.chat-input {
  width: 100% !important;
  height: 56px;
  padding: 0 14px !important;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.17) !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #222 !important;
  font-size: 16px !important;
  outline: none !important;
}

.chat-input:focus {
  border-color: #ff9500 !important;
  box-shadow: none !important;
}

.chat-input.is-invalid,
.chat-input.is-invalid:focus {
  border-color: #dc3232 !important;
}

.yuj-chat-card .chat-field .chat-validation-message {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  color: #dc3232;
  font-size: 12px;
  text-align: left;
}

.yuj-chat-card .chat-field .chat-validation-message[hidden] {
  display: none !important;
}

.chat-input::placeholder {
  font-size: 16px !important;
}

.chat-phone-control {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.chat-dial-code-wrap {
  flex: 0 0 70px;
  height: 56px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.17);
  border-radius: 6px;
  background: #fff;
  color: #222;
}

.chat-dial-code-wrap:focus-within {
  border-color: #ff9500;
}

.chat-dial-code-wrap.is-invalid {
  border-color: #dc3232;
}

.chat-dial-prefix {
  flex: 0 0 auto;
  font-size: 16px;
}

.chat-phone-control .chat-dial-code {
  min-width: 0;
  width: 100% !important;
  height: 100%;
  padding: 0 0 0 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #222 !important;
  font-family: inherit;
  font-size: 16px !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.chat-phone-control > .wpcf7-form-control-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-phone-input {
  min-width: 0;
}

/* ==================================================
   FOOTER
================================================== */

.yuj-chat-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px 24px;
  background: #f8f8f8;
  position: relative;
  z-index: 5;
}
.yuj-chat-footer button {
  margin: 0;
  text-transform: capitalize !important;
}
.yuj-chat-footer .chat-reset-actions .cta-secondary-btn,
.yuj-chat-footer .chat-reset-actions .cta-secondary-btn:hover {
  color: #4b3bc4;
  border-color: #4b3bc4 !important;
}
.chat-proceed {
  appearance: none;
  min-width: 94px;

  padding: 11px 17px;

  border: 0;

  border-radius: 5px;

  background: #bcbcbc;
  color: #fff;
  cursor: pointer;
  text-transform: capitalize !important;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
}

.chat-proceed:hover:not(:disabled) {
  background: #ff9500;
}

.chat-proceed:disabled,
.chat-proceed:disabled:hover {
  background: #bcbcbc !important;
  color: #fff;
  cursor: not-allowed;
  border-color: #bcbcbc;
}

.chat-reset {
  appearance: none;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #4b3bc4;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none !important;
  cursor: pointer;
}

.chat-reset:hover {
  color: #f59301;
}

.chat-reset[hidden],
.chat-reset-confirmation[hidden] {
  display: none !important;
}

.chat-reset-confirmation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 16px;
  box-sizing: border-box;
  border: 1px solid rgba(75, 59, 196, 0.2);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(38, 31, 94, 0.14);
  animation: chatFadeIn 0.25s ease both;
}

.chat-reset-prompt {
  margin: 0 !important;
  color: #3c3c3c;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.chat-reset-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.chat-reset-actions button {
  margin: 0 !important;
}

.yuj-chat-header,
.yuj-chat-scroll,
.yuj-chat-footer {
  transition:
    filter 0.25s ease,
    opacity 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.yuj-chat-card.is-confirming-reset .yuj-chat-header,
.yuj-chat-card.is-confirming-reset .yuj-chat-scroll {
  filter: blur(2.5px);
  opacity: 0.32;
  pointer-events: none;
  user-select: none;
}

.yuj-chat-card.is-confirming-reset .yuj-chat-footer {
  background: #f7f6ff;
  box-shadow: 0 -16px 36px rgba(38, 31, 94, 0.16);
}

/* Actual CF7 submit is triggered by JS */

.cf7-native-submit {
  display: none !important;
}

/* ==================================================
   CF7
================================================== */

.yuj-chat-card .wpcf7-spinner {
  display: none;
}

.yuj-chat-card .wpcf7-not-valid-tip {
    display: none !important;
}

.wpcf7 form .wpcf7-response-output {
  margin: 12px 32px !important;
}

/* ==================================================
   OTHER ROLE AUTOCOMPLETE
================================================== */

.chat-other-role {
  width: 100%;
  max-width: 500px;

  margin-top: 18px;

  position: relative;

  animation: chatFadeIn 0.3s ease both;
}

.chat-other-label {
  display: block;

  margin-bottom: 8px;

  font-size: 14px;
  font-weight: 500;

  color: #333;
}

.chat-other-input-wrap {
  position: relative;
}

.chat-other-input {
  width: 100%;

  height: 48px;

  padding: 0 42px 0 14px;

  box-sizing: border-box;

  border: 1px solid #d0d0d0;

  border-radius: 7px;

  background: #fff;

  color: #222;

  font-family: inherit;
  font-size: 15px;

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.chat-other-input:focus {
  border-color: #ff9500;

  box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.08);
}

.chat-other-input::placeholder {
  color: #999;
}

/* First-step Other role input */

.chat-role-other-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  background: #fff;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.chat-role-other-input-wrap:focus-within {
  border-color: #f59301;
}

.chat-role-other-input {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  height: 42px;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  font-size: 16px;
  box-shadow: none !important;
}

.chat-role-other-input:focus {
  border: 0 !important;
  box-shadow: none !important;
}

.chat-role-other-input::placeholder {
  font-size: 16px !important;
}

.chat-role-confirm {
  appearance: none;
  flex: 0 0 auto;
  margin: 0 12px 0 6px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #f59301;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-transform: none !important;
  cursor: pointer;
}

.chat-role-confirm:disabled {
  color: #aaa;
  cursor: not-allowed;
  opacity: 1;
}

.chat-option-other-input-wrap {
  width: 100%;
  border-radius: 6px;
}

.chat-option-other-input {
  height: 42px;
  padding: 8px 10px !important;
  border: 1px solid #d4d4d4;
  border-radius: 6px !important;
  background: #fff;
  font-size: 16px;
}

.chat-option-other-input:focus {
  border-color: #f59301;
  box-shadow: none;
}

.chat-option-other-input::placeholder {
  font-size: 16px !important;
}

.chat-bot-bubble a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* Suggestions dropdown */

.chat-role-suggestions {
  display: none;

  position: absolute;

  top: calc(100% + 6px);
  left: 0;
  right: 0;

  z-index: 50;

  max-height: 230px;

  overflow-y: auto;

  padding: 6px;

  background: #fff;

  border: 1px solid #ddd;

  border-radius: 8px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chat-role-suggestions.is-visible {
  display: block;
}

.chat-role-suggestion {
  width: 100%;
  padding: 8px 10px !important;
  border: 0;
  border-radius: 5px;
  margin: 0;
  background: transparent;
  color: #3c3c3c;
  text-align: left;
  cursor: pointer;
  text-transform: capitalize !important;
}

.chat-role-suggestion:hover,
.chat-role-suggestion.is-active {
  background: #fff4e4;

  color: #222;
}

.chat-role-suggestion strong {
  color: #ff9500;
  font-weight: 600;
}

.chat-role-no-result {
  padding: 12px;

  font-size: 14px;

  color: #777;
}

/* Optional free-text action */

.chat-use-custom-role {
  display: none;

  margin-top: 10px;

  padding: 10px 15px;

  border: 1px solid #ff9500;

  border-radius: 5px;

  background: transparent;

  color: #333;

  font-family: inherit;
  font-size: 14px;

  cursor: pointer;
}

.chat-use-custom-role.is-visible {
  display: inline-flex;
}

.chat-use-custom-role:hover {
  background: #fff4e4;
}
.starRequired{
  color: #dc3232;
}
/* Mobile */

@media (max-width: 767px) {
  .chat-other-role {
    max-width: none;

    margin-left: 0;
  }

  .chat-role-suggestions {
    position: relative;
    max-height: 150px;
  }
}

/* ==================================================
   ANIMATION
================================================== */

@keyframes chatFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================================================
   NATURAL HEIGHT — MOBILE AND TABLET
================================================== */

@media (max-width: 1180px) {
  .yuj-chat-card {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .yuj-chat-scroll {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    scroll-behavior: auto;
  }
}

/* ==================================================
   MOBILE
================================================== */

@media (max-width: 767px) {
  .yuj-chat-card {
    border-radius: 18px;
  }

  .yuj-chat-header {
    padding: 22px 20px 10px;
  }

  .yuj-chat-header p {
    font-size: 16px;
  }

  .yuj-chat-scroll {
    padding: 18px 20px 25px;
  }

  .yuj-chat-footer {
    padding: 12px 20px 20px;
  }

  .chat-reset-confirmation {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .chat-bot-message {
    max-width: 100%;
  }

  .chat-user-bubble {
    max-width: 84%;
  }

  .chat-options {
    padding-left: 0;
  }

  .chat-option {
    width: auto;
    font-size: 14px;
    text-align: left;
  }

  .chat-typing-row {
    padding-left: 0;
  }

  .chat-contact-grid {
    grid-template-columns: 1fr;
  }
}
