/* ==========================================================================
   MOBIC HOSTING - MC ChatAi Widget Styles for WHMCS Client Area
   Scoped under #mc-chatai-root so it never conflicts with Lagom2 / Bootstrap
   ========================================================================== */

#mc-chatai-root,
#mc-chatai-root * {
  box-sizing: border-box;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

#mc-chatai-root .mc-fab-wrap {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9990;
  direction: rtl;
}

#mc-chatai-root .mc-fab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 9999px;
  background-color: #092346;
  color: #ffffff;
  padding: 8px 8px 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(9, 35, 70, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

#mc-chatai-root .mc-fab-btn:hover {
  background-color: #0d2f5e;
  box-shadow: 0 14px 36px rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}

#mc-chatai-root .mc-fab-icon {
  position: relative;
  display: flex;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background-color: #3B82F6;
  color: #ffffff;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#mc-chatai-root .mc-fab-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #34d399;
  border: 2px solid #092346;
}

#mc-chatai-root .mc-fab-text {
  text-align: right;
  padding-right: 2px;
}

#mc-chatai-root .mc-fab-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #ffffff;
  line-height: 1.25;
  display: block;
}

#mc-chatai-root .mc-fab-sub {
  font-size: 10.5px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  display: block;
}

/* Modal Backdrop & Window */
#mc-chatai-root .mc-backdrop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9995;
  direction: rtl;
  display: flex;
  flex-direction: column;
}

#mc-chatai-root .mc-window {
  width: 400px;
  height: 600px;
  max-height: 82vh;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 60px rgba(9, 35, 70, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, height 0.2s ease;
}

#mc-chatai-root .mc-window.mc-expanded {
  width: 640px;
  height: 720px;
  max-height: 86vh;
}

/* Header */
#mc-chatai-root .mc-header {
  background-color: #092346;
  color: #ffffff;
  padding: 12px 16px;
  flex-shrink: 0;
}

#mc-chatai-root .mc-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#mc-chatai-root .mc-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#mc-chatai-root .mc-header-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background-color: #3B82F6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#mc-chatai-root .mc-header-avatar-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #34d399;
  border: 2px solid #092346;
}

#mc-chatai-root .mc-header-info {
  min-width: 0;
  text-align: right;
}

#mc-chatai-root .mc-header-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#mc-chatai-root .mc-header-name {
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
}

#mc-chatai-root .mc-header-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.12);
  color: #bae6fd;
}

#mc-chatai-root .mc-header-desc {
  font-size: 11px;
  color: #cbd5e1;
  margin: 2px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mc-chatai-root .mc-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#mc-chatai-root .mc-icon-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 6px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-icon-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.12);
}

/* Tabs */
#mc-chatai-root .mc-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 12px;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 9999px;
}

#mc-chatai-root .mc-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-tab-btn:hover {
  color: #ffffff;
}

#mc-chatai-root .mc-tab-btn.mc-active {
  background-color: #3B82F6;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Body Containers */
#mc-chatai-root .mc-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background-color: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chat Messages */
#mc-chatai-root .mc-msg-row {
  display: flex;
  flex-direction: column;
}

#mc-chatai-root .mc-msg-row.mc-user {
  align-items: flex-start;
}

#mc-chatai-root .mc-msg-row.mc-assistant {
  align-items: flex-end;
}

#mc-chatai-root .mc-bubble {
  max-width: 92%;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.75;
  text-align: right;
}

#mc-chatai-root .mc-msg-row.mc-user .mc-bubble {
  background-color: #092346;
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(9, 35, 70, 0.12);
}

#mc-chatai-root .mc-msg-row.mc-assistant .mc-bubble {
  background-color: #ffffff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(9, 35, 70, 0.04);
}

#mc-chatai-root .mc-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

#mc-chatai-root .mc-bubble-bot {
  font-weight: 700;
  font-size: 11.5px;
  color: #092346;
  display: flex;
  align-items: center;
  gap: 6px;
}

#mc-chatai-root .mc-bubble-bot-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #3B82F6;
  display: inline-block;
}

#mc-chatai-root .mc-copy-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}

#mc-chatai-root .mc-copy-btn:hover {
  color: #092346;
}

/* Formatted Markdown inside Assistant Bubble */
#mc-chatai-root .mc-md p {
  margin: 2px 0;
}

#mc-chatai-root .mc-md strong {
  font-weight: 700;
  color: #092346;
}

#mc-chatai-root .mc-md code {
  direction: ltr;
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 6px;
  background-color: rgba(9, 35, 70, 0.06);
  color: #092346;
  font-family: Consolas, monospace;
  font-size: 11.5px;
  border: 1px solid rgba(9, 35, 70, 0.1);
}

#mc-chatai-root .mc-md-h4 {
  font-weight: 700;
  color: #092346;
  font-size: 13px;
  margin: 10px 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

#mc-chatai-root .mc-md-h4-bar {
  width: 6px;
  height: 14px;
  border-radius: 9999px;
  background-color: #3B82F6;
  flex-shrink: 0;
}

#mc-chatai-root .mc-md-bullet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
}

#mc-chatai-root .mc-md-bullet-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: #3B82F6;
  margin-top: 8px;
  flex-shrink: 0;
}

#mc-chatai-root .mc-md-num {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background-color: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
  font-weight: 700;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Sources & Nav Action Chips inside Bubble */
#mc-chatai-root .mc-sources-box {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

#mc-chatai-root .mc-sources-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}

#mc-chatai-root .mc-source-btn {
  width: 100%;
  text-align: right;
  border-radius: 12px;
  background-color: #F8FAFC;
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-source-btn:hover {
  background-color: #eff6ff;
  border-color: rgba(59, 130, 246, 0.45);
}

#mc-chatai-root .mc-source-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #092346;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mc-chatai-root .mc-source-pill {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  background-color: #3B82F6;
  padding: 2px 10px;
  border-radius: 9999px;
  flex-shrink: 0;
}

#mc-chatai-root .mc-nav-chips {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#mc-chatai-root .mc-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  background-color: rgba(9, 35, 70, 0.06);
  color: #092346;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-nav-chip:hover {
  background-color: #092346;
  color: #ffffff;
}

#mc-chatai-root .mc-nav-chip.mc-nav-chip-wa {
  background-color: #059669;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

#mc-chatai-root .mc-nav-chip.mc-nav-chip-wa:hover {
  background-color: #047857;
  color: #ffffff;
}

#mc-chatai-root .mc-wa-inline {
  direction: ltr;
  display: inline-block;
  padding: 1px 8px;
  margin: 0 3px;
  border-radius: 9999px;
  background-color: #ecfdf5;
  color: #047857;
  font-family: Consolas, monospace;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid #a7f3d0;
  text-decoration: none;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-wa-inline:hover {
  background-color: #d1fae5;
  color: #065f46;
  text-decoration: none;
}

/* Quick Prompts Bar */
#mc-chatai-root .mc-prompts-bar {
  padding: 8px 12px;
  background-color: #ffffff;
  border-top: 1px solid #f1f5f9;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

#mc-chatai-root .mc-prompts-bar::-webkit-scrollbar {
  display: none;
}

#mc-chatai-root .mc-prompts-track {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
}

#mc-chatai-root .mc-prompt-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  background-color: #F8FAFC;
  color: #092346;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-prompt-chip:hover {
  background-color: #3B82F6;
  color: #ffffff;
  border-color: #3B82F6;
}

/* Input Form */
#mc-chatai-root .mc-input-wrap {
  padding: 10px;
  background-color: #ffffff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

#mc-chatai-root .mc-input-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #F8FAFC;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 4px 6px 4px 6px;
}

#mc-chatai-root .mc-input-form:focus-within {
  background-color: #ffffff;
  border-color: #3B82F6;
}

#mc-chatai-root .mc-input-field {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  color: #092346;
  outline: none;
  text-align: right;
}

#mc-chatai-root .mc-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #3B82F6;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-send-btn:hover:not(:disabled) {
  background-color: #2563EB;
}

#mc-chatai-root .mc-send-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* KB Tab & Cards */
#mc-chatai-root .mc-kb-filter-box {
  background: #ffffff;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

#mc-chatai-root .mc-kb-search {
  display: flex;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 6px 12px;
  margin-bottom: 8px;
}

#mc-chatai-root .mc-kb-search input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 12px;
  color: #092346;
  outline: none;
}

#mc-chatai-root .mc-kb-pills {
  display: flex;
  gap: 6px;
}

#mc-chatai-root .mc-kb-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
}

#mc-chatai-root .mc-kb-pill.mc-active {
  background: #092346;
  color: #ffffff;
}

#mc-chatai-root .mc-card-item {
  cursor: pointer;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-card-item:hover {
  border-color: #3B82F6;
}

#mc-chatai-root .mc-card-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(9, 35, 70, 0.06);
  color: #092346;
  margin-bottom: 4px;
}

#mc-chatai-root .mc-card-title {
  font-weight: 700;
  font-size: 12.5px;
  color: #092346;
  margin: 0;
}

#mc-chatai-root .mc-card-excerpt {
  font-size: 11px;
  color: #64748b;
  margin: 3px 0 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Nav & Servers Tab */
#mc-chatai-root .mc-section-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px;
}

#mc-chatai-root .mc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#mc-chatai-root .mc-section-title {
  font-weight: 700;
  font-size: 12.5px;
  color: #092346;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

#mc-chatai-root .mc-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

#mc-chatai-root .mc-srv-item {
  cursor: pointer;
  background: #F8FAFC;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-decoration: none;
}

#mc-chatai-root .mc-srv-item:hover {
  background: #ffffff;
  border-color: #3B82F6;
}

#mc-chatai-root .mc-srv-name {
  font-weight: 700;
  font-size: 11.5px;
  color: #092346;
  direction: ltr;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mc-chatai-root .mc-srv-ms {
  font-size: 10px;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  padding: 2px 6px;
  border-radius: 9999px;
  direction: ltr;
}

#mc-chatai-root .mc-nav-grid-btn {
  text-align: right;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #F8FAFC;
  color: #092346;
  font-weight: 700;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

#mc-chatai-root .mc-nav-grid-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.45);
  color: #092346;
  text-decoration: none;
}

/* Article Reader View */
#mc-chatai-root .mc-article-box {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 14px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.8;
}

#mc-chatai-root .mc-article-box h2,
#mc-chatai-root .mc-article-box h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: #092346;
  margin-top: 12px;
  margin-bottom: 6px;
}

@media (max-width: 639px) {
  #mc-chatai-root .mc-backdrop {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 35, 70, 0.45);
    justify-content: flex-end;
  }
  #mc-chatai-root .mc-window,
  #mc-chatai-root .mc-window.mc-expanded {
    width: 100%;
    height: 88dvh;
    max-height: 88dvh;
    border-radius: 24px 24px 0 0;
  }
}
