/* WRSD frame around an embedded ibl.ai modal. The frame is WRSD; the contents
   keep ibl.ai's own styling (see docs/IBLAI-MIGRATION.md §4.8). */

.ibl-modal-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
}
.ibl-modal-root[hidden] { display: none; }

.ibl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 4, 7, 0.72);
  backdrop-filter: blur(2px);
}

.ibl-modal-panel {
  position: relative;
  width: min(1280px, 94vw);
  height: min(860px, 94vh);
  display: flex;
  flex-direction: column;
  background: var(--surface, #240d13);
  border: 1px solid var(--border, #3d1a22);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.ibl-modal-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #3d1a22);
  background: var(--surface, #240d13);
}

.ibl-modal-title {
  font-family: var(--font-head, Georgia, serif);
  font-size: 1rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text, #f5ede8);
}

.ibl-modal-close {
  background: none;
  border: 1px solid var(--border, #3d1a22);
  border-radius: 8px;
  color: var(--muted, #9e8070);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 6px 10px;
  transition: border-color 0.15s, color 0.15s;
}
.ibl-modal-close:hover {
  border-color: var(--accent, #c9a227);
  color: var(--accent, #c9a227);
}

.ibl-modal-body {
  position: relative;
  flex: 1;
  min-height: 0;
  /* WRSD, never white: the embed is recoloured to this same surface, so the
     frame must never show a light panel underneath it while it loads. */
  background: var(--surface, #240d13);
}
.ibl-modal-body mentor-ai { display: block; width: 100%; height: 100%; }

.ibl-modal-loading {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #9e8070);
  font-size: 0.9rem;
  background: var(--surface, #240d13);
}

/* ── The veil over an embed that is still painting ──────────────────────
   Everything ibl.ai does between "iframe attached" and "WRSD theme applied"
   happens behind this: the white shell, its spinners, the snap to maroon.
   Mounted by widget.js; removed when the frame is revealed. */
.ibl-embed-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #240d13);
  opacity: 1;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.ibl-embed-veil.is-done { opacity: 0; }
.ibl-embed-veil-inner { width: 210px; text-align: center; }
.ibl-embed-veil-bar {
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.ibl-embed-veil-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, #c9a227), transparent);
  animation: ibl-veil-sweep 1.5s ease-in-out infinite;
}
@keyframes ibl-veil-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
.ibl-embed-veil-label {
  margin-top: 12px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #9e8070);
}
@media (prefers-reduced-motion: reduce) {
  .ibl-embed-veil-bar span { animation: none; width: 100%; opacity: 0.5; }
}

/* Rows in Admin → AI Behavior */
.ibl-setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: none;
  color: var(--text, #f5ede8);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.ibl-setting-row:last-child { border-bottom: none; }
.ibl-setting-row:hover { background: rgba(201, 162, 39, 0.05); }
.ibl-setting-row .name { font-size: 0.9rem; font-weight: 600; flex-shrink: 0; min-width: 150px; }
.ibl-setting-row .desc { font-size: 0.8rem; color: var(--muted, #9e8070); flex: 1; }
.ibl-setting-row .go { color: var(--muted, #9e8070); flex-shrink: 0; }
.ibl-setting-row:hover .go { color: var(--accent, #c9a227); }

/* Clickable brand + profile blocks that open a modal */
.ibl-clickable { cursor: pointer; border-radius: 10px; transition: background 0.12s; }
.ibl-clickable:hover { background: rgba(201, 162, 39, 0.07); }

/* Native WRSD profile card (no ibl.ai equivalent to embed) */
.ibl-modal-body.ibl-modal-native { background: var(--surface, #240d13); overflow-y: auto; }
.ibl-profile { max-width: 620px; margin: 0 auto; padding: 32px 28px; }
.ibl-profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.ibl-profile-avatar {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border, #3d1a22);
}
.ibl-profile-initials {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--maroon, #6b1228), var(--accent, #c9a227));
  color: var(--bg, #1a0a0e); font-family: var(--font-head, Georgia, serif);
  font-size: 1.5rem; font-weight: 600;
}
.ibl-profile-name { font-family: var(--font-head, Georgia, serif); font-size: 1.35rem; font-weight: 600; color: var(--text, #f5ede8); }
.ibl-profile-title { font-size: 0.85rem; color: var(--accent, #c9a227); margin-top: 2px; }
.ibl-profile-email { font-family: var(--font-mono, monospace); font-size: 0.78rem; color: var(--muted, #9e8070); margin-top: 4px; }
.ibl-profile-about { font-size: 0.86rem; line-height: 1.7; color: var(--muted, #9e8070); margin: 0 0 22px; white-space: pre-line; }
.ibl-profile-rows { border-top: 1px solid var(--border, #3d1a22); }
.ibl-profile-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem;
}
.ibl-profile-row span { color: var(--muted, #9e8070); }
.ibl-profile-row b { color: var(--text, #f5ede8); font-weight: 600; font-family: var(--font-mono, monospace); font-size: 0.8rem; }
.ibl-profile-actions { margin-top: 24px; display: flex; justify-content: flex-end; }
.ibl-profile-signout {
  padding: 9px 20px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border, #3d1a22); background: none;
  color: var(--muted, #9e8070); font-family: inherit; font-size: 0.85rem;
  transition: border-color 0.15s, color 0.15s;
}
.ibl-profile-signout:hover { border-color: #f85149; color: #f85149; }

/* Vendored ibl.ai SDK Account component (React, mounted in-place) */
.ibl-modal-body.ibl-modal-sdk { background: var(--surface, #240d13); overflow: auto; }
.ibl-modal-body.ibl-modal-sdk > div { height: 100%; }
.ibl-sdk-host { display: block; height: 100%; }
