/* Laboratorio Virtuale — stile editoriale allineato a home / web-simulator */

.vlab-page {
  --vlab-amber: #f59e0b;
  --vlab-accent: #00ff9c;
  --vlab-learn: #7dd3fc;
  --vlab-serif: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --vlab-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --vlab-card-bg: rgba(9, 14, 24, 0.72);
  --vlab-border: rgba(255, 255, 255, 0.1);
}

.vlab-page main {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2rem) clamp(3rem, 6vw, 4rem);
}

.vlab-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.vlab-backdrop-mesh {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(ellipse 45% 40% at 15% 20%, rgba(167, 139, 250, 0.08), transparent 55%),
    radial-gradient(ellipse 40% 35% at 85% 60%, rgba(245, 158, 11, 0.07), transparent 50%),
    radial-gradient(ellipse 35% 30% at 50% 90%, rgba(0, 255, 156, 0.05), transparent 45%);
}

@keyframes vlabFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.vlab-section-kicker {
  margin: 0 0 0.45rem;
  font-family: var(--vlab-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vlab-amber);
}

.vlab-section-head {
  margin-bottom: 1.25rem;
}

.vlab-section-head h2 {
  margin: 0;
  font-family: var(--vlab-serif);
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  font-weight: 400;
  color: #f8fafc;
}

.vlab-hero {
  padding: 0 0 clamp(2rem, 4vw, 2.75rem);
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  animation: vlabFadeUp 0.65s ease-out both;
}

.vlab-hero h1 {
  margin: 0;
  font-family: var(--vlab-serif);
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  font-weight: 400;
  color: #f8fafc;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Catalogo VM */
.vlab-catalog {
  animation: vlabFadeUp 0.7s ease-out 0.06s both;
}

.vlab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.vlab-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.25rem 1.35rem;
  border-radius: 12px;
  border: 1px solid var(--vlab-border);
  background: var(--vlab-card-bg);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, transform 0.2s;
}

.vlab-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-2px);
}

.vlab-card__icon {
  font-size: 1.25rem;
  color: var(--vlab-learn);
  line-height: 1;
}

.vlab-card__name {
  margin: 0;
  font-family: var(--vlab-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vlab-amber);
}

.vlab-card h3 {
  margin: 0;
  font-family: var(--vlab-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: #f1f5f9;
}

.vlab-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.vlab-tag {
  font-family: var(--vlab-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.vlab-tag--ip {
  border-color: rgba(0, 255, 156, 0.25);
  color: #6ee7b7;
}

.vlab-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #94a3b8;
  flex: 1;
}

.vlab-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.vlab-card__btn--study {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.1);
  color: var(--vlab-learn);
}

.vlab-card__btn--study:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.55);
}

.vlab-card__btn--start {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

.vlab-study-btn {
  width: 100%;
  margin-top: 0.35rem;
  font-family: var(--vlab-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.08);
  color: var(--vlab-learn);
  cursor: pointer;
}

.vlab-study-btn:hover {
  background: rgba(167, 139, 250, 0.15);
}

/* Modal Studia */
.vlab-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.vlab-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.vlab-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.78);
  backdrop-filter: blur(6px);
}

.vlab-modal__panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(85vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 14, 24, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: vlabFadeUp 0.35s ease-out both;
}

.vlab-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem 0.85rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.vlab-modal__head h2 {
  margin: 0;
  font-family: var(--vlab-serif);
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  font-weight: 400;
  color: #f8fafc;
}

.vlab-modal__intro {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #94a3b8;
}

.vlab-modal__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.vlab-modal__close:hover {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.3);
}

.vlab-modal__body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  padding: 1rem 1.35rem 1.25rem;
}

.vlab-modal__intro,
.vlab-study-step p {
  overflow-wrap: break-word;
  word-break: break-word;
}

.vlab-study-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vlab-study-step {
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.vlab-study-step__n {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-family: var(--vlab-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--vlab-amber);
}

.vlab-study-step h4 {
  margin: 0 0 0.45rem;
  font-family: var(--vlab-serif);
  font-size: 1rem;
  font-weight: 400;
  color: #e2e8f0;
}

.vlab-study-step p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #94a3b8;
}

.vlab-study-step code {
  display: block;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 255, 156, 0.15);
  font-family: var(--vlab-mono);
  font-size: 0.72rem;
  color: #6ee7b7;
  word-break: break-all;
}

.vlab-modal__foot {
  padding: 0.85rem 1.35rem 1.15rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.vlab-modal__foot p {
  margin: 0 0 0.75rem;
  font-family: var(--vlab-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #64748b;
}

.vlab-modal__launch {
  font-family: var(--vlab-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  cursor: pointer;
}

.vlab-modal__launch:hover {
  background: rgba(245, 158, 11, 0.22);
}

/* Termini con tooltip flottante (fixed, non tagliato dal modal) */
.vlab-term {
  display: inline;
  border-bottom: 1px dashed rgba(196, 181, 253, 0.55);
  color: #ddd6fe;
  cursor: help;
  font-weight: 500;
}

.vlab-term.is-active,
.vlab-term:hover {
  color: #ede9fe;
  border-bottom-color: rgba(245, 158, 11, 0.65);
}

.vlab-term:focus {
  outline: 2px solid rgba(196, 181, 253, 0.45);
  outline-offset: 2px;
  border-radius: 2px;
}

.vlab-term-tooltip {
  position: fixed;
  z-index: 10001;
  max-width: min(300px, calc(100vw - 24px));
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(9, 14, 24, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  font-family: var(--vlab-mono);
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.55;
  color: #cbd5e1;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.vlab-term-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

.vlab-term-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}

.vlab-term-tooltip:not(.is-above)::after {
  bottom: 100%;
  border-bottom-color: rgba(167, 139, 250, 0.4);
}

.vlab-term-tooltip.is-above::after {
  top: 100%;
  border-top-color: rgba(167, 139, 250, 0.4);
}

.vlab-card__btn {
  margin-top: 0;
  align-self: flex-start;
  font-family: var(--vlab-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.vlab-card__btn:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.65);
}

.vlab-card__btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.vlab-card__error {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #fca5a5;
}

/* Workspace */
.vlab-workspace {
  display: none;
  animation: vlabFadeUp 0.5s ease-out both;
}

.vlab-workspace.is-active {
  display: block;
}

.vlab-workspace__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.vlab-back-btn {
  font-family: var(--vlab-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
}

.vlab-back-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #f8fafc;
}

.vlab-session-meta {
  font-family: var(--vlab-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: #64748b;
}

.vlab-session-meta strong {
  color: #94a3b8;
}

.vlab-layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .vlab-layout {
    grid-template-columns: 1fr;
  }
}

/* Terminale */
.vlab-terminal {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 8, 16, 0.85);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.vlab-terminal__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.vlab-terminal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.vlab-terminal__dot:nth-child(1) { background: #f87171; }
.vlab-terminal__dot:nth-child(2) { background: #fbbf24; }
.vlab-terminal__dot:nth-child(3) { background: #34d399; }

.vlab-terminal__title {
  margin-left: 0.35rem;
  font-family: var(--vlab-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: #64748b;
}

.vlab-terminal__body {
  min-height: 320px;
  max-height: min(52vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  padding: 1rem 1rem 0.5rem;
  font-family: var(--vlab-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.vlab-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.vlab-line--system {
  color: #64748b;
}

.vlab-line--success {
  color: var(--vlab-accent);
}

.vlab-line--error {
  color: #f87171;
}

.vlab-terminal__input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.vlab-prompt {
  font-family: var(--vlab-mono);
  font-size: 0.78rem;
  color: var(--vlab-accent);
  white-space: nowrap;
}

.vlab-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--vlab-mono);
  font-size: 0.78rem;
  color: #f1f5f9;
  outline: none;
}

.vlab-input::placeholder {
  color: #475569;
}

/* Pannello laterale */
.vlab-side {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.vlab-panel {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--vlab-border);
  background: var(--vlab-card-bg);
}

.vlab-panel h3 {
  margin: 0 0 0.65rem;
  font-family: var(--vlab-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vlab-amber);
}

.vlab-panel p,
.vlab-panel li {
  font-size: 0.84rem;
  line-height: 1.55;
  color: #94a3b8;
}

.vlab-panel ul {
  margin: 0;
  padding-left: 1.1rem;
}

.vlab-panel li + li {
  margin-top: 0.4rem;
}

.vlab-panel li.is-done {
  color: var(--vlab-accent);
  text-decoration: line-through;
  text-decoration-color: rgba(0, 255, 156, 0.4);
}

.vlab-network {
  font-family: var(--vlab-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: #64748b;
}

.vlab-network code {
  color: #6ee7b7;
}

.vlab-stop-btn {
  width: 100%;
  margin-top: 0.25rem;
  font-family: var(--vlab-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  cursor: pointer;
}

.vlab-stop-btn:hover {
  background: rgba(248, 113, 113, 0.15);
}

.vlab-complete-banner {
  display: none;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 156, 0.35);
  background: rgba(0, 255, 156, 0.08);
  font-family: var(--vlab-mono);
  font-size: 0.75rem;
  color: var(--vlab-accent);
}

.vlab-complete-banner.is-visible {
  display: block;
}

.vlab-loading {
  text-align: center;
  padding: 2rem;
  font-family: var(--vlab-mono);
  font-size: 0.75rem;
  color: #64748b;
}

.vlab-load-error {
  text-align: center;
  padding: 2rem 1rem;
  max-width: 36rem;
  margin: 0 auto;
}

.vlab-loading--hint {
  padding-top: 0.5rem;
  font-size: 0.68rem;
  color: #94a3b8;
}

.vlab-load-error .vlab-card__btn {
  margin-top: 1.25rem;
}

.vlab-catalog.is-hidden {
  display: none;
}
