/*
 * McLightning Support - Embedded Portal UI
 * Stays inside page content area (no fullscreen takeover).
 */

.mcls-viewport{
  /* IMPORTANT: stay inside the page content area (shortcode body). */
  position: relative;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  z-index: 1;
}


.mcls-embed {
  --mcls-radius: 24px;
  --mcls-card: rgba(8, 10, 16, 0.78);
  --mcls-text: #ffffff;
  --mcls-muted: rgba(255,255,255,0.78);
  --mcls-accent: #0ea5e9;
  --mcls-accent2: #22c55e;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  border-radius: var(--mcls-radius);
  overflow: hidden;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  /*
   * Keep the embedded portal centered on-screen regardless of viewport size.
   * The inner wrapper flex-centers content; this ensures the container has
   * enough height to center within the viewport (even on tall/short screens).
   */
  /* Full-viewport centering (svh handles mobile browser UI better) */
  /* The viewport wrapper provides the full-height centering */
  min-height: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}

/* Some themes/page builders inject aggressive typography. Keep portal text readable. */
.mcls-embed,
.mcls-embed h1,
.mcls-embed h2,
.mcls-embed h3,
.mcls-embed h4,
.mcls-embed h5,
.mcls-embed p,
.mcls-embed label,
.mcls-embed span,
.mcls-embed small,
.mcls-embed a {
  color: var(--mcls-text) !important;
}

/* Ensure form controls remain readable even if the theme forces white backgrounds */
.mcls-embed input,
.mcls-embed textarea,
.mcls-embed select {
  background: rgba(0,0,0,0.35) !important;
  color: var(--mcls-text) !important;
  border-color: rgba(255,255,255,0.18) !important;
}

/* Background is confined to the embed container */
.mcls-embed::before {
  pointer-events: none;
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--mcls-bg);
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  filter: saturate(1.05) contrast(1.05);
  z-index: 0;
}

/* Soft overlay to keep text readable */
.mcls-embed::after {
  pointer-events: none;
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.10), rgba(0,0,0,0.50));
  z-index: 0;
}

.mcls-embed-inner {
  position: relative;
  z-index: 1;
  padding: clamp(18px, 3.5vw, 38px) clamp(14px, 2.5vw, 24px);
  /* Match container height so the card stays centered */
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Improve fit on very small screens */
@media (max-width: 480px) {
  .mcls-card { padding: 18px; }
  .mcls-title { font-size: 26px; }
  .mcls-brand img { max-width: 200px; }
}

.mcls-card {
  width: 100%;
  max-width: 980px;
  background: var(--mcls-card) !important;
  color: var(--mcls-text) !important;
  border-radius: 18px;
  padding: 28px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.10);
}

.mcls-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 18px;
  text-align: center;
}

.mcls-brand img {
  max-width: 230px;
  width: 100%;
  height: auto;
}

.mcls-title {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
  color: var(--mcls-text) !important;
}

.mcls-subtitle {
  margin: 0;
  color: var(--mcls-muted);
}

.mcls-view { display: none; }
.mcls-view.is-active { display: block; }

.mcls-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 0;
  color: var(--mcls-muted);
}

.mcls-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.95);
  animation: mclsSpin 0.9s linear infinite;
}

@keyframes mclsSpin { to { transform: rotate(360deg); } }

.mcls-portals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 10px;
}

.mcls-portal-card {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 16px;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mcls-portal-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.09);
}

.mcls-portal-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mcls-portal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255,255,255,0.10);
}

.mcls-portal-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.mcls-portal-desc {
  margin: 10px 0 0;
  color: var(--mcls-muted);
  font-size: 13px;
  line-height: 1.4;
}

.mcls-portal-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.mcls-portal-actions .mcls-btn {
  flex: 1;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
}

.mcls-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: rgba(255,255,255,0.55);
}

.mcls-divider::before,
.mcls-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.18);
}

.mcls-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  background: var(--mcls-accent);
    color: #fff;
}

/* Force readable text colors even if theme applies global styles */
.mcls-embed h1,
.mcls-embed h2,
.mcls-embed h3,
.mcls-embed h4,
.mcls-embed p,
.mcls-embed label,
.mcls-embed a,
.mcls-embed span,
.mcls-embed small {
    color: #fff !important;
}

.mcls-btn:hover { filter: brightness(1.03); }

.mcls-btn-secondary {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.20);
}

.mcls-link {
  background: none;
  border: none;
  padding: 0;
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
}

.mcls-view-header {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.mcls-view-header h2 {
  margin: 0;
  font-size: 22px;
}

.mcls-muted { color: var(--mcls-muted); }

.mcls-tabs {
  display: flex;
  gap: 10px;
  margin: 12px 0 16px;
}

.mcls-tab {
  flex: 1;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.07);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.mcls-tab.is-active {
  background: rgba(14,165,233,0.35);
  border-color: rgba(14,165,233,0.55);
}

.mcls-panel { display: none; }
.mcls-panel.is-active { display: block; }

.mcls-form { display: grid; gap: 12px; }

.mcls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mcls-field label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}

.mcls-field input,
.mcls-field textarea,
.mcls-field select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  padding: 12px 12px;
  outline: none;
}

.mcls-field textarea { resize: vertical; }

.mcls-field input:focus,
.mcls-field textarea:focus,
.mcls-field select:focus {
  border-color: rgba(14,165,233,0.75);
}

.mcls-result {
  font-weight: 700;
  font-size: 13px;
}

.mcls-result.is-error { color: #fecaca; }
.mcls-result.is-ok { color: #bbf7d0; }

@media (max-width: 720px) {
  .mcls-embed-inner { min-height: 100%; padding: 22px 14px; }
  .mcls-card { padding: 18px; }
  .mcls-title { font-size: 26px; }
  .mcls-grid { grid-template-columns: 1fr; }
}


/* Ensure clickable content sits above background layers */
.mcls-embed .mcls-card{ position: relative; z-index: 2; }
.mcls-embed a, .mcls-embed button{ position: relative; z-index: 3; }


/* Keep Chrome/Safari autofill readable */
.mcls-embed input:-webkit-autofill,
.mcls-embed textarea:-webkit-autofill,
.mcls-embed select:-webkit-autofill {
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
  box-shadow: 0 0 0px 1000px rgba(0,0,0,0.35) inset !important;
  transition: background-color 9999s ease-in-out 0s;
}
