/* ============================================================
   MERCURI GARDEN & BUILDING SUPPLIES — Triage Chatbot Styles
   Theme: Mercuri Navy (#0f4c86) & Aqua Accent (#46a7cd)
   ============================================================ */

.mgs-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #14171a;
  -webkit-font-smoothing: antialiased;
}

/* Floating Launcher Button */
.mgs-chat-launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0f4c86;
  color: #ffffff;
  border: 2px solid #46a7cd;
  border-radius: 32px;
  padding: 10px 18px 10px 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 76, 134, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.mgs-chat-launcher:hover {
  background: #0c3b69;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 76, 134, 0.45);
}

.mgs-chat-launcher:active {
  transform: translateY(0);
}

.mgs-launcher-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #46a7cd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  position: relative;
}

.mgs-launcher-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.mgs-launcher-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #00E676;
  border: 2px solid #0f4c86;
  border-radius: 50%;
  animation: mgsPulse 2s infinite;
}

@keyframes mgsPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(0, 230, 118, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
  }
}

.mgs-launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.mgs-launcher-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
  color: #ffffff;
}

.mgs-launcher-sub {
  font-size: 0.74rem;
  color: #daedf5;
  line-height: 1.2;
}

/* Chat Window Box */
.mgs-chat-box {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(12, 59, 105, 0.25), 0 0 0 1px rgba(70, 167, 205, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

.mgs-chat-box.mgs-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.mgs-chat-header {
  background: #0f4c86;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #46a7cd;
}

.mgs-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mgs-header-avatar {
  width: 36px;
  height: 36px;
  background: #46a7cd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.mgs-header-titles h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
}

.mgs-header-status {
  font-size: 0.72rem;
  color: #daedf5;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mgs-status-dot {
  width: 6px;
  height: 6px;
  background: #00E676;
  border-radius: 50%;
  display: inline-block;
}

.mgs-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mgs-btn-icon {
  background: transparent;
  border: none;
  color: #daedf5;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.mgs-btn-icon:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Chat Body (Messages Stream) */
.mgs-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f4f8fb;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.mgs-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: mgsFadeIn 0.25s ease-out;
}

@keyframes mgsFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mgs-msg.mgs-bot {
  align-self: flex-start;
}

.mgs-msg.mgs-user {
  align-self: flex-end;
}

.mgs-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mgs-msg.mgs-bot .mgs-msg-bubble {
  background: #ffffff;
  color: #14171a;
  border-bottom-left-radius: 2px;
  border: 1px solid #cbe6f1;
}

.mgs-msg.mgs-user .mgs-msg-bubble {
  background: #0f4c86;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

/* Quick Options Grid */
.mgs-options-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  animation: mgsFadeIn 0.25s ease-out;
}

.mgs-option-btn {
  background: #ffffff;
  border: 1.5px solid #cbe6f1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f4c86;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 76, 134, 0.04);
}

.mgs-option-btn:hover {
  border-color: #0f4c86;
  background: #e9f4f9;
  color: #0c3b69;
  transform: translateX(3px);
}

.mgs-option-btn.mgs-urgent {
  border-color: #46a7cd;
  background: #f0f8fc;
  color: #0c3b69;
}

.mgs-option-btn.mgs-urgent:hover {
  background: #0f4c86;
  color: #ffffff;
  border-color: #0f4c86;
}

/* Call card in chat */
.mgs-call-card {
  background: #e9f4f9;
  border: 1.5px solid #46a7cd;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  text-align: center;
}

.mgs-call-card h5 {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 700;
  color: #0c3b69;
}

.mgs-call-card p {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #3d4349;
  line-height: 1.35;
}

.mgs-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0f4c86;
  color: #ffffff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.mgs-call-btn:hover {
  background: #0c3b69;
}

/* Contact / Details Form Card */
.mgs-form-card {
  background: #ffffff;
  border: 1px solid #cbe6f1;
  border-radius: 10px;
  padding: 14px;
  margin-top: 4px;
  box-shadow: 0 2px 6px rgba(15, 76, 134, 0.06);
  animation: mgsFadeIn 0.25s ease-out;
}

.mgs-input-field {
  margin-bottom: 10px;
}

.mgs-input-field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #3d4349;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.mgs-input-field input,
.mgs-input-field select,
.mgs-input-field textarea {
  width: 100%;
  border: 1.5px solid #cbe6f1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-family: inherit;
  color: #14171a;
  background: #ffffff;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.mgs-input-field input:focus,
.mgs-input-field select:focus,
.mgs-input-field textarea:focus {
  outline: none;
  border-color: #0f4c86;
  box-shadow: 0 0 0 2px rgba(15, 76, 134, 0.15);
}

.mgs-submit-btn {
  background: #0f4c86;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 4px;
  width: 100%;
}

.mgs-submit-btn:hover {
  background: #0c3b69;
}

.mgs-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Success Card */
.mgs-success-card {
  background: #e8f8f0;
  border: 1.5px solid #00C853;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.mgs-success-icon {
  width: 38px;
  height: 38px;
  background: #00C853;
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}

.mgs-success-card h5 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: #0e6238;
}

.mgs-success-card p {
  margin: 0;
  font-size: 0.84rem;
  color: #1c4d35;
  line-height: 1.4;
}

/* Footer Note */
.mgs-chat-footer {
  padding: 8px 14px;
  background: #ffffff;
  border-top: 1px solid #cbe6f1;
  text-align: center;
  font-size: 0.74rem;
  color: #3d4349;
}

.mgs-chat-footer a {
  color: #0f4c86;
  text-decoration: none;
  font-weight: 700;
}

.mgs-chat-footer a:hover {
  text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 768px) {
  /* On mobile view, show only the circular chat icon */
  .mgs-launcher-text {
    display: none !important;
  }

  .mgs-chat-launcher {
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    min-height: 54px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 6px 20px rgba(15, 76, 134, 0.4) !important;
  }

  .mgs-launcher-icon {
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
  }

  .mgs-launcher-icon svg {
    width: 25px !important;
    height: 25px !important;
  }

  .mgs-launcher-pulse {
    top: 3px !important;
    right: 3px !important;
    width: 11px !important;
    height: 11px !important;
  }
}

@media (max-width: 700px) {
  /* Ensure launcher sits above the fixed .mobile-call-bar */
  .mgs-chat-widget {
    bottom: calc(76px + 12px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }
}

@media (max-width: 600px) {
  /* Hide the circular launcher when chat modal is open on mobile */
  .mgs-chat-widget.mgs-widget-open .mgs-chat-launcher {
    display: none !important;
  }

  /* Full screen chat experience on mobile phones */
  .mgs-chat-box {
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 10001 !important;
  }
}


