:root {
  --bg-light: linear-gradient(135deg, #0b3d91 0%, #1261a6 48%, #19a7ce 100%);
  --bg-accent: linear-gradient(180deg, #f4f9ff 0%, #eaf4ff 100%);
  --item-bg: #ffffff;
  --item-hover: #e8f4ff;
  --link: #0b4f8a;
  --shadow: 0 20px 54px rgba(17, 55, 93, .16);
  --radius-lg: 20px;
  --text-soft: #eaf7ff;
  --card-border: rgba(18, 97, 166, .16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.65;
  color: #17324d;
  background:
    radial-gradient(circle at top right, rgba(25, 167, 206, .16), transparent 28%),
    radial-gradient(circle at left center, rgba(18, 97, 166, .09), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, #eaf4ff 100%);
}

/* Layout */
.container#contenedor {
  max-width: 1100px;
  margin: 2rem auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row { display: flex; flex-wrap: wrap; }
.row > .col { flex: 1 1 100%; padding: 1rem; }
.row.align-right { justify-content: flex-end; }

#fila1 { background: var(--bg-light); }
#fila2 { background: var(--bg-accent); }
#fila3 { background: var(--bg-accent); }

/* Header */
.eyebrow {
  display: inline-block;
  margin: 0 0 .75rem 0;
  padding: .35rem .8rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255,255,255,.08);
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
h1.title {
  font-size: clamp(2rem, 6vw, 4em);
  margin: 0 0 .25em 0;
  color: #fff;
  text-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.hero-text {
  max-width: 850px;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.header-actions { text-align: right; }
.header-actions a { display: inline-block; margin: .5rem 1rem .5rem 0; }

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: .375rem;
  text-decoration: none;
  font-weight: 600;
  transition: filter .15s ease-in-out;
}
.btn:hover { filter: brightness(0.95); }
.btn-success { background: #198754; color: #fff; }

.course-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.highlight-card {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(18, 97, 166, .14);
  box-shadow: 0 10px 26px rgba(17, 55, 93, .10);
}

.highlight-label {
  display: block;
  margin-bottom: .35rem;
  color: #436b8f;
  font-size: .92rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.highlight-card strong {
  color: #0b3d63;
  font-size: 1.05rem;
}

.section-intro {
  margin-bottom: 1.25rem;
}

.section-intro h2 {
  margin: 0 0 .35rem 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #0b4f8a;
}

.section-intro p {
  margin: 0;
  color: #3b6689;
}

/* Menu list */
.list-group { box-shadow: 0 10px 28px rgba(11, 33, 55, .14); border-radius: .9rem; overflow: hidden; border: 1px solid var(--card-border); }
.list-group#menu { font-size: 1.5em; }
.list-group-item {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--item-bg);
  color: var(--link);
  text-decoration: none;
  border-top: 1px solid #d8e8f7;
  transition: background-color .2s ease, transform .2s ease, padding-left .2s ease;
}
.list-group-item:first-child { border-top: 0; }
.list-group-item:hover {
  background: var(--item-hover);
  transform: translateX(4px);
  padding-left: 1.2rem;
}

.list-group-item.is-active {
  background: linear-gradient(90deg, #d9efff 0%, #f3f9ff 100%);
  box-shadow: inset 4px 0 0 #168aad;
}


.text-center { text-align: center; }
.pagination { list-style: none; padding: 0; margin: 1rem 0; }
.pagination li { display: inline-block; margin: 0 .25rem; }
.pagination a { display: inline-block; padding: .5rem .75rem; background: #fff; border: 1px solid #ddd; border-radius: .25rem; text-decoration: none; color: inherit; }
.pagination .active a { background: #e9ecef; }

@media (min-width: 768px) {
  .row > .col { flex: 1 1 50%; }
  #fila1 > .col:first-child { flex: 1 1 70%; }
  #fila1 > .col:last-child { flex: 1 1 30%; }
  #fila2 .col, #fila3 .col { flex-basis: 100%; }
}

@media (min-width: 768px) {
  body.tema-page .row > .col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

body.tema-page {
  background: #edf6ff;
}
.tema-page .container#contenedor { padding: 1rem; }
.titulodetalle {
  background: linear-gradient(135deg, #0b3d91 0%, #1261a6 52%, #19a7ce 100%);
  border-radius: 18px;
  box-shadow: 0 20px 46px rgba(17, 55, 93, .22);
  padding: 1.25rem 1.4rem;
  margin: 1rem 0 2rem 0;
}
.titulodetalle h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: #fff;
  text-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.tema-page .titulodetalle .eyebrow { margin-bottom: .6rem; }
.tema-page .titulodetalle .hero-text {
  margin-top: .75rem;
  max-width: 900px;
}
.cuerpodetalle {
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(245, 250, 255, .98) 100%);
  border: 1px solid #d1e5f7;
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 18px 40px rgba(17, 55, 93, .10);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.cuerpodetalle p {
  margin: 0 0 1em 0;
  text-align: justify;
  text-justify: inter-word;
  color: #17324d;
  font-weight: 400;
}
.cuerpodetalle h2 {
  margin: 1.6rem 0 .6rem;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  color: #0b4f8a;
}
.cuerpodetalle section:first-of-type h2 { margin-top: 0; }
.cuerpodetalle ul { padding-left: 1.25rem; margin: 0 0 1em 0; }
.cuerpodetalle ol { padding-left: 1.25rem; margin: 0 0 1em 0; }
.cuerpodetalle li { color: #17324d; font-weight: 400; }
.cuerpodetalle a { color: #0b67b2; }
.tema-page .table {
  --bs-table-striped-bg: rgba(220, 239, 255, .62);
}
.tema-page .table thead th {
  background: #d9efff;
  color: #0b3d63;
}
.recuadro {
  background: linear-gradient(180deg, #f8fcff 0%, #edf7ff 100%);
  text-align:left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:1rem;
  padding:.75rem 1rem;
  border: 1px solid #bdd9f0;
  border-left: 4px solid #168aad;
  border-radius: 6px;
  color: #17324d;
  box-shadow: 0 8px 20px rgba(17, 55, 93, .08);
  overflow-x:auto;
  margin: .75rem 0 1.25rem 0;
  position: relative;
}

.recuadro-codigo {
  background: #fff8c7;
  border-color: #eadf8f;
  border-left-color: #d6a700;
  cursor: text;
}

.recuadro-codigo pre,
.recuadro-codigo code {
  background: transparent;
}

.recuadro-codigo pre {
  margin: 0;
  padding: 0;
}

.recuadro-codigo code {
  display: block;
  text-indent: 0;
  white-space: pre;
  min-height: 1.65em;
  outline: none;
}

.recuadro-codigo code[contenteditable="true"],
.recuadro-codigo code[contenteditable="plaintext-only"] {
  caret-color: #0b4f8a;
}

.recuadro-codigo.is-editing {
  box-shadow: 0 0 0 3px rgba(22, 138, 173, .18), 0 8px 20px rgba(17, 55, 93, .08);
}

.recuadro-codigo:hover .run-btn,
.recuadro-codigo:focus-within .run-btn {
  opacity: 1;
  transform: translateY(0);
}

.run-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: .85rem;
  color: #0b4f8a;
  background: rgba(255,255,255,.95);
  border: 1px solid #0b4f8a;
  border-radius: 999px;
  padding: .15rem .65rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  cursor: pointer;
}

.run-btn:hover,
.run-btn:focus {
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.resultado-ejecucion {
  margin-top: -.6rem;
  background: #eef8ff;
  border-color: #bdd9f0;
  border-left-color: #168aad;
  white-space: pre-wrap;
}

.recuadrooculto { display: none; }
.botonretorno { font-size: 1.1rem; margin-top: 1rem; }
.botonretorno a {
  display: inline-block;
  padding: .7rem 1.2rem;
  background: linear-gradient(135deg, #0b4f8a 0%, #168aad 100%);
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 12px 28px rgba(17, 55, 93, .24);
}
.botonretorno a:hover { filter: none; transform: translateY(-1px); }
.botonretorno a.boton-online {
  padding: .85rem 1.4rem;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 52%, #67e8f9 100%);
  border: 0;
  border-radius: 999px;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.botonretorno a.boton-online:hover {
  filter: none;
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(15, 118, 110, .35);
}
.botonretorno a.boton-online:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(15, 118, 110, .24);
}
ul li { margin-bottom: .75rem; }

/* Responsive ad placeholders similar to tema.htm */
.uno { width: 320px; height: 100px; }
@media (min-width: 500px) { .uno { width: 320px; height: 100px; } }
@media (min-width: 800px) { .uno { width: 336px; height: 280px; } }

.dos { width: 320px; height: 100px; }
@media (min-width: 500px) { .dos { width: 320px; height: 100px;} }
@media (min-width: 800px) { .dos { width: 336px; height: 280px; } }

/* Media elements */
.cuerpodetalle img, .cuerpodetalle video { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 0 6px #aaa; }
.modal { position: fixed; inset: 0; display: none; z-index: 1000; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-dialog { position: relative; max-width: 900px; width: calc(100% - 2rem); margin: 5vh auto; background: #fff; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.25); overflow: hidden; }
.modal-header, .modal-footer { padding: .75rem 1rem; background: #f6f6f6; }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1rem; max-height: 70vh; overflow: auto; }
.modal-close { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal .recuadro { margin: 0; }
.cuerpodetalle .screenshot { display:block; margin:.5rem auto 1rem; }
.cuerpodetalle code {
  background: #fff9c4;
  border-radius: .25rem;
  padding: .1em .3em;
}

pre { margin: .75rem 0 1.25rem 0; overflow-x: auto; }
pre code.hljs { display: block; padding: 1rem; border-radius: 6px; }
.recuadro pre { margin: 0; }
.recuadro pre code.hljs { padding: 0; background: transparent; }

@media (max-width: 767px) {
  .container#contenedor { margin: 1rem; }
  .list-group#menu { font-size: 1.1rem; }
  .course-highlights { grid-template-columns: 1fr 1fr; }
  .list-group-item:hover {
    transform: none;
    padding-left: 1rem;
  }
}
