/* silicio.css: réplica reducida de los estilos de Silicio (page/styles.css) para la demo */

:root {
  --bg-page: #232323;
  --bg-file: #2b2b2b;
  --accent: #beefbe;
  --mono: #e0e0e0;
  --radius: 10px;
  --green-light: #98ff98;
  --table-green: #a8f4a8;
  --tool-color: #80cbc4;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --code: Consolas, 'DejaVu Sans Mono', monospace;
}

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

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-page);
}

#app {
  display: flex;
  height: 100%;
}

/* ---------- paneles ---------- */
.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--code);
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.4;
}

.pane-left {
  width: 23%;
  padding: 0.9rem 0.4rem;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-page) 0%, #1d1d1d 100%);
  border-right: 1px solid rgba(190, 239, 190, 0.06);
  scrollbar-width: none;
}

.pane-middle {
  width: 54%;
  align-items: center;
  position: relative;
}

.pane-right {
  width: 23%;
  background: linear-gradient(180deg, var(--bg-page) 0%, #1d1d1d 100%);
  border-left: 1px solid rgba(190, 239, 190, 0.06);
}

/* ---------- árbol ---------- */
.tree,
.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--sans);
}

.tree ul {
  padding-left: 0.3rem;
  margin-left: 0.7rem;
  border-left: 1px solid rgba(190, 239, 190, 0.07);
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.26rem 0.5rem;
  margin: 1px 2px;
  border-radius: 6px;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--accent);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.tree-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tree-item i {
  font-size: 0.85rem;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.tree-item .tree-chevron {
  font-size: 0.55rem;
  width: 0.6rem;
  opacity: 0.35;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree li.directory:not(.collapsed) > .tree-item .tree-chevron {
  transform: rotate(90deg);
  opacity: 0.6;
}

.tree li.directory > .tree-item .name {
  font-weight: 600;
}

.tree li.directory.collapsed > ul {
  display: none;
}

.tree li.file > .tree-item {
  color: rgba(255, 255, 255, 0.72);
  padding-left: 1.3rem;
}

.tree li.file.tool > .tree-item {
  color: var(--tool-color);
}

.tree li.file.active > .tree-item {
  background: linear-gradient(90deg, rgba(190, 239, 190, 0.1) 0%, rgba(190, 239, 190, 0.02) 100%);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--green-light);
  font-weight: 600;
}

/* ---------- botones de navegación y favorito ---------- */
.nav-buttons {
  display: flex;
  gap: 0.45rem;
  margin: 0.8rem 0;
}

.nav-btn {
  width: 1.8rem;
  height: 1.8rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg-page);
  font-size: 0.8rem;
  opacity: 0.9;
}

.nav-btn:disabled {
  opacity: 0.4;
}

.nav-btn.fav-toggle {
  display: grid;
  place-items: center;
  margin-left: 0.2rem;
  background: transparent;
  border: 1px solid rgba(190, 239, 190, 0.45);
  color: var(--accent);
}

.nav-btn.fav-toggle[hidden] {
  display: none;
}

.nav-btn.fav-toggle.is-fav {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-page);
}

.nav-btn.fav-toggle.is-fav i {
  animation: fav-pop 0.3s ease-out;
}

@keyframes fav-pop {
  0%   { transform: scale(0.6); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ---------- buscador ---------- */
.search-box {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: calc(100% - 3rem);
  padding: 0.6rem 1rem;
  background: var(--bg-file);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.search-box i {
  font-size: 0.95rem;
  color: var(--accent);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--mono);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: default;
}

.search-box.is-active {
  transform: scale(1.03);
  box-shadow: 0 0 18px 4px var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  z-index: 90;
}

.overlay.hidden,
.search-results.hidden,
.help-popup.hidden {
  display: none;
}

.search-results {
  position: absolute;
  top: 6.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3rem);
  max-height: 60%;
  overflow: hidden;
  padding: 0.5rem 0.8rem;
  background: var(--bg-file);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  z-index: 95;
}

.search-summary {
  padding: 0.3rem 0.4rem;
  font-size: 0.72rem;
  color: var(--mono);
  opacity: 0.6;
  border-bottom: 1px solid rgba(190, 239, 190, 0.12);
  margin-bottom: 0.3rem;
}

.search-file-group {
  margin-bottom: 0.15rem;
}

.search-file-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.76rem;
  color: var(--accent);
}

.search-file-path {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.search-file-path.tool,
.search-file-header .fa-terminal {
  color: var(--tool-color);
}

.search-chevron {
  font-size: 0.6rem;
  opacity: 0.5;
}

.search-match-badge {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0.05rem 0.45rem;
  background: rgba(190, 239, 190, 0.15);
  border-radius: 8px;
  font-size: 0.68rem;
}

.search-match-list {
  margin-left: 0.75rem;
  padding-left: 0.8rem;
  border-left: 1px solid rgba(190, 239, 190, 0.1);
}

.search-match-line {
  display: flex;
  gap: 0.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--mono);
}

.search-match-line.selected {
  background: rgba(168, 244, 168, 0.2);
}

.search-line-num {
  min-width: 1.4rem;
  text-align: right;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.45;
}

.search-line-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.search-hl {
  background: rgba(255, 200, 0, 0.35);
  color: #fff;
  border-radius: 2px;
  padding: 0 2px;
}

/* ---------- fichero ---------- */
.welcome-card,
.markdown-body {
  width: calc(100% - 3rem);
  flex: 1 1 auto;
  min-height: 0;
  margin: 1.2rem 0;
  background: var(--bg-file);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--mono);
}

.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.5rem;
  text-align: center;
}

.welcome-card i {
  font-size: 2.2rem;
  color: var(--accent);
}

.welcome-card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.welcome-card p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.8;
}

.welcome-card[hidden],
.markdown-body[hidden] {
  display: none;
}

.markdown-body {
  padding: 1.2rem 1.6rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(190, 239, 190, 0.2) transparent;
  animation: fade-in 0.5s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.markdown-body h1,
.markdown-body h2 {
  color: var(--accent);
  scroll-margin-top: 0.8rem;
}

.markdown-body h1 {
  margin: 0 0 0.8rem;
  font-size: 1.35rem;
}

.markdown-body h2 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.02rem;
}

.markdown-body p {
  margin: 0.6rem 0;
}

.markdown-body code {
  padding: 0.15em 0.35em;
  background: rgba(224, 224, 224, 0.08);
  border-radius: calc(var(--radius) / 2);
  font-family: var(--code);
  font-size: 0.9em;
}

.markdown-body pre {
  position: relative;
  display: grid;
  margin: 0.8rem 0 1rem;
  padding: 0.8rem;
  background: #1e1e1e;
  border: 1px solid rgba(224, 224, 224, 0.15);
  border-radius: var(--radius);
}

.markdown-body pre > code {
  grid-area: 1 / 1;
  overflow: hidden;
  padding: 0;
  background: transparent;
  white-space: pre-wrap;
  word-break: break-all;
}

.copy-btn {
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 1px 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.65rem;
  opacity: 0.7;
}

.copy-btn.pressed {
  opacity: 1;
  background: rgba(190, 239, 190, 0.15);
}

.copied {
  position: absolute;
  top: 6px;
  right: 56px;
  font-size: 0.65rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.3s;
}

.copied.show {
  opacity: 1;
}

.markdown-body table {
  width: 100%;
  margin: 0.6rem 0 1rem;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.markdown-body th,
.markdown-body td {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--table-green);
  text-align: left;
}

.markdown-body th {
  background: rgba(152, 255, 152, 0.1);
}

.markdown-body tr:nth-child(even) td {
  background: rgba(152, 255, 152, 0.025);
}

.markdown-body .callout {
  margin: 1rem 0;
  border-left: 4px solid #00bfa5;
  border-radius: var(--radius);
  background: #00bfa514;
  overflow: hidden;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  color: #00bfa5;
  font-weight: bold;
}

.callout-body {
  padding: 0 0.8rem 0.5rem;
}

.callout-body p {
  margin: 0;
}

/* Código de colores de los apuntes (convención de Silicio) */
.c-aqua   { color: aqua; }
.c-lime   { color: lime; }
.c-orange { color: orange; }

.search-flash {
  animation: search-flash 1.8s ease-out;
}

@keyframes search-flash {
  0%   { background: rgba(255, 200, 0, 0.35); }
  100% { background: transparent; }
}

/* ---------- panel derecho: favoritos + índice ---------- */
.side-panels {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  height: 100%;
  padding: 0.9rem 0.6rem;
}

.side-section {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.side-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(190, 239, 190, 0.08);
  color: rgba(190, 239, 190, 0.6);
  font-family: var(--sans);
}

.side-header i {
  font-size: 0.8rem;
}

.side-header h2 {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-count {
  margin-left: auto;
  padding: 0.05rem 0.45rem;
  background: rgba(190, 239, 190, 0.12);
  color: var(--accent);
  border-radius: 8px;
  font-size: 0.62rem;
}

.side-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-top: 0.4rem;
}

.fav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--sans);
}

.fav-item {
  display: flex;
  align-items: center;
  margin: 1px 2px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
}

.fav-item.active {
  background: linear-gradient(90deg, rgba(190, 239, 190, 0.1) 0%, rgba(190, 239, 190, 0.02) 100%);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--green-light);
}

.fav-item.added {
  animation: fade-in 0.4s ease-out;
}

.fav-open {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.3rem 0.3rem 0.3rem 0.45rem;
}

.fav-open i {
  font-size: 0.8rem;
}

.fav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fav-name,
.fav-where {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-name {
  font-size: 0.72rem;
}

.fav-item.active .fav-name {
  font-weight: 600;
}

.fav-where {
  font-size: 0.6rem;
  opacity: 0.45;
}

#toc-container ul {
  list-style: none;
  margin: 0;
  padding: 0 0.4rem;
}

#toc-container li {
  margin: 0.25rem 0;
}

#toc-container li.sub {
  padding-left: 0.7rem;
}

#toc-container a {
  color: var(--accent);
  font-size: 0.72rem;
  text-decoration: none;
}

#toc-container a.current {
  text-decoration: underline;
}

/* ---------- ayuda ---------- */
.help-btn {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-page);
  font-size: 1rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
  z-index: 130;
}

.help-popup {
  position: fixed;
  right: 0.8rem;
  bottom: 3.6rem;
  width: 220px;
  padding: 0.8rem 1rem;
  background: var(--bg-file);
  color: var(--mono);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.6);
  font-family: var(--code);
  z-index: 125;
}

.help-popup h4 {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
}

.help-popup ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-popup li {
  margin: 0.35rem 0;
  font-size: 0.72rem;
}

.help-popup kbd {
  padding: 1px 5px;
  margin-right: 0.3rem;
  background: #333;
  color: var(--green-light);
  border-radius: 4px;
  font-family: var(--code);
  font-size: 0.68rem;
}

/* ---------- guía (intro.js) con los colores de la marca ---------- */
.introjs-tooltip {
  max-width: 300px;
  background: var(--bg-file);
  color: var(--mono);
  border: 1px solid var(--accent);
  font-family: var(--sans);
}

.introjs-tooltip.tooltip-narrow {
  min-width: 195px;
  max-width: 195px;
}

.tooltip-narrow .introjs-tooltiptext {
  font-size: 0.76rem;
}

.tooltip-narrow .introjs-button {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
}

.introjs-tooltip-title {
  color: var(--accent);
  font-size: 1rem;
}

.introjs-tooltiptext {
  font-size: 0.82rem;
  line-height: 1.5;
}

.introjs-arrow.top,
.introjs-arrow.top-middle,
.introjs-arrow.top-right {
  border-bottom-color: var(--accent);
}

.introjs-arrow.bottom,
.introjs-arrow.bottom-middle,
.introjs-arrow.bottom-right {
  border-top-color: var(--accent);
}

.introjs-arrow.left,
.introjs-arrow.left-bottom {
  border-right-color: var(--accent);
}

.introjs-arrow.right,
.introjs-arrow.right-bottom {
  border-left-color: var(--accent);
}

.introjs-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  text-shadow: none;
  font-family: var(--sans);
}

.introjs-button:hover,
.introjs-button:focus {
  background: rgba(190, 239, 190, 0.12);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.introjs-nextbutton,
.introjs-donebutton {
  background: var(--accent);
  color: var(--bg-page);
}

.introjs-nextbutton:hover,
.introjs-donebutton:hover,
.introjs-nextbutton:focus,
.introjs-donebutton:focus {
  background: #aee0ae;
  color: var(--bg-page);
}

.introjs-disabled,
.introjs-disabled:hover {
  opacity: 0.4;
}

.introjs-progress {
  background: #3a3a3a;
}

.introjs-progressbar {
  background: var(--accent);
}

.introjs-helperLayer {
  box-shadow: rgba(190, 239, 190, 0.8) 0 0 0 1px, rgba(20, 20, 20, 0.6) 0 0 0 5000px !important;
}
