/* ═══════════════════════════════════════════════════════════════
   CHATBOT WIDGET  —  Wohner Contracting
   Pure custom CSS, no Bootstrap, uses project CSS custom props
═══════════════════════════════════════════════════════════════ */

/* ─── Keyframes ──────────────────────────────────────────────── */
@keyframes chatbot-pulse {
  0%   { box-shadow: 0 8px 32px rgba(27,95,192,.5), 0 0 0 0 rgba(27,95,192,.55); }
  70%  { box-shadow: 0 8px 32px rgba(27,95,192,.5), 0 0 0 18px rgba(27,95,192,0); }
  100% { box-shadow: 0 8px 32px rgba(27,95,192,.5), 0 0 0 0 rgba(27,95,192,0); }
}

@keyframes chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: .45; }
  30%            { transform: translateY(-6px); opacity: 1;   }
}

/* ─── Utilities ──────────────────────────────────────────────── */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── FAB Toggle ─────────────────────────────────────────────── */
.chatbot-toggle {
  position: fixed;
  bottom: 36px;
  right: 32px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B5FC0, #3b7fef);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(27,95,192,.5);
  animation: chatbot-pulse 2.8s ease-out infinite;
  transition: transform .25s ease, box-shadow .25s ease;
  outline: none;
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(27,95,192,.65);
}

.chatbot-toggle:focus-visible {
  outline: 2px solid rgba(59,127,239,.8);
  outline-offset: 3px;
}

.chatbot-toggle-icon-open,
.chatbot-toggle-icon-close {
  position: absolute;
  font-size: 1.45rem;
  color: #fff;
  transition: opacity .22s ease, transform .22s ease;
}

.chatbot-toggle-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(.7);
}

.chatbot-toggle.is-open { animation: none; }

.chatbot-toggle.is-open .chatbot-toggle-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(.7);
}

.chatbot-toggle.is-open .chatbot-toggle-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: opacity .2s ease, transform .2s ease;
}

/* ─── Chat Window ─────────────────────────────────────────────── */
.chatbot-window {
  position: fixed;
  bottom: 108px;
  right: 28px;
  width: 380px;
  height: auto;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: #0A1628;
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
  z-index: 9998;
  opacity: 0;
  transform: scale(.88) translateY(28px);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity .5s cubic-bezier(0.16, 1, 0.3, 1),
              transform .5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
}

.chatbot-window.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.chatbot-window.closing {
  opacity: 0;
  transform: scale(.88) translateY(28px);
  pointer-events: none;
  transition: opacity .35s cubic-bezier(0.4, 0, 1, 1),
              transform .35s cubic-bezier(0.4, 0, 1, 1);
}

/* ─── Icon Button (header controls) ──────────────────────────── */
.chatbot-btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.75);
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s ease, color .2s ease;
  outline: none;
}

.chatbot-btn-icon:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ─── Shared Header ───────────────────────────────────────────── */
.chatbot-header {
  background: linear-gradient(160deg, #0A1628 0%, #0e2348 60%, #1B5FC0 100%);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.chatbot-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.chatbot-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.chatbot-header-name {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--ff-head, 'Barlow Condensed', sans-serif);
  letter-spacing: .01em;
}

.chatbot-header-status {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  color: #4ade80;
  font-family: 'Barlow', sans-serif;
}

.chatbot-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 6px #4ade80;
}

/* ─── Welcome Panel ───────────────────────────────────────────── */
#chatbot-welcome-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chatbot-welcome-head {
  background: linear-gradient(160deg, #0A1628 0%, #0e2348 60%, #1B5FC0 100%);
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .85rem;
}

.chatbot-welcome-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.chatbot-welcome-intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.chatbot-welcome-intro h3 {
  font-family: var(--ff-head, 'Barlow Condensed', sans-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.15;
}

.chatbot-welcome-intro p {
  font-size: .82rem;
  color: rgba(255,255,255,.7);
  margin: 0;
  line-height: 1.4;
}

.chatbot-welcome-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.chatbot-topics-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
  font-family: var(--ff-head, 'Barlow Condensed', sans-serif);
}

.chatbot-topics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.chatbot-welcome-topic {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: .9rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  transition: background .22s ease, border-color .22s ease, transform .22s ease;
  outline: none;
  user-select: none;
  text-align: left;
  color: #fff;
  font-family: 'Barlow', sans-serif;
}

.chatbot-welcome-topic:hover,
.chatbot-welcome-topic:focus-visible {
  background: rgba(27,95,192,.18);
  border-color: rgba(27,95,192,.45);
  transform: translateY(-2px);
}

.chatbot-topic-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--clr-accent, #1B5FC0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .8rem;
  flex-shrink: 0;
}

.chatbot-welcome-topic span {
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* New Conversation button */
.chatbot-new-conv {
  width: 100%;
  background: linear-gradient(135deg, #1B5FC0, #3b7fef);
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease;
  text-align: left;
  outline: none;
}

.chatbot-new-conv:hover,
.chatbot-new-conv:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(27,95,192,.5);
}

.chatbot-new-conv-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .95rem;
  flex-shrink: 0;
}

.chatbot-new-conv-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  flex: 1;
}

.chatbot-new-conv-text strong {
  font-family: var(--ff-head, 'Barlow Condensed', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  display: block;
}

.chatbot-new-conv-text span {
  font-size: .75rem;
  color: rgba(255,255,255,.7);
  display: block;
}

.chatbot-new-conv-arrow {
  margin-left: auto;
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  flex-shrink: 0;
}

/* Brand footer strip (shared across panels) */
.chatbot-brand {
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center;
  padding: .65rem 1rem;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  font-family: 'Barlow', sans-serif;
  margin: 0;
  flex-shrink: 0;
}

.chatbot-brand-link {
  color: #1B5FC0;
  text-decoration: none;
  transition: color .2s ease, text-shadow .2s ease;
}

.chatbot-brand-link:hover {
  color: #3b7fef;
  text-shadow: 0 0 10px rgba(59,127,239,.5);
  text-decoration: underline;
}

/* ─── Contact Panel ───────────────────────────────────────────── */
#chatbot-contact-panel {
  height: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.chatbot-contact-body {
  padding: 1.5rem 1.5rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chatbot-contact-prompt {
  color: rgba(255,255,255,.88);
  font-size: .92rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
  font-family: 'Barlow', sans-serif;
}

/* Form fields */
.chatbot-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .9rem;
}

.chatbot-field label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.55);
  font-family: 'Barlow', sans-serif;
}

.chatbot-field input {
  width: 100%;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: .8rem 1rem;
  color: #111827;
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.chatbot-field input::placeholder { color: #9ca3af; }

.chatbot-field input:focus {
  border-color: #1B5FC0;
  box-shadow: 0 0 0 3px rgba(27,95,192,.25);
}

.chatbot-field input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.2);
}

.chatbot-field-error {
  font-size: .71rem;
  color: #f87171;
  line-height: 1.4;
  min-height: 1em;
  display: block;
  font-family: 'Barlow', sans-serif;
}

/* Submit button */
.chatbot-contact-submit {
  width: 100%;
  background: linear-gradient(135deg, #1B5FC0, #3B7FD4);
  border: none;
  border-radius: 8px;
  padding: .9rem 1rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
  transition: transform .22s ease, box-shadow .22s ease;
  outline: none;
}

.chatbot-contact-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(27,95,192,.45);
}

.chatbot-contact-submit:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

.chatbot-privacy {
  font-size: .72rem;
  color: rgba(255,255,255,.38);
  text-align: center;
  margin-top: .9rem;
  line-height: 1.5;
  font-family: 'Barlow', sans-serif;
}

/* ─── Chat Panel ──────────────────────────────────────────────── */
#chatbot-chat-panel {
  height: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Messages area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
  min-height: 0;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.chatbot-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }

/* Message rows */
.chatbot-message { display: flex; }
.chatbot-message.bot-message  { justify-content: flex-start; }
.chatbot-message.user-message { justify-content: flex-end; }

.chatbot-message-content {
  max-width: 78%;
  padding: .65rem .9rem;
  border-radius: 16px;
  font-size: .82rem;
  line-height: 1.55;
  font-family: 'Barlow', sans-serif;
  word-break: break-word;
  white-space: pre-wrap;
}

.chatbot-message.bot-message .chatbot-message-content {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #e8edf5;
  border-bottom-left-radius: 4px;
}

.chatbot-message.user-message .chatbot-message-content {
  background: linear-gradient(135deg, #1B5FC0, #3b7fef);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-message-content p { margin: 0; }

/* Typing indicator */
.chatbot-message.bot-message .chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .65rem .9rem;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
}

.chatbot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.6);
  animation: chatbot-bounce 1.2s ease-in-out infinite;
}

.chatbot-typing-dot:nth-child(2) { animation-delay: .2s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: .4s; }

/* Suggestion chips */
.chatbot-suggestions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.chatbot-suggestion-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: .45rem .85rem;
  color: rgba(255,255,255,.8);
  font-size: .75rem;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
  outline: none;
}

.chatbot-suggestion-btn:hover {
  background: rgba(27,95,192,.25);
  border-color: rgba(27,95,192,.5);
  color: #fff;
}

/* Chat input form */
.chatbot-form {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.07);
  padding: .9rem 1rem;
  display: flex;
  gap: .6rem;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: .6rem 1rem;
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-size: .875rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.chatbot-input::placeholder { color: rgba(255,255,255,.3); }

.chatbot-input:focus {
  border-color: rgba(27,95,192,.7);
  box-shadow: 0 0 0 3px rgba(27,95,192,.18);
}

.chatbot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B5FC0, #3b7fef);
  border: none;
  color: #fff;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .2s ease, box-shadow .2s ease;
  outline: none;
}

.chatbot-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(27,95,192,.5);
}

.chatbot-send-btn:focus-visible {
  outline: 2px solid rgba(59,127,239,.8);
  outline-offset: 2px;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chatbot-toggle {
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
  }
  .chatbot-toggle-icon-open,
  .chatbot-toggle-icon-close { font-size: 1.2rem; }
  .chatbot-window {
    bottom: 90px;
    right: 20px;
  }
}
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 84px;
  }
  .chatbot-toggle {
    bottom: 20px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}
