/* ============================================================
   EduMarkets Platform — Shell Styles
   Handles module mounting, loading states, and platform nav.
   ============================================================ */

/* ── Module mount container ── */
#module-mount {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Boot overlay — visible immediately, covers full page until app is ready ── */
#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.45s ease;
}

#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

[data-theme="light"] #boot-overlay {
  background: var(--bg);
}


[data-theme="light"] .boot-spinner {
  border-color: rgba(0,0,0,0.06);
  border-top-color: rgba(52,211,153,0.7);
}

[data-theme="light"] .boot-progress {
  background: rgba(0,0,0,0.06);
}

#boot-logo {
  display: inline-flex;
  opacity: 0.95;
}
#boot-logo .lockup-led .name {
  font-weight: 700;
  text-transform: none;
  line-height: 1.15;
  /* Two-value edge form: current Edge does not parse "trim-start cap". */
  text-box: trim-start cap alphabetic;
}

.boot-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255,255,255,0.06);
  border-top-color: rgba(52,211,153,0.55);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.boot-progress {
  width: 200px;
  height: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.boot-progress-bar {
  height: 100%;
  width: 0%;
  background: rgba(52,211,153,0.4);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ── Module transition overlay (full-screen, covers header + content) ── */
.module-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-sidebar);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: all;
}
.module-transition-overlay[hidden] { display: none; }
.module-transition-overlay.hiding {
  opacity: 0;
  pointer-events: none;
}

.module-transition-logo {
  display: inline-flex;
}
.module-transition-logo .lockup-led .name {
  font-weight: 700;
  text-transform: none;
  line-height: 1.15;
  /* Two-value edge form: current Edge does not parse "trim-start cap". */
  text-box: trim-start cap alphabetic;
}

.module-transition-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Loading state while module JS loads ── */
.platform-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  color: var(--text-muted);
}

.platform-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.platform-loading-label {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ── No-module state (shown on load before first module) ── */
.platform-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  padding: 40px 24px;
}

.platform-welcome h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.platform-welcome p {
  color: var(--text-muted);
  max-width: 480px;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── Module switcher list in user-menu ── */
.user-menu-loading {
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Active module highlight in switcher */
.user-menu-item.module-active {
  color: var(--color-accent-text);
  font-weight: 600;
}

.user-menu-item.module-active::before {
  content: '▸ ';
  font-size: 0.7em;
}

/* Disabled module (not yet enabled by trainer) */
.user-menu-item.module-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* ── Shared Modal Dialog (used across all modules) ────────────────────── */

.iro-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-max);
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(var(--blur-sm));
}

.iro-dialog {
  background: var(--bg-surface, #151518);
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  width: min(960px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.iro-dialog.iro-dialog-wide {
  width: min(1100px, 94vw);
}

.iro-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}

.iro-dialog-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.iro-dialog-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.iro-dialog-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.iro-dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Shared confirmation modal (confirmDialog in shared/dialog.js): one element for
   the whole platform. Confirm (primary) button on the LEFT, cancel on the RIGHT. */
.iro-dialog.iro-dialog-confirm { width: min(420px, 90vw); }
.confirm-dialog-message {
  margin: 0 0 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.confirm-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

[data-theme="light"] .iro-dialog-close { color: rgba(0,0,0,0.5); }
[data-theme="light"] .iro-dialog-close:hover { color: #000; background: rgba(0,0,0,0.08); }
