/* ============================================================
   style.css — Laboratorio PHP · SENA 2025
   Fuente: Sora (UI) + JetBrains Mono (código)
   Tema: dark industrial, acento verde terminal
   ============================================================ */

:root {
  --bg:        #0d0f12;
  --bg2:       #13161b;
  --bg3:       #1a1e26;
  --bg4:       #222730;
  --border:    #2a2f3a;
  --border2:   #343b4a;
  --text:      #e2e6ee;
  --text2:     #8b92a6;
  --text3:     #555e70;
  --green:     #3dd68c;
  --green-dim: #1d4731;
  --blue:      #4d9ef7;
  --blue-dim:  #1a2f4a;
  --amber:     #f5a623;
  --amber-dim: #3d2800;
  --red:       #f2605c;
  --red-dim:   #3a1515;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Sora', sans-serif;
  --radius:    8px;
  --radius-lg: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

.screen { display: none; }
.screen.active { display: block; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ======================================================
   INTRO
   ====================================================== */
#screen-intro {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(61,214,140,.08) 0%, transparent 70%);
}

.intro-wrap {
  max-width: 580px;
  width: 100%;
  padding: 3rem 2rem;
  text-align: center;
}

.sena-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-dim);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 2rem;
  border: 1px solid rgba(61,214,140,.2);
}

.intro-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -.02em;
}
.intro-title span { color: var(--green); }

.intro-sub {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.intro-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.istat { flex: 1; }
.istat-num { font-size: 28px; font-weight: 600; color: var(--text); }
.istat-lbl { font-size: 12px; color: var(--text3); margin-top: 2px; }
.istat-sep { width: 1px; height: 40px; background: var(--border); margin: 0 1.5rem; }

.intro-info {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  padding: 6px 0;
}
.info-row strong { color: var(--text); font-weight: 500; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot.green  { background: var(--green); }
.dot.blue   { background: var(--blue); }
.dot.amber  { background: var(--amber); }

.intro-name-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.intro-name-row input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.intro-name-row input:focus { border-color: var(--green); }
.intro-name-row input::placeholder { color: var(--text3); }

.intro-name-row button {
  background: var(--green);
  color: #0d1a12;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.intro-name-row button:hover { background: #5af0a6; transform: translateY(-1px); }
.arrow { margin-left: 4px; }

.intro-err { font-size: 12px; color: var(--red); min-height: 18px; }

/* ======================================================
   LAB HEADER
   ====================================================== */
#screen-lab { min-height: 100vh; display: flex; flex-direction: column; }

.lab-header {
  height: 54px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.lab-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text2);
  white-space: nowrap;
}
.lab-logo span { color: var(--green); }

.header-center { flex: 1; display: flex; justify-content: center; }

.step-track {
  display: flex; gap: 4px; align-items: center;
}
.step-dot-h {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text3);
  cursor: pointer; transition: all .2s; user-select: none;
}
.step-dot-h.active  { background: var(--blue); border-color: var(--blue); color: #fff; }
.step-dot-h.done    { background: var(--green); border-color: var(--green); color: #0d1a12; }
.step-dot-h.locked  { opacity: .35; cursor: default; }
.step-connector { width: 16px; height: 1px; background: var(--border); }

.score-display {
  font-size: 15px; font-weight: 600; color: var(--green); white-space: nowrap;
}
.score-of { font-size: 12px; color: var(--text3); font-weight: 400; margin-left: 2px; }

/* ======================================================
   LAB LAYOUT
   ====================================================== */
.lab-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  height: calc(100vh - 54px);
}

/* ---- SIDEBAR ---- */
.lab-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-modules { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }

.sidebar-mod {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.sidebar-mod:hover { background: var(--bg3); }
.sidebar-mod.active { background: var(--bg4); }
.sidebar-mod.locked { opacity: .4; cursor: default; }
.sidebar-mod.locked:hover { background: transparent; }

.sm-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--text3);
  flex-shrink: 0; transition: all .2s;
}
.sidebar-mod.active   .sm-icon { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.sidebar-mod.done     .sm-icon { background: var(--green-dim); border-color: var(--green); color: var(--green); }

.sm-info { min-width: 0; }
.sm-name { font-size: 12px; font-weight: 500; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-mod.active .sm-name { color: var(--text); }
.sm-pts  { font-size: 11px; color: var(--text3); }

.sidebar-hint {
  margin: 1rem 10px 0;
  background: var(--amber-dim);
  border: 1px solid rgba(245,166,35,.2);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.hint-label { font-size: 11px; font-weight: 600; color: var(--amber); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.hint-text  { font-size: 12px; color: #d4a44a; line-height: 1.6; }

/* ---- EDITOR AREA ---- */
.lab-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.editor-topbar {
  height: 44px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 8px;
  flex-shrink: 0;
}

.file-tab {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 5px 14px;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
}

.editor-actions { margin-left: auto; display: flex; gap: 6px; }

.act-btn {
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 500;
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
}
.act-btn:hover { background: var(--bg4); color: var(--text); }

.hint-btn  { border-color: rgba(245,166,35,.3); color: var(--amber); }
.hint-btn:hover { background: var(--amber-dim); }

.reset-btn { }

.run-btn {
  background: var(--green);
  border-color: var(--green);
  color: #0a1c12;
  font-weight: 600;
}
.run-btn:hover { background: #5af0a6; transform: translateY(-1px); }
.run-btn.loading { opacity: .7; cursor: default; }

.editor-meta {
  padding: 1.25rem 1.5rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.module-badge-lab {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.module-title-lab {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 6px;
}

.module-desc-lab {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 10px;
}

.req-checklist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.req-checklist li {
  font-size: 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .3s;
}
.req-checklist li.passed {
  background: var(--green-dim);
  border-color: rgba(61,214,140,.3);
  color: var(--green);
}
.req-check-icon { font-size: 10px; }

/* ---- CODE EDITOR ---- */
.code-wrap {
  flex: 1;
  display: flex;
  overflow: auto;
  min-height: 200px;
  background: var(--bg);
}

.line-numbers {
  padding: 1rem 10px 1rem 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text3);
  user-select: none;
  text-align: right;
  flex-shrink: 0;
  min-width: 40px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.code-editor {
  flex: 1;
  padding: 1rem 1rem 1rem 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  background: var(--bg);
  color: #a8d8a8;
  border: none;
  outline: none;
  resize: none;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* ---- OUTPUT ---- */
.output-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg2);
}

.output-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

#output-content {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.output-panel.ok #output-content   { color: var(--green); }
.output-panel.ok .output-topbar    { color: var(--green); background: var(--green-dim); border-color: rgba(61,214,140,.2); }
.output-panel.fail #output-content { color: #f09090; }
.output-panel.fail .output-topbar  { color: var(--red); background: var(--red-dim); border-color: rgba(242,96,92,.2); }

/* ---- PASS PANEL ---- */
.pass-panel {
  flex-shrink: 0;
  background: var(--green-dim);
  border-top: 1px solid rgba(61,214,140,.25);
  padding: 12px 16px;
}
.pass-inner {
  display: flex; align-items: center; gap: 14px;
}
.pass-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); color: #0a1c12;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.pass-title { font-size: 14px; font-weight: 600; color: var(--green); }
.pass-sub   { font-size: 12px; color: rgba(61,214,140,.7); margin-top: 2px; }

.next-module-btn {
  margin-left: auto;
  background: var(--green);
  color: #0a1c12;
  border: none;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.next-module-btn:hover { background: #5af0a6; }

/* ======================================================
   RESULTS
   ====================================================== */
#screen-results {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  background-image: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(61,214,140,.06) 0%, transparent 65%);
}

.results-wrap {
  max-width: 600px;
  width: 100%;
}

.results-header { text-align: center; margin-bottom: 2rem; }
.trophy-icon { font-size: 48px; margin-bottom: 1rem; }
.results-header h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
#res-name-display { font-size: 14px; color: var(--text2); }

.results-score-big {
  text-align: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.score-circle {
  display: inline-block;
  font-size: 56px;
  font-weight: 600;
  color: var(--green);
  line-height: 1;
  margin-bottom: .5rem;
}
.score-circle small { font-size: 20px; color: var(--text3); font-weight: 400; }
#res-msg { font-size: 14px; color: var(--text2); margin-top: .5rem; }

.results-modules {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.res-mod-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.res-mod-row:last-child { border-bottom: none; }
.res-mod-name { flex: 1; font-size: 12px; color: var(--text2); }
.res-bar-wrap { width: 120px; height: 5px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.res-bar      { height: 5px; border-radius: 99px; }
.res-pts      { font-size: 12px; font-weight: 600; width: 50px; text-align: right; }

.results-ranking-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.results-ranking-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 13px;
}
.rank-pos   { width: 24px; font-size: 16px; text-align: center; }
.rank-n     { flex: 1; color: var(--text); font-weight: 500; }
.rank-date  { font-size: 11px; color: var(--text3); }
.rank-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.badge-gold   { background: rgba(245,166,35,.15); color: var(--amber); }
.badge-pass   { background: var(--green-dim); color: var(--green); }
.badge-fail   { background: var(--red-dim); color: var(--red); }
.rank-sc    { font-size: 13px; font-weight: 600; color: var(--green); width: 56px; text-align: right; }
.rank-empty { font-size: 13px; color: var(--text3); text-align: center; padding: 1rem; }

.btn-retry {
  display: block;
  margin: 1rem auto 0;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 24px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}
.btn-retry:hover { background: var(--bg3); color: var(--text); }

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 700px) {
  .lab-sidebar { width: 180px; }
  .sm-name { font-size: 11px; }
  .editor-topbar { flex-wrap: wrap; height: auto; padding: 8px; }
  .editor-actions { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .lab-sidebar { display: none; }
  .lab-main { flex-direction: column; }
}

/* ======================================================
   FULLSCREEN
   ====================================================== */
.dot.red { background: var(--red); }

.fs-indicator {
  font-size: 11px;
  color: var(--green);
  border: 1px solid rgba(61,214,140,.25);
  border-radius: 99px;
  padding: 3px 10px;
  margin-left: 10px;
  white-space: nowrap;
  cursor: default;
}

/* ---- Overlay base ---- */
.fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.fs-overlay-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
  animation: popIn .25s ease;
}
.fs-overlay-box.killed {
  border-color: rgba(242,96,92,.4);
  background: #1a0f0f;
}

@keyframes popIn {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.fs-overlay-icon { font-size: 48px; margin-bottom: 1rem; }

.fs-overlay-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .75rem;
}

.fs-overlay-msg {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}
.fs-overlay-msg strong { color: var(--red); }

.fs-overlay-countdown {
  font-size: 13px;
  color: var(--amber);
  margin-bottom: 1.25rem;
  font-family: var(--mono);
}

.fs-overlay-btn {
  background: var(--green);
  color: #0a1c12;
  border: none;
  border-radius: var(--radius);
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .2s;
}
.fs-overlay-btn:hover { background: #5af0a6; transform: translateY(-1px); }

/* ---- Warning flash on header ---- */
@keyframes warnFlash {
  0%,100% { background: var(--bg2); }
  50%      { background: rgba(242,96,92,.15); }
}
.warn-flash { animation: warnFlash .4s ease 3; }
