* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: flex;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1d4ed8 0, #020617 45%, #020617 100%);
  color: #e5e7eb;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(3, 7, 18, 0.96);
  border-right: 1px solid #1f2937;
  padding: 1.5rem 1rem;
  backdrop-filter: blur(10px);
}

.sidebar h1 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: #f9fafb;
}

.sidebar p {
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  color: #9ca3af;
}

.topic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.topic-group {
  margin-bottom: 0.6rem;
}

/* Botones generales de tópicos */
.topic-btn {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.1s;
}

.topic-btn:hover {
  background: #020617;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.3);
}

.topic-btn.active {
  background: linear-gradient(135deg, #1d4ed8, #22c1c3);
  border-color: #60a5fa;
  color: #f9fafb;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.6);
}

/* Main topic (Tema 1) */
.main-topic {
  font-weight: 600;
}

/* Subtemas dentro de Tema 1 */
.subtopic-list {
  list-style: none;
  margin-top: 0.3rem;
  margin-left: 0.25rem;
  padding-left: 0.4rem;
  border-left: 1px solid #1f2937;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
}

.subtopic-list.open {
  display: flex;
}

.subtopic-btn {
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
}

/* Main content */
.main {
  flex: 1;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header h2 {
  font-size: 1.7rem;
  margin-bottom: 0.25rem;
}

header span {
  font-size: 0.95rem;
  color: #9ca3af;
}

.content {
  background: rgba(2, 6, 23, 0.98);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.9);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

section.topic {
  display: none;
  line-height: 1.7;
  font-size: 1.08rem; /* antes 0.95rem */
  color: #d1d5db;
}

section.topic.active {
  display: block;
}

section.topic h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: #e5f0ff;
}

section.topic h4 {
  font-size: 1.2rem;
  margin: 1rem 0 0.3rem;
  color: #f9fafb;
}

section.topic h5 {
  font-size: 1.05rem;
  margin: 0.4rem 0 0.2rem;
  color: #e0f2fe;
}

section.topic p {
  margin-bottom: 0.4rem;
}

section.topic ul {
  margin-left: 1.25rem;
  margin-top: 0.25rem;
}

section.topic li {
  margin-bottom: 0.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
  margin-bottom: 0.5rem;
}

.info-box {
  border-radius: 0.9rem;
  border: 1px dashed #1d4ed8;
  background: rgba(15, 23, 42, 0.9);
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  margin: 0.45rem 0 0.65rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.card {
  border-radius: 0.9rem;
  border: 1px solid #1f2937;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 60%);
  padding: 0.8rem 0.9rem;
  font-size: 0.95rem;
}

.card h5 {
  margin-bottom: 0.3rem;
}

.ad-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.ad-table th,
.ad-table td {
  border: 1px solid #1f2937;
  padding: 0.35rem 0.55rem;
  text-align: left;
}

.ad-table th {
  background: rgba(15, 23, 42, 0.9);
  color: #bfdbfe;
}

.ad-table tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.7);
}

/* Imágenes / figuras */
.img-box {
  margin: 0.8rem 0 1rem;
  text-align: center;
}

.img-box img {
  max-width: 700px;
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  box-shadow: 0 8px 15px rgba(14, 62, 77, 0.9);
}

.img-box figcaption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.nav-bottom {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s, transform 0.05s, box-shadow 0.1s;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #22c1c3);
  color: #f9fafb;
  box-shadow: 0 2px 15px rgba(37, 99, 235, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #0891b2);
  transform: transform(0px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.8);
}

.btn-secondary {
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #374151;
}

.btn-secondary:hover {
  background: #020617;
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .topic-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .topic-btn {
    flex: 1 1 calc(50% - 0.5rem);
    font-size: 0.8rem;
  }

  .main {
    padding: 1.5rem 1rem;
  }

}

