/* ======================
   VARIABLES GLOBALES
====================== */
:root {
  --bg-dark: #121827;
  --bg-darker: #0b1124;
  --bg-darker-alt: #1d2635;
  --bg-sidebar: #191f33;
  --bg-input: #121827;
  --text-light: #cbd5e1;
  --text-light-alt: #9ca3af;
  --text-highlight: #d7bae2;
  --accent-purple: #aa6ed7;
  --accent-light-purple: #c6b4ef;
  --green-light: #4ade80;
  --green-dark: #22c55e;
  --green-teal: #12b886;
  --icon-button-bg: #2f2f48;
  --icon-button-hover-bg: #413f5d;
  --terminal-bg: #0d1117;
  --terminal-text: #c9d1d9;
  --gris-pasion: #757575;
}

/* ======================
   RESETS / BASE
====================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, system-ui, sans-serif;
  background-color: var(--bg-darker-alt);
  color: var(--text-light);
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
}

textarea {
  width: 100%;
  height: 80px;
  background-color: var(--bg-dark);
  resize: none;
  border: none !important;
  outline: none;
}

/* ======================
   LAYOUT PRINCIPAL
====================== */
.layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 52px);
  overflow: hidden;
}

aside.sidebar {
  background-color: var(--bg-sidebar);
  width: 200px;
  display: flex;
  flex-direction: row;
  user-select: none;
  border-right: 1px solid #2a2e46;
  position: relative;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 25px;
}

.sidebar-box {
  width: 25px;
  height: 100%;
  background: var(--icon-button-bg);
  position: absolute;
  top: 0;
  left: 0;
}

.sidebar-tabs {
  display: flex;
  flex-direction: column;
  overflow-y: visible;
}

.sidebar-tab {
  writing-mode: vertical-rl;
  text-orientation: upright;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  background: black;
  border: none;
  color: var(--text-light-alt);
  /*padding: 0.5rem 1rem;*/
  padding-right: 1rem;
  padding-left: 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  flex-direction: column;
  gap: 0;
  /*margin-bottom: 2rem;*/
  background-color: transparent;
}

.separator {
  height: 1px;
  width: 25px;
  background: white;
  margin: 4px 0;
  z-index: 1;
}

.sidebar-tab.active {
  color: var(--accent-purple);
  border-bottom: 2px solid var(--accent-purple);
}

.sidebar-tab:hover {
  color: var(--text-light);
}

.sidebar-content {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0.5rem;
  padding-left: 0;
  align-self: stretch;
}


main {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.8rem 1rem 0 1rem;
}
/*ERA EL MALDITO DEL MAIN EL QUE LIMITABA EL */
/* ======================
   HEADER
====================== */
header {
  background-color: var(--bg-darker);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 52px;
  gap: 1rem;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid #2a2e46;
}

.header-icons {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-shrink: 0;
}

.logo {
  font-family: 'Brush Script MT', cursive;
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--accent-purple);
  cursor: default;
  flex-shrink: 0;
  letter-spacing: -0.05em;
}

nav.menu {
  display: flex;
  gap: 0.875rem;
  font-size: 0.875rem;
  color: var(--text-light-alt);
  flex: 1 1 auto;
  align-items: center;
  white-space: nowrap;
}

nav.menu button {
  background: none;
  border: none;
  color: var(--text-light-alt);
  font-weight: 500;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  transition: color 0.15s ease-in-out;
}

nav.menu button:hover,
nav.menu button:focus {
  color: var(--text-light);
  outline: none;
  text-decoration: underline;
}

/* ======================
   COMPONENTES
====================== */

/* Botones genéricos */
.cell-button,
.icon-button {
  background-color: var(--icon-button-bg);
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-light-alt);
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.cell-button {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
}

.cell-button:hover,
.icon-button:hover {
  background-color: var(--icon-button-hover-bg);
  color: var(--text-light);
}

.icon-button:focus {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

/*LISTA DE VERSIONES*/
.floating-dropdown {
  display: none !important;
  position: absolute;
  background-color: var(--icon-button-bg);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  z-index: 99999;
  flex-direction: column;
  min-width: 140px;
  padding: 4px 0;
  box-sizing: border-box;
  z-index: 2;
}

/* clase que muestra el dropdown */
.floating-dropdown.open {
  display: flex !important;
  z-index: 2;
}

/* estilo de botones dentro */
.floating-dropdown button {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  z-index: 2;
}

.floating-dropdown button:hover,
.floating-dropdown button:focus {
  background-color: var(--icon-button-hover-bg);
  outline: none;
  z-index: 2;
}

/* Botón de colapso del sidebar */
.collapse-btn {
  background-color: var(--icon-button-bg);
  border: none;
  color: var(--text-light);
  width: 8px;
  /*height: 10px;*/
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: left;
  justify-content: center;
  font-size: 0.7rem;
  transition: background-color 0.2s ease-in-out;
  z-index: 1;
}

.collapse-btn:hover {
  background-color: var(--icon-button-hover-bg);
  color: var(--accent-purple);
  border-radius: 0;
  transform: scale(1.04);
}

/* Share button */
.share-button {
  background-color: var(--accent-light-purple);
  padding: 0.4rem 1.2rem;
  border-radius: 18px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--bg-darker-alt);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.share-button:hover,
.share-button:focus {
  background-color: var(--accent-purple);
  color: white;
  outline: none;
}

/* Code area */
.code-cell {
  background-color: var(--bg-input);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-light);
  font-family: 'Source Code Pro', monospace;
  font-size: 0.9rem;
  border: 1px solid #181f3b;
  box-shadow:
    inset 0 0 10px rgb(10 15 38 / 0.6),
    inset 0 3px 5px rgb(65 48 75 / 0.65);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

.code-cell textarea,
.code-cell pre {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.9rem;
  line-height: 1.3;
  border: none;
  border-radius: 0;
}

.code-cell textarea {
  resize: none;
  height: 80px;
}

.code-cell pre {
  overflow: auto;
  min-height: 60px;
  margin-top: 0;
}

.code-cell:hover .cell-controls {
  opacity: 1;
}

.cell-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Preformat / output */
pre {
  white-space: pre-wrap;
  background-color: var(--bg-darker-alt);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 8px;
  overflow-x: auto;
  min-height: 40px;
}

pre.output {
  white-space: pre-wrap;
  background: #111;
  color: #ffffff;
  padding: 1rem;
  border-radius: 0 0 8px 8px;
  overflow-wrap: break-word;
  margin: 0;
  min-height: 40px;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
}
.cells-container {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}



.input-prompt {
  color: var(--accent-purple);
  font-weight: 600;
  margin-bottom: 0.5rem;
  user-select: none;
  font-size: 0.95rem;
  font-family: monospace;
}

.insert-line {
  height: 24px;
  border-top: 1px dashed #888;
  margin: 8px 0;
  position: relative;
  cursor: pointer;
}

.insert-buttons {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
}

.insert-buttons .new-button {
  background-color: var(--bg-dark);
  border: none;
  color: var(--gris-pasion);
}

.insert-line:hover .insert-buttons {
  display: block;
}

.abajo {
  margin-left: -1rem;       /* ignora padding-left */
  margin-right: -1rem;      /* ignora padding-right */
  margin-bottom: 0;   /* ignora padding-bottom */
  width: calc(100% + 2rem); /* ancho compensado */
  position: relative; 
  height: 12vh;	
  max-height: 30vh;
  border-radius: 0;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.9rem;
  border: 1px solid #181f3b;
  box-shadow:
    inset 0 0 10px rgb(10 15 38 / 0.6),
    inset 0 3px 5px rgb(65 48 75 / 0.65);
  line-height: 1.3;
  padding: 10px 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  /*white-space: pre-wrap;*/
  word-break: break-word;
  background-color: var(--bg-darker);
}

.abajo.collapsed {
  height: 0 !important;
  padding: 0 !important;
  border: none;
  overflow: hidden;
}

/*===============
 TERMINAL
*/===============
.terminal-wrapper {
  transition: height 0.3s ease;
  overflow: hidden;
}

.terminal-wrapper .collapsed{
  height: 0;
}

.abajo::-webkit-scrollbar {
  display: none;
}

.linea-terminal {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.prompt {
  user-select: none;
  pointer-events: none;
  color: var(--accent-purple);
}

.entrada {
  flex-grow: 1;
  min-width: 0;
  outline: none;
  max-width: calc(100% - 2rem);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  color: var(--text-light);
  max-height: 100%;
}
/* ======================
   SIDEBAR Y EXPLORADOR DE ARCHIVOS
====================== */
.sidebar-content.hidden {
  display: none;
}

.file-explorer {
  padding: 0.5rem 0;
}

.directory-item {
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid transparent;
  user-select: none;
}

.directory-var {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  user-select: none;
  line-height: 1.4; /* asegura buena separación */
}
.directory-var:hover{
  background-color: rgba(255, 255, 255 / 0.05);
}
.directory-item:hover {
  background-color: var(--bg-darker-alt);
  border-color: var(--accent-purple);
}

.directory-item.selected {
  background-color: var(--accent-purple);
  color: white;
}

.file-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ======================
   UTILIDADES ADICIONALES
====================== */
.hidden {
  display: none !important;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  margin-right: 0.5rem;
}

.menu-toggle:focus {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}
