/* ============================================================
 * LAB ESTUDO + CURSO READER
 * ============================================================ */

/* ---- LAB SHELL ---- */
body.lab-active nav,
body.lab-active footer,
body.lab-active .statusbar,
body.lab-active .float-search,
body.lab-active .ayra-fab,
body.lab-active .ayra-panel,
body.lab-active .cache-consent { display: none !important; }
body.lab-active main#appMain { padding: 0; margin: 0; }
body.lab-active { background: #05080d; overflow: hidden; }

.lab-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 44px 1fr 28px;
  background: linear-gradient(135deg, #05080d, #0a1220);
  color: #d7f6ff;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
}

.lab-topbar {
  background: rgba(5, 8, 13, 0.92);
  border-bottom: 1px solid rgba(0, 217, 255, 0.18);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; font-size: 11px;
}
.lab-tb-left, .lab-tb-center, .lab-tb-right { display: flex; align-items: center; gap: 8px; }
.lab-tb-center { flex: 1; justify-content: center; flex-wrap: wrap; }
.lab-brand { color: #00d9ff; font-weight: 900; letter-spacing: 0.15em; }
.lab-tag { color: #7fa8b8; font-size: 10px; }
.lab-back { color: #00d9ff; text-decoration: none; font-size: 11px; padding: 4px 8px; border: 1px solid rgba(0, 217, 255, 0.2); border-radius: 4px; }
.lab-back:hover { background: rgba(0, 217, 255, 0.08); }
.lab-clock { color: #00d9ff; font-weight: 600; }

.lab-dock-btn {
  background: rgba(0, 217, 255, 0.06);
  border: 1px solid rgba(0, 217, 255, 0.22);
  color: #d7f6ff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s ease;
}
.lab-dock-btn:hover { background: rgba(0, 217, 255, 0.18); border-color: #00d9ff; transform: translateY(-1px); }
.lab-dock-btn.alt { background: transparent; }

.lab-desktop {
  position: relative;
  overflow: hidden;
  background: transparent;
}
.lab-wallpaper {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}
.lab-mesh {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 217, 255, 0.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(91, 155, 213, 0.08), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(198, 120, 255, 0.06), transparent 60%);
}
.lab-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0, 217, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 217, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
}

.lab-statusbar {
  background: rgba(5, 8, 13, 0.92);
  border-top: 1px solid rgba(0, 217, 255, 0.18);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 14px;
  font-size: 10.5px;
  color: #7fa8b8;
}
.lab-hint { color: #5a7888; font-style: italic; }

/* ---- LAB WINDOW ---- */
.lab-window {
  position: absolute;
  min-width: 280px;
  min-height: 160px;
  background: rgba(8, 18, 32, 0.92);
  border: 1px solid rgba(0, 217, 255, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 217, 255, 0.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  resize: none;
  z-index: 100;
}
.lab-window.focused { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 217, 255, 0.5), 0 0 24px rgba(0, 217, 255, 0.15); }
.lab-window.dragging { transition: none; }
.lab-window.minimized { height: 36px !important; min-height: 36px; }
.lab-window.minimized .lab-win-body, .lab-window.minimized .lab-win-resize { display: none; }

.lab-win-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px;
  background: rgba(5, 8, 13, 0.85);
  border-bottom: 1px solid rgba(0, 217, 255, 0.18);
  cursor: grab;
  user-select: none;
}
.lab-win-head:active { cursor: grabbing; }
.lab-win-title { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.lab-win-icon { font-size: 13px; }
.lab-win-actions { display: flex; gap: 4px; }
.lab-win-btn {
  width: 22px; height: 22px;
  background: rgba(0, 217, 255, 0.08);
  border: 1px solid rgba(0, 217, 255, 0.18);
  color: #d7f6ff;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}
.lab-win-btn:hover { background: rgba(0, 217, 255, 0.18); }
.lab-win-btn.close:hover { background: rgba(255, 60, 60, 0.25); border-color: #ff4d6d; }
.lab-win-body { flex: 1; overflow: auto; }
.lab-win-resize {
  position: absolute; right: 0; bottom: 0;
  width: 14px; height: 14px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(0, 217, 255, 0.32) 50%);
}

/* ---- AYRA dentro do lab ---- */
.lab-ayra-wrap { display: flex; flex-direction: column; height: 100%; }
.lab-ayra-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lab-ayra-msg { padding: 8px 10px; border-radius: 5px; font-size: 12px; line-height: 1.45; max-width: 92%; }
.lab-ayra-msg.user { background: rgba(0, 217, 255, 0.07); border: 1px solid rgba(0, 217, 255, 0.22); align-self: flex-end; color: #d7f6ff; }
.lab-ayra-msg.bot { background: rgba(0, 140, 255, 0.08); border: 1px solid rgba(0, 140, 255, 0.22); align-self: flex-start; color: #d7f6ff; }
.lab-ayra-meta { font-size: 9.5px; color: #7fa8b8; margin-bottom: 2px; }
.lab-ayra-empty { color: #7fa8b8; font-style: italic; padding: 14px; font-size: 12px; }
.lab-ayra-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgba(0, 217, 255, 0.18); background: rgba(5, 8, 13, 0.5); }
.lab-ayra-text { flex: 1; background: rgba(5, 8, 13, 0.65); border: 1px solid rgba(0, 217, 255, 0.2); color: #d7f6ff; padding: 6px 10px; border-radius: 4px; font-size: 12px; outline: 0; font-family: inherit; }
.lab-ayra-text:focus { border-color: #00d9ff; }
.lab-ayra-send { background: #00d9ff; color: #05080d; border: 0; border-radius: 4px; padding: 0 14px; font-weight: 700; font-size: 11px; cursor: pointer; }
.lab-ayra-send:hover { background: #00ecff; }

/* ---- SEARCH ---- */
.lab-search { display: flex; flex-direction: column; height: 100%; }
.lab-search-bar { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid rgba(0, 217, 255, 0.14); }
.lab-search-input { flex: 1; background: rgba(5, 8, 13, 0.65); border: 1px solid rgba(0, 217, 255, 0.2); color: #d7f6ff; padding: 6px 10px; border-radius: 4px; font-size: 12px; outline: 0; font-family: inherit; }
.lab-search-input:focus { border-color: #00d9ff; }
.lab-search-go { background: #00d9ff; color: #05080d; border: 0; border-radius: 4px; padding: 0 12px; font-weight: 700; font-size: 11px; cursor: pointer; }
.lab-search-tabs { display: flex; gap: 4px; padding: 0 8px 8px; border-bottom: 1px solid rgba(0, 217, 255, 0.12); }
.lab-search-tab { background: transparent; border: 1px solid rgba(0, 217, 255, 0.18); color: #7fa8b8; padding: 4px 8px; border-radius: 3px; font-size: 10px; cursor: pointer; }
.lab-search-tab.active { background: rgba(0, 217, 255, 0.12); border-color: #00d9ff; color: #d7f6ff; }
.lab-search-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 200px; }
.lab-search-note { font-size: 10px; color: #7fa8b8; padding: 6px 10px; border-top: 1px solid rgba(0, 217, 255, 0.12); background: rgba(5, 8, 13, 0.7); }

/* ---- NOTES ---- */
.lab-notes { display: flex; flex-direction: column; height: 100%; }
.lab-notes-area { flex: 1; width: 100%; background: rgba(5, 8, 13, 0.55); border: 0; color: #d7f6ff; padding: 12px; font-family: inherit; font-size: 13px; outline: 0; resize: none; line-height: 1.55; }
.lab-notes-foot { display: flex; gap: 8px; align-items: center; padding: 8px; border-top: 1px solid rgba(0, 217, 255, 0.14); background: rgba(5, 8, 13, 0.5); }
.lab-notes-count { flex: 1; font-size: 10px; color: #7fa8b8; }
.lab-mini-btn { background: rgba(0, 217, 255, 0.08); border: 1px solid rgba(0, 217, 255, 0.22); color: #d7f6ff; padding: 4px 10px; border-radius: 3px; font-size: 10.5px; cursor: pointer; text-decoration: none; font-family: inherit; }
.lab-mini-btn:hover { background: rgba(0, 217, 255, 0.18); color: #fff; }

/* ---- EDITOR ---- */
.lab-editor { display: flex; flex-direction: column; height: 100%; }
.lab-editor-tabs { background: rgba(5, 8, 13, 0.85); border-bottom: 1px solid rgba(0, 217, 255, 0.18); padding: 6px 12px; font-size: 11px; }
.lab-editor-tabs span { color: #00d9ff; }
.lab-editor-area { flex: 1; background: #05080d; color: #d7f6ff; border: 0; padding: 12px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; line-height: 1.55; outline: 0; resize: none; }
.lab-editor-foot { display: flex; gap: 8px; align-items: center; padding: 6px 8px; background: rgba(5, 8, 13, 0.85); border-top: 1px solid rgba(0, 217, 255, 0.18); }
.lab-editor-status { margin-left: auto; font-size: 10px; color: #7fa8b8; }
.lab-editor-output { background: #0a1220; color: #37ff9f; padding: 8px 12px; font-family: inherit; font-size: 11.5px; margin: 0; max-height: 80px; overflow-y: auto; border-top: 1px solid rgba(0, 217, 255, 0.12); }

/* ---- TERMINAL ---- */
.lab-terminal { display: flex; flex-direction: column; height: 100%; background: #05080d; }
.lab-term-body { flex: 1; padding: 10px 12px; overflow-y: auto; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.lab-term-line { line-height: 1.55; word-break: break-word; }
.lab-term-line.system { color: #00d9ff; }
.lab-term-line.input { color: #d7f6ff; }
.lab-term-line.output { color: #37ff9f; }
.lab-term-line.error { color: #ffb84d; }
.lab-term-prompt { display: flex; gap: 8px; align-items: center; padding: 6px 12px; border-top: 1px solid rgba(0, 217, 255, 0.18); background: rgba(5, 8, 13, 0.85); }
.lab-term-prompt span { color: #00d9ff; font-size: 11px; }
.lab-term-input { flex: 1; background: transparent; border: 0; color: #d7f6ff; font-family: inherit; font-size: 11.5px; outline: 0; }

/* ---- PDF ---- */
.lab-pdf { display: flex; flex-direction: column; height: 100%; }
.lab-pdf-bar { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid rgba(0, 217, 255, 0.14); }
.lab-pdf-select { flex: 1; background: rgba(5, 8, 13, 0.65); border: 1px solid rgba(0, 217, 255, 0.2); color: #d7f6ff; padding: 5px 8px; border-radius: 4px; font-size: 12px; font-family: inherit; outline: 0; }
.lab-pdf-select:focus { border-color: #00d9ff; }
.lab-pdf-frame { flex: 1; border: 0; background: #fff; }

/* ===== CURSO READER (PDF + Ayra) ===== */
body.reader-active nav,
body.reader-active footer,
body.reader-active .statusbar,
body.reader-active .float-search,
body.reader-active .ayra-fab,
body.reader-active .ayra-panel,
body.reader-active .cache-consent { display: none !important; }
body.reader-active main#appMain { padding: 0; margin: 0; }
body.reader-active { overflow: hidden; }

.reader-shell { position: fixed; inset: 0; display: grid; grid-template-rows: 44px 1fr; background: #05080d; color: #d7f6ff; font-family: 'JetBrains Mono', monospace; }
.reader-topbar { background: rgba(5, 8, 13, 0.95); border-bottom: 1px solid rgba(0, 217, 255, 0.18); display: flex; justify-content: space-between; align-items: center; padding: 0 14px; font-size: 11px; }
.reader-tb-left, .reader-tb-right { display: flex; align-items: center; gap: 10px; }
.reader-brand { color: #00d9ff; font-weight: 900; letter-spacing: 0.12em; }
.reader-tag { color: #7fa8b8; font-size: 10.5px; }
.reader-back { color: #00d9ff; text-decoration: none; padding: 4px 8px; border: 1px solid rgba(0, 217, 255, 0.22); border-radius: 4px; }
.reader-back:hover { background: rgba(0, 217, 255, 0.08); }

.reader-split { display: grid; grid-template-columns: 1fr 8px 1fr; height: 100%; overflow: hidden; }
.reader-split.layout-stacked { grid-template-columns: 1fr; grid-template-rows: 1fr 8px 1fr; }
.reader-pdf { width: 100%; height: 100%; border: 0; background: #fff; }
.reader-divider { background: rgba(0, 217, 255, 0.14); cursor: col-resize; transition: background 0.15s; }
.reader-divider:hover { background: rgba(0, 217, 255, 0.3); }
.reader-split.layout-stacked .reader-divider { cursor: row-resize; }
.reader-ayra { display: flex; flex-direction: column; background: rgba(8, 18, 32, 0.92); }
.reader-ayra-head { padding: 12px 16px; border-bottom: 1px solid rgba(0, 217, 255, 0.18); font-size: 13px; color: #00d9ff; font-weight: 700; }
.reader-ayra-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.reader-ayra-msg { padding: 9px 12px; border-radius: 6px; font-size: 13px; line-height: 1.55; max-width: 92%; }
.reader-ayra-msg.user { background: rgba(0, 217, 255, 0.08); border: 1px solid rgba(0, 217, 255, 0.25); align-self: flex-end; color: #d7f6ff; }
.reader-ayra-msg.bot { background: rgba(0, 140, 255, 0.08); border: 1px solid rgba(0, 140, 255, 0.22); align-self: flex-start; color: #d7f6ff; }
.reader-ayra-empty { color: #7fa8b8; font-style: italic; padding: 14px; font-size: 13px; text-align: center; }
.reader-ayra-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(0, 217, 255, 0.18); }
.reader-ayra-text { flex: 1; background: rgba(5, 8, 13, 0.65); border: 1px solid rgba(0, 217, 255, 0.22); color: #d7f6ff; padding: 8px 12px; border-radius: 6px; font-size: 13px; outline: 0; font-family: inherit; }
.reader-ayra-text:focus { border-color: #00d9ff; }
.reader-ayra-send { background: #00d9ff; color: #05080d; border: 0; border-radius: 6px; padding: 0 16px; font-weight: 700; font-size: 12px; cursor: pointer; letter-spacing: 0.06em; }

@media (max-width: 768px) {
  .reader-split { grid-template-columns: 1fr; grid-template-rows: 1fr 8px 1fr; }
  .reader-divider { cursor: row-resize; }
  .lab-topbar { padding: 0 8px; }
  .lab-tb-center { gap: 4px; }
  .lab-dock-btn { padding: 4px 6px; font-size: 10px; }
}
