/* ==============================================================================
   ANSIBLE DOCS — Glassmorphism Theme (DevOps Core Framework)
   ============================================================================== */

:root {
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-soft: rgba(255, 255, 255, 0.55);
  --glass-dark: rgba(17, 20, 40, 0.55);
  --glass-border: rgba(255, 255, 255, 0.45);
  --glass-border-dark: rgba(255, 255, 255, 0.14);
  --ink: #1c2140;
  --ink-soft: #4a5178;
  --accent: #6d5df6;
  --accent-2: #19b8a6;
  --radius: 18px;
  --sidebar-w: 292px;
  --sidebar-w-collapsed: 74px;
  --mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(135deg, #3b2f80 0%, #5a3d9e 28%, #2d5f9e 62%, #1e8f85 100%);
  background-attachment: fixed;
}

/* Burbujas decorativas de fondo */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 46vw; height: 46vw;
  background: rgba(255, 128, 220, 0.24);
  top: -12vw; right: -10vw;
}
body::after {
  width: 38vw; height: 38vw;
  background: rgba(64, 224, 208, 0.22);
  bottom: -14vw; left: 18vw;
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  inset: 16px auto 16px 16px;
  background: var(--glass-dark);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--glass-border-dark);
  border-radius: var(--radius);
  padding: 22px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  color: #eef0ff;
  box-shadow: 0 18px 48px rgba(10, 12, 34, 0.45);
  transition: width .25s ease, padding .25s ease;
}

/* Botón de contraer/expandir */
.collapse-btn {
  position: sticky;
  top: 0;
  float: right;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.14);
  color: #eef0ff;
  font-size: 14px; font-weight: 700;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background .2s, transform .2s;
  z-index: 2;
}
.collapse-btn:hover { background: rgba(255,255,255,.28); transform: scale(1.08); }

/* ---------- Estado contraído ---------- */
.layout.collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
  padding: 18px 12px;
}
.layout.collapsed .main {
  margin-left: calc(var(--sidebar-w-collapsed) + 32px);
}
.layout.collapsed .sidebar .lbl { display: none; }
.layout.collapsed .brand { justify-content: center; padding: 34px 0 14px; }
.layout.collapsed .nav-item { justify-content: center; padding: 9px 6px; }
.layout.collapsed .nav-item .ico { width: auto; font-size: 17px; }
.layout.collapsed .nav-section { text-align: center; padding: 0; }
.layout.collapsed .collapse-btn { float: none; display: block; margin: 0 auto; }

/* En la sección, el puntito solo se ve contraído */
.nav-section .dot { display: none; font-size: 13px; opacity: .55; }
.layout.collapsed .nav-section .dot { display: inline; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 22px;
  box-shadow: 0 6px 18px rgba(109, 93, 246, 0.5);
}
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand small { display: block; font-size: 11px; color: #aab0d8; font-weight: 400; }

.search {
  width: 100%;
  background: rgba(255,255,255,.09);
  border: 1px solid var(--glass-border-dark);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  margin-bottom: 16px;
  outline: none;
  transition: border .2s, background .2s;
}
.search::placeholder { color: #9aa0c8; }
.search:focus { border-color: var(--accent); background: rgba(255,255,255,.14); }

.nav-section { margin: 14px 0 6px; padding: 0 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px; color: #8f96c4; }

/* Cabecera de sección plegable */
.nav-section.toggleable {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  background: none; border: none; cursor: pointer;
  font: inherit; text-align: left;
  border-radius: 8px;
  padding: 5px 8px;
  transition: background .18s, color .18s;
}
.nav-section.toggleable:hover { background: rgba(255,255,255,.08); color: #c8cdf2; }
.nav-section .arrow {
  display: inline-block;
  font-size: 10px;
  transition: transform .2s ease;
}
.nav-section .arrow.open { transform: rotate(90deg); }
.nav-section .count {
  font-style: normal; font-weight: 600;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  font-size: 9.5px;
}
.layout.collapsed .nav-section .arrow { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px;
  color: #d9dcf5; font-size: 13.5px; text-decoration: none;
  transition: background .18s, color .18s;
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(109,93,246,.85), rgba(25,184,166,.75));
  color: #fff; font-weight: 600;
  border-color: rgba(255,255,255,.25);
  box-shadow: 0 6px 16px rgba(80, 70, 200, 0.4);
}
.nav-item .ico { width: 18px; text-align: center; }
.nav-empty { padding: 8px 12px; font-size: 12.5px; color: #8f96c4; font-style: italic; }

.main {
  flex: 1;
  margin-left: calc(var(--sidebar-w) + 32px);
  padding: 32px 34px 60px;
  max-width: 1120px;
  transition: margin-left .25s ease;
}

/* ---------- Tarjetas glass ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(20, 24, 60, 0.22);
}

.hero { padding: 30px 34px; margin-bottom: 24px; }
.hero h2 { font-size: 26px; margin-bottom: 6px; }
.hero p { color: var(--ink-soft); font-size: 14.5px; max-width: 68ch; }
.hero .meta { margin-top: 12px; font-size: 12px; color: var(--ink-soft); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

.card {
  padding: 22px;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 22px 52px rgba(20, 24, 60, 0.32); }
.card h3 { font-size: 16px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.card p { font-size: 13px; color: var(--ink-soft); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { padding: 18px 22px; text-align: center; }
.stat .num { font-size: 30px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }

.home-sec { color: #fff; margin: 26px 0 14px; text-shadow: 0 2px 12px rgba(0,0,0,.3); }

/* ---------- Contenido de página ---------- */
.page { padding: 30px 34px; margin-bottom: 22px; }
.page h2 { font-size: 23px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page h3.sec { font-size: 16px; margin: 26px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid rgba(109, 93, 246, .25); }
.page h3.sec.first { margin-top: 0; }
.page .desc { color: var(--ink-soft); font-size: 14px; margin-top: 6px; max-width: 75ch; }
.muted { color: #8b90b5; display: block; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  font-size: 11.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: rgba(109, 93, 246, .14); color: #4a3ecf;
  border: 1px solid rgba(109, 93, 246, .3);
}
.chip.green { background: rgba(25, 184, 166, .14); color: #0d7d70; border-color: rgba(25, 184, 166, .35); }
.chip.gray  { background: rgba(90, 96, 130, .12); color: #565d85; border-color: rgba(90, 96, 130, .25); }
.chip.link  { text-decoration: none; }
.chip.link:hover { background: rgba(109, 93, 246, .28); }

/* Tablas */
table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
th { text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--ink-soft); border-bottom: 2px solid rgba(109,93,246,.3); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(28, 33, 64, 0.09); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td code, li code, p code, .desc code, blockquote code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(109, 93, 246, .12); color: #43389f;
  padding: 2px 6px; border-radius: 6px;
}
code.mr { margin-right: 6px; }

/* Bloques de código */
pre {
  background: rgba(16, 19, 42, 0.92);
  color: #dce3ff;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  margin: 12px 0;
}
pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
td pre { margin: 0; padding: 10px 12px; font-size: 11.5px; max-width: 420px; }

/* Fases (timeline) */
.phases { list-style: none; }
.phases li {
  position: relative; padding: 10px 14px 10px 40px; margin-bottom: 6px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-border);
  border-radius: 12px; font-size: 13.5px;
}
.phases li::before {
  content: attr(data-n);
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.phases .target { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }
.phases .cond { font-size: 11.5px; color: #a2571f; }

/* Markdown renderizado */
.md h1, .md h2 { font-size: 20px; margin: 22px 0 10px; }
.md h3 { font-size: 16px; margin: 18px 0 8px; }
.md h4 { font-size: 14px; margin: 14px 0 6px; }
.md p { font-size: 13.8px; line-height: 1.7; margin: 8px 0; color: #2a2f55; }
.md ul, .md ol { margin: 8px 0 8px 22px; font-size: 13.8px; line-height: 1.7; }
.md blockquote { border-left: 4px solid var(--accent); padding: 8px 14px; margin: 10px 0;
  background: rgba(109,93,246,.08); border-radius: 0 10px 10px 0; font-size: 13.5px; }
.md hr { border: none; border-top: 1px solid rgba(28,33,64,.12); margin: 18px 0; }
.md a { color: var(--accent); }
.md table { font-size: 13px; }

/* Caja de aviso/prerrequisito */
.note {
  background: rgba(255, 178, 66, 0.16);
  border: 1px solid rgba(220, 140, 30, 0.4);
  border-left: 4px solid #dc8c1e;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #5c4413;
  margin: 10px 0;
}
.note a { color: #a35f0a; }

/* Detalles plegables */
details { margin: 10px 0; }
details summary {
  cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 10px 14px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-border);
  border-radius: 12px; user-select: none;
}
details[open] summary { border-radius: 12px 12px 0 0; }

.backlink { display: inline-block; margin-bottom: 14px; font-size: 13px; color: #fff;
  text-decoration: none; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 6px 14px; border-radius: 999px; backdrop-filter: blur(10px); }
.backlink:hover { background: rgba(255,255,255,.28); }

.footer { text-align: center; font-size: 11.5px; color: rgba(255,255,255,.75); margin-top: 30px; }
.foot-code { background: rgba(255,255,255,.15); padding: 2px 6px; border-radius: 6px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; margin: 12px; inset: auto; }
  .layout { flex-direction: column; }
  .main { margin-left: 0; padding: 16px; }
}

/* ---------- Casos de Uso: selector interactivo ---------- */
.selector { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.sel-block { display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.sel-block label { font-size: 12px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .8px; }
.sel-block select {
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
  border: 1px solid rgba(109, 93, 246, .35);
  background: rgba(255, 255, 255, .8); color: var(--ink);
  outline: none; cursor: pointer;
}
.sel-block select:focus { border-color: var(--accent); }
.usecase-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; }
.usecase { padding: 22px 26px; margin-bottom: 0; display: block; text-decoration: none; color: var(--ink);
  transition: transform .2s, box-shadow .2s; }
.usecase:hover { transform: translateY(-4px); box-shadow: 0 22px 52px rgba(20, 24, 60, 0.32); }
.usecase h3 { font-size: 16.5px; margin-bottom: 4px; }
.rec { font-size: 12.5px; color: #8a5a10; background: rgba(255, 178, 66, 0.14);
  border-radius: 10px; padding: 8px 12px; margin-top: 10px; line-height: 1.55; }
.go { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--accent); }
@media (max-width: 980px) { .usecase-list { grid-template-columns: 1fr; } }

/* ---------- Guías paso a paso ---------- */
.checklist { list-style: none; font-size: 13.8px; line-height: 2; }
.mini-link { color: var(--accent); font-size: 12.5px; text-decoration: none; }
.mini-link:hover { text-decoration: underline; }
