/* ============================================================
   CHATBOT WIDGET
   ============================================================ */

.mb-chat {
  position: fixed;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  z-index: 9999;
  font-family: var(--font-body);
}

/* Toggle button */
.mb-chat__toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-normal) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}

.mb-chat__toggle:hover {
  transform: scale(1.08);
  background: var(--color-surface-2);
}

.mb-chat__toggle.is-open {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* Panel */
.mb-chat__panel {
  position: absolute;
  bottom: 40px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 2rem);
  max-height: min(520px, calc(100vh - 8rem));
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  box-shadow: var(--shadow-hero);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.mb-chat__panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.mb-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.mb-chat__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--size-sm);
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.mb-chat__close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--duration-fast);
}

.mb-chat__close:hover {
  color: var(--color-text);
}

/* Messages */
.mb-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

.mb-chat__msg {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  line-height: 1.55;
  color: var(--color-text);
  word-wrap: break-word;
}

.mb-chat__msg--assistant {
  align-self: flex-start;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.mb-chat__msg--user {
  align-self: flex-end;
  background: var(--color-gold);
  color: var(--color-on-accent);
  border: none;
}

.mb-chat__msg--typing {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Form */
.mb-chat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg);
}

.mb-chat__input {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: var(--size-sm);
  font-family: var(--font-body);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--duration-fast);
}

.mb-chat__input::placeholder {
  color: var(--color-text-muted);
}

.mb-chat__input:focus {
  border-color: var(--color-gold);
}

.mb-chat__send {
  background: var(--color-gold);
  color: var(--color-on-accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: var(--size-sm);
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--duration-fast);
}

.mb-chat__send:hover {
  opacity: 0.88;
}

.mb-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hide on mobile */
@media (max-width: 768px) {
  .mb-chat {
    display: none;
  }
}

/* Hide on pages with contact form to avoid visual conflict */
.page-template-page-contact .mb-chat {
  display: none;
}
