/* Magic Data — 7Moor Chat Widget Popup */

.md7m-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.md7m-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.md7m-panel {
  position: relative;
  width: 92%;
  max-width: 420px;
  border-radius: 16px;
  background: linear-gradient(160deg, #1a1225 0%, #0f0a18 100%);
  border: 1px solid rgba(160, 100, 220, 0.18);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(160, 100, 220, 0.08) inset;
  padding: 32px 28px 28px;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s ease;
}

.md7m-overlay.is-visible .md7m-panel {
  transform: translateY(0) scale(1);
}

.md7m-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.md7m-close:hover,
.md7m-close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.md7m-close:focus-visible {
  outline: 2px solid rgba(180, 120, 255, 0.6);
  outline-offset: 2px;
}

.md7m-title {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  color: #f4f1f7;
  font-family: 'Nunito Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.md7m-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.md7m-option {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(160, 100, 220, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: #f4f1f7;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  font-family: inherit;
}

.md7m-option:hover,
.md7m-option:focus-visible {
  border-color: rgba(180, 120, 255, 0.45);
  background: rgba(160, 100, 220, 0.08);
  box-shadow: 0 0 20px rgba(160, 100, 220, 0.1);
}

.md7m-option:focus-visible {
  outline: 2px solid rgba(180, 120, 255, 0.6);
  outline-offset: 2px;
}

.md7m-option:active {
  transform: scale(0.985);
}

.md7m-option-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.md7m-option-desc {
  display: block;
  font-size: 13px;
  font-weight: 300;
  color: rgba(244, 241, 247, 0.55);
  line-height: 1.4;
}

/* Desktop: position as dropdown near CTA when viewport allows */
@media (min-width: 721px) {
  .md7m-overlay {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 80px 40px 0 0;
  }

  .md7m-panel {
    max-width: 380px;
  }
}

/* Mobile: bottom-sheet style */
@media (max-width: 720px) {
  .md7m-overlay {
    align-items: flex-end;
  }

  .md7m-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 28px 22px 34px;
    transform: translateY(20px);
  }

  .md7m-overlay.is-visible .md7m-panel {
    transform: translateY(0);
  }
}

/* Loading indicator for when 7moor script is being fetched */
.md7m-option.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

.md7m-option.is-loading .md7m-option-label::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(180, 120, 255, 0.3);
  border-top-color: rgba(180, 120, 255, 0.9);
  border-radius: 50%;
  animation: md7m-spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes md7m-spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ *
 *  7Moor chat window — dark theme override
 *
 *  Actual DOM structure injected by 7Moor (from DevTools):
 *    <div class="qimo_chatpup" id="qimo_chatpup" style="...">
 *      <iframe id="chatIframe" src="...">
 *
 *  The iframe is cross-origin so we cannot touch its internals.
 *  We apply CSS filter on the iframe to invert the color scheme.
 * ------------------------------------------------------------------ */

/* 1 — Hide default floating button */
#qimo_chatpup_btn,
#qimoButtonBox,
#qimoToolBar,
#qimo_btn,
.qimo-float-btn,
.qimoToolBar,
[id*="qimo"][id*="btn"],
[id*="qimo"][id*="Btn"],
[id*="qimo"][id*="Button"],
[class*="qimo"][class*="float"],
[class*="qimo"][class*="btn"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 2 — Chat window wrapper (#qimo_chatpup) */
#qimo_chatpup,
.qimo_chatpup {
  border-radius: 14px !important;
  overflow: hidden !important;
  border: 1px solid rgba(160, 100, 240, 0.55) !important;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(160, 100, 240, 0.15) inset,
    0 0 30px rgba(120, 60, 200, 0.15) !important;
  z-index: 99990 !important;
  background: #0a0612 !important;
}

/* 3 — The iframe (#chatIframe): dark theme via CSS filter
   
   Strategy:
     invert(1)           — flip white→black, dark text→light
     hue-rotate(180deg)  — rotate greens back toward purple
     brightness(0.75)    — dark but not crushing (icons stay visible)
     contrast(1.2)       — mild boost so input borders (#f2f2f2→#0d→
                           slightly lifted) don't vanish entirely
     saturate(0.35)      — muted purple tones, no neon
   
   Prev 0.6 brightness was too aggressive — icons (originally dark,
   inverted to light, then crushed back to invisible) need ~0.75 to
   remain as visible gray. Input borders gain enough lift from the
   contrast bump combined with higher brightness.
*/
#chatIframe,
#qimo_chatpup iframe,
.qimo_chatpup iframe {
  filter: invert(1) hue-rotate(180deg) brightness(0.75) contrast(1.2) saturate(0.35) !important;
  border-radius: 13px !important;
  border: none !important;
}
