:root {
  --bg: #0b0f1a;
  --bg-soft: #0f1526;
  --card: #111a2e;
  --card-2: #0e1730;
  --text: #e7ecf7;
  --muted: #a8b0c2;
  --accent: #7c3aed; /* púrpura */
  --accent-2: #00c2ff; /* azul eléctrico */
  --glass: rgba(255,255,255,0.06);
  --ring: rgba(124,58,237,0.45);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --speed: 280ms;
}

/* ------------------------ RESET ------------------------ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(0,194,255,0.12), transparent 60%),
    linear-gradient(180deg, #0a0f1e 0%, #071022 100%);
  color: var(--text);
  overflow-x: hidden;
}

/* ------------------------ HEADER ------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(10, 15, 30, 0.9) 0%, rgba(10, 15, 30, 0.4) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.titles h1 {
  font-size: clamp(18px, 2.2vw, 26px);
  margin: 0;
}
.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.6vw, 14px);
}

/* ------------------------ MAIN LAYOUT ------------------------ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.tree-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 20px;
}

/* ------------------------ TREE STRUCTURE ------------------------ */
.tree-container {
  padding-left: 14px;
}

.tree {
  position: relative;
  list-style: none;
  padding-left: 24px;
  margin: 0;
}

.tree li {
  position: relative;
  margin: 12px 0;
}

/* Líneas de conexión */
.tree li::before {
  content: "";
  position: absolute;
  top: 0;
  left: -18px;
  width: 18px;
  height: 1.5px;
  background: rgba(124,58,237,0.45);
}
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  left: -18px;
  width: 1.5px;
  height: 100%;
  background: rgba(124,58,237,0.3);
}
.tree li:last-child::after {
  height: 14px;
}

/* ------------------------ FOLDERS ------------------------ */
.folder, .file {
  position: relative;
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  transition: all var(--speed) ease;
  color: var(--text);
}

.folder {
  cursor: pointer;
}
.folder:hover {
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(0,194,255,0.12));
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Ícono animado */
.folder::before {
  content: "📁";
  margin-right: 6px;
  transition: transform var(--speed);
}
.folder.open::before {
  content: "📂";
  transform: rotate(5deg);
}

/* Archivos (subcarpetas finales) */
.file {
  border-left: 3px solid var(--accent-2);
  background: rgba(255,255,255,0.05);
  cursor: default;
}
.file:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(2px);
}

/* ------------------------ OPEN ANIMATION ------------------------ */
.tree ul {
  margin-left: 22px;
  border-left: 1px solid rgba(255,255,255,0.1);
  padding-left: 12px;
  display: none;
  opacity: 0;
  transform: scaleY(0.95);
  transform-origin: top;
  transition: all 0.35s ease;
}

.tree ul.open {
  display: block;
  opacity: 1;
  transform: scaleY(1);
}

/* ------------------------ FOOTER ------------------------ */
.site-footer {
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(7,16,34,0) 0%, rgba(7,16,34,0.4) 100%);
}

/* ------------------------ RESPONSIVE ------------------------ */
@media (max-width: 780px) {
  .tree {
    padding-left: 10px;
  }
  .folder, .file {
    font-size: 14px;
    padding: 8px 12px;
  }
  .tree ul {
    margin-left: 14px;
  }
}

/* === Animación de líneas === */
.tree li::before,
.tree li::after {
  transition: all 0.4s ease;
  transform-origin: left top;
}

.tree ul.animating li::before,
.tree ul.animating li::after {
  animation: drawLine 0.4s ease forwards;
}

@keyframes drawLine {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}
