/* Interactive structure viewer window (sign-in page + home page). Needs the colour tokens from portal.css or web.css. */
.win { display: grid; grid-template-rows: auto auto 1fr; border-radius: 10px; overflow: hidden; background: #fbfcfe; box-shadow: 0 18px 40px rgba(3, 10, 30, 0.45); min-height: 0; }
.win-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #eef2f7; border-bottom: 1px solid #dfe5ee; }
.lights { display: flex; gap: 5px; }
.lights i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.win-title { font-size: 0.68rem; font-weight: 650; color: var(--ink-2); }
.win-tabs { margin-left: auto; display: flex; padding: 2px; background: #dfe5ee; border-radius: 7px; }
.win-tabs button { border: 0; background: none; font: inherit; font-size: 0.64rem; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 5px; cursor: pointer; }
.win-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(11, 27, 63, 0.12); }
.win-tools { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-bottom: 1px solid #edf1f6; }
.win-tools button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; }
.win-tools button:hover { background: #eef2f7; border-color: #dfe5ee; }
.win-tools svg.lucide { width: 13px; height: 13px; }
.tool-sep { width: 1px; height: 14px; background: #dfe5ee; margin: 0 4px; }
.tool-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.6rem; font-weight: 600; color: #0a6c6e; background: var(--teal-tint); padding: 2px 7px; border-radius: 999px; }
.tool-chip svg.lucide { width: 11px; height: 11px; }
.win-canvas { position: relative; overflow: hidden; background: radial-gradient(circle at 50% 45%, #ffffff, #eef3f8 75%); cursor: grab; min-height: 0; }
.win-canvas:active { cursor: grabbing; }
.view { position: absolute; inset: 0; display: none; place-items: center; }
.view.active { display: grid; }
.model-wrap { position: absolute; inset: 4%; transition: transform 120ms ease-out; will-change: transform; }
.model-wrap img { width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.view-motion { background: #021133; }
.view-motion video { width: 100%; height: 100%; object-fit: cover; }
.hotspot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; background: #f2a73b; cursor: help; padding: 0; box-shadow: 0 0 0 0 rgba(242, 167, 59, 0.6); animation: pulse 2.2s ease-out infinite; }
.hotspot span { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 150px; padding: 6px 8px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 0.62rem; line-height: 1.35; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
.hotspot:hover span, .hotspot:focus span { opacity: 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 167, 59, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(242, 167, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 167, 59, 0); } }
.canvas-hint { position: absolute; left: 8px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 0.58rem; color: var(--muted); background: rgba(255, 255, 255, 0.85); padding: 2px 7px; border-radius: 999px; }
.canvas-hint svg.lucide { width: 10px; height: 10px; }
.view-motion.active ~ .canvas-hint { display: none; }


/* ---------------------------------------------------------------
   Real 3D viewer (3Dmol.js)
   --------------------------------------------------------------- */
.win-canvas { position: relative; overflow: hidden; }
.mol3d { position: absolute; inset: 0; width: 100%; height: 100%; }
.mol3d canvas { display: block; }

.mol3d-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 0.82rem; color: rgba(255,255,255,0.72); text-align: center; padding: 20px; }
.spin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.28);
  border-top-color: rgba(255,255,255,0.85); animation: spin-dot 0.8s linear infinite; }
@keyframes spin-dot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin-dot { animation: none; } }

.win-tabs [data-spin].active { background: rgba(255,255,255,0.22); }
.win[data-failed] .canvas-hint { display: none; }

/* Compact card variant, used inside the learner portal */
.win-card { box-shadow: none; border: 1px solid var(--line); border-radius: 12px; height: 320px; }
.win-card .win-canvas { background: radial-gradient(circle at 50% 45%, #ffffff, #f1f5fa 78%); }
.panel-flush { padding: 0; overflow: hidden; background: none; border: 0; box-shadow: none; }
.structure-row .panel { display: flex; flex-direction: column; gap: 12px; }
.structure-note { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.structure-row .button { align-self: flex-start; margin-top: auto; }

/* Dark theme in the portal */
[data-theme="dark"] .win-card { border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .win-card .win-bar,
[data-theme="dark"] .win-card .win-tools { background: #1b2436; border-color: rgba(255,255,255,.10); }
[data-theme="dark"] .win-card .win-tabs { background: rgba(255,255,255,.10); }
[data-theme="dark"] .win-card .win-tabs button.active { background: #2c3a56; color: #fff; }
[data-theme="dark"] .win-card .win-canvas { background: radial-gradient(circle at 50% 45%, #1d2738, #141c2b 80%); }
[data-theme="dark"] .win-card .canvas-hint { background: rgba(20,28,43,.85); }
@media (max-width: 760px) { .win-card { height: 260px; } }
