/* -----------------------------
   Matrix Digital Chat Widget
   FULL + FINAL (Sticky Input Fix)
------------------------------ */

/* STOP BACKGROUND SCROLL WHEN CHAT OPEN */
body.mdc-no-scroll {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

/* Container */
.mdc-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Toggle Button */
.mdc-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #e11d2e;
  color: #fff;
  padding: 12px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
  user-select: none;
}

.mdc-toggle-icon { font-size: 16px; }
.mdc-toggle-label { font-size: 14px; font-weight: 700; }

/* Panel */
.mdc-panel {
  width: 340px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  position: absolute;
  right: 0;
  bottom: 58px;

  display: flex;
  flex-direction: column;
}

.mdc-hidden { display: none !important; }

/* Header (UNCHANGED) */
.mdc-header {
  background: #e11d2e;
  color: #fff;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.mdc-title { font-weight: 800; font-size: 14px; }

.mdc-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* Body */
.mdc-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* important for flex scroll */
}

/* Mode bar (slimmer height ONLY) */
.mdc-mode-bar {
  display: flex;
  gap: 10px;

  /* was 12px */
  padding: 8px 12px;

  flex: 0 0 auto;
}

/* AI Assistant + Live Agent buttons (slimmer height ONLY) */
.mdc-mode-btn {
  flex: 1;
  border: 1px solid #eee;
  background: #f7f7f7;

  /* was 10px 12px */
  padding: 7px 12px;

  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #111;

  /* makes them feel slimmer without changing your design */
  line-height: 1.1;
}

.mdc-mode-btn-active {
  background: #e11d2e;
  border-color: #e11d2e;
  color: #fff;
}

/* Contact row (slimmer height ONLY) */
.mdc-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;

  /* was: padding: 0 12px 10px; */
  padding: 0 12px 6px;

  flex: 0 0 auto;
}

.mdc-contact-label {
  font-size: 12px;
  color: #666;
}

/* WhatsApp + Facebook buttons (slimmer height ONLY) */
.mdc-contact-btn {
  border: 0;

  /* was 9px 12px */
  padding: 6px 12px;

  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  color: #fff;

  line-height: 1.1;
}

.mdc-contact-whatsapp { background: #22c55e; }
.mdc-contact-facebook { background: #2563eb; }

/* ✅ Messages area ONLY scrolls */
.mdc-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  background: #fafafa;
  border-top: 1px solid #f1f1f1;
  border-bottom: 1px solid #f1f1f1;

  overscroll-behavior: contain;
  touch-action: pan-y;
}

/* Messages */
.mdc-message {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
  white-space: pre-wrap;
}

.mdc-message-user {
  margin-left: auto;
  background: #e11d2e;
  color: #fff;
  border-top-right-radius: 6px;
}

.mdc-message-assistant {
  margin-right: auto;
  background: #fff;
  border: 1px solid #eee;
  color: #111;
  border-top-left-radius: 6px;
}

.mdc-message-thinking {
  opacity: 0.7;
  font-style: italic;
}

/* Clickable links */
.mdc-message-assistant a.mdc-link {
  color: #2563eb;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

/* Footer */
.mdc-footer {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  background: #fff;
}

/* error */
.mdc-error {
  font-size: 12px;
  color: #dc2626;
  min-height: 16px;
  margin-bottom: 6px;
}

/* Input row */
.mdc-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mdc-input {
  flex: 1;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #eee;
  outline: none;
  font-size: 16px;
  background: #fff;
}

.mdc-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: #e11d2e;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
}

/* Mobile tweaks */
@media (max-width: 420px) {
  .mdc-panel {
    width: calc(100vw - 36px);
    height: 520px;
  }
}
