/* ==========================================================================
   GDWP MMO System: Full-screen Modal Popup Overlay & Gate
   Matches nhalavn style, 100% immune to Canvas DOM Purging
   ========================================================================== */

/* ── Prevent Body Scrolling when MMO Modal is Active ── */
body.gdwp-mmo-locked-scroll,
body.td-mmo-locked-scroll {
  overflow: hidden !important;
  touch-action: none !important;
}

/* ── Modal Popup Overlay Container (Centered on Screen) ── */
.gdwp-mmo-modal-overlay,
.td-mmo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  animation: gdwpMmoFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gdwpMmoFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gdwpMmoZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Main Shopee-Style Modal Card ── */
.gdwp-mmo-modal-card,
.td-mmo-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(92vh, 600px);
  margin: auto;
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.08);
  animation: gdwpMmoZoomIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar: Title & Short URL ── */
.gdwp-mmo-modal-top,
.td-mmo-modal-top {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
  color: #475569;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
}

.gdwp-mmo-modal-top-title,
.td-mmo-modal-top-title {
  font-weight: 700;
  color: #0f172a;
  white-space: normal;
  word-break: break-word;
  display: block;
  text-align: center;
  width: 100%;
  line-height: 1.35;
}

.gdwp-mmo-modal-top-link,
.td-mmo-modal-top-link {
  color: #0284c7;
  text-decoration: underline;
  word-break: break-all;
  font-family: inherit;
  transition: color 0.15s ease;
  text-align: center;
  display: inline-block;
  max-width: 100%;
}

.gdwp-mmo-modal-top-link:hover,
.td-mmo-modal-top-link:hover {
  color: #0369a1;
}

/* ── Main Product Image (Constrained height so modal never overflows screen) ── */
.gdwp-mmo-modal-media,
.td-mmo-modal-media {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: clamp(160px, 28vh, 230px);
  max-height: 240px;
  background: #f8fafc;
  overflow: hidden;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
}

.gdwp-mmo-modal-img,
.td-mmo-modal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background-color: #f8fafc;
  transition: transform 0.35s ease;
}

.gdwp-mmo-modal-media:hover .gdwp-mmo-modal-img,
.td-mmo-modal-media:hover .td-mmo-modal-img {
  transform: scale(1.03);
}

.gdwp-mmo-modal-img-placeholder,
.td-mmo-modal-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 38px;
  background: #f8fafc;
}

.gdwp-mmo-modal-img-placeholder span,
.td-mmo-modal-img-placeholder span {
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
}

/* ── Bottom Section: Full Info + High-Conversion CTA Button ── */
.gdwp-mmo-modal-bottom,
.td-mmo-modal-bottom {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  background: #ffffff;
  flex-shrink: 0;
}

.gdwp-mmo-modal-info,
.td-mmo-modal-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.gdwp-mmo-modal-title,
.td-mmo-modal-title {
  display: block;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 6px;
  text-decoration: none;
  word-break: break-word;
  transition: color 0.15s ease;
  width: 100%;
}

.gdwp-mmo-modal-title:hover,
.td-mmo-modal-title:hover {
  color: #ee4d2d;
}

.gdwp-mmo-modal-shop,
.td-mmo-modal-shop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  text-align: center;
  width: 100%;
}

.gdwp-mmo-shop-name,
.td-mmo-shop-name {
  text-align: center;
  display: inline;
}

.gdwp-mmo-shop-icon,
.td-mmo-shop-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.gdwp-mmo-modal-action,
.td-mmo-modal-action {
  width: 100%;
  display: flex;
  justify-content: center;
}

.gdwp-mmo-btn-cta,
.td-mmo-btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 46px;
  padding: 0 20px;
  background: linear-gradient(135deg, #ee4d2d 0%, #ff5722 100%);
  color: #ffffff !important;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(238, 77, 45, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  cursor: pointer;
}

.gdwp-mmo-btn-cta:hover,
.td-mmo-btn-cta:hover {
  background: linear-gradient(135deg, #d83e21 0%, #f4511e 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(238, 77, 45, 0.45);
}

.gdwp-mmo-btn-cta:active,
.td-mmo-btn-cta:active {
  transform: translateY(0.5px);
  box-shadow: 0 2px 8px rgba(238, 77, 45, 0.3);
}

/* ── Dark Mode Overrides for Modal ── */
.dark-mode .gdwp-mmo-modal-card,
[data-bs-theme="dark"] .gdwp-mmo-modal-card,
.dark-mode .td-mmo-modal-card,
[data-bs-theme="dark"] .td-mmo-modal-card {
  background: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.dark-mode .gdwp-mmo-modal-top,
[data-bs-theme="dark"] .gdwp-mmo-modal-top,
.dark-mode .td-mmo-modal-top,
[data-bs-theme="dark"] .td-mmo-modal-top {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.dark-mode .gdwp-mmo-modal-top-title,
[data-bs-theme="dark"] .gdwp-mmo-modal-top-title,
.dark-mode .td-mmo-modal-top-title,
[data-bs-theme="dark"] .td-mmo-modal-top-title {
  color: #f8fafc;
}

.dark-mode .gdwp-mmo-modal-top-link,
[data-bs-theme="dark"] .gdwp-mmo-modal-top-link,
.dark-mode .td-mmo-modal-top-link,
[data-bs-theme="dark"] .td-mmo-modal-top-link {
  color: #38bdf8;
}

.dark-mode .gdwp-mmo-modal-media,
[data-bs-theme="dark"] .gdwp-mmo-modal-media,
.dark-mode .td-mmo-modal-media,
[data-bs-theme="dark"] .td-mmo-modal-media,
.dark-mode .gdwp-mmo-modal-img,
[data-bs-theme="dark"] .gdwp-mmo-modal-img,
.dark-mode .td-mmo-modal-img,
[data-bs-theme="dark"] .td-mmo-modal-img,
.dark-mode .gdwp-mmo-modal-img-placeholder,
[data-bs-theme="dark"] .gdwp-mmo-modal-img-placeholder,
.dark-mode .td-mmo-modal-img-placeholder,
[data-bs-theme="dark"] .td-mmo-modal-img-placeholder {
  background-color: #0f172a;
}

.dark-mode .gdwp-mmo-modal-bottom,
[data-bs-theme="dark"] .gdwp-mmo-modal-bottom,
.dark-mode .td-mmo-modal-bottom,
[data-bs-theme="dark"] .td-mmo-modal-bottom {
  background: #1e293b;
}

.dark-mode .gdwp-mmo-modal-title,
[data-bs-theme="dark"] .gdwp-mmo-modal-title,
.dark-mode .td-mmo-modal-title,
[data-bs-theme="dark"] .td-mmo-modal-title {
  color: #f1f5f9;
}

.dark-mode .gdwp-mmo-modal-shop,
[data-bs-theme="dark"] .gdwp-mmo-modal-shop,
.dark-mode .td-mmo-modal-shop,
[data-bs-theme="dark"] .td-mmo-modal-shop {
  color: #94a3b8;
}

/* ── Backward Compatibility for Legacy Inline Gate ── */
.gdwp-mmo-gate {
  --cg-border: #e5e7eb;
  --cg-bg: #ffffff;
  --cg-card: #f8fafc;
  --cg-text: #0f172a;
  --cg-muted: #64748b;
  --cg-brand: #ee4d2d;
  --cg-brand-dark: #d83e21;
  --cg-radius: 14px;
  --cg-shadow: 0 8px 24px rgba(2,8,23,.06);
  background: var(--cg-card);
  border: 1px solid var(--cg-border);
  border-radius: var(--cg-radius);
  padding: 20px;
  margin: 24px auto;
  box-shadow: var(--cg-shadow);
  color: var(--cg-text);
}
.gdwp-mmo-gate .row {text-align: center;}
.gdwp-mmo-gate .row h2 {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin-bottom: 5px;
}
.gdwp-mmo-gate .row h3 {
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.25;
  font-weight: 700;
  margin: 0;
  text-align: center;
}
.gdwp-mmo-gate .row p {
  font-size: 14px;
  color: var(--cg-muted);
  margin: 0;
  text-align: center;
}
.gdwp-mmo-gate .row .media {
  padding: 20px;
  margin: 10px;
}
.gdwp-mmo-btn {
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--cg-brand);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700;
  letter-spacing: .2px;
  transition: background .15s ease, transform .1s ease;
  box-shadow: 0 2px 0 rgba(0,0,0,.06) inset;
}
.gdwp-mmo-btn:hover{ background: var(--cg-brand-dark); }
.gdwp-mmo-btn:active{ transform: translateY(1px); }
