:root {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-color-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --code-bg: #1e293b;
  --code-text: #f1f5f9;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #0b0f19;
    --bg-card: #151d2f;
    --bg-card-subtle: #1c273e;
    --border-color: #1e293b;
    --border-color-subtle: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-light: rgba(59, 130, 246, 0.15);
    --success: #34d399;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(245, 158, 11, 0.15);
    --info: #38bdf8;
    --info-light: rgba(2, 132, 199, 0.15);
    --code-bg: #0d1322;
    --code-text: #e2e8f0;
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.6);
  }
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.65;
  padding: 1.5rem 1rem 3rem;
  display: flex;
  justify-content: center;
}

.container {
  max-width: 900px;
  width: 100%;
}

/* Encabezados y navegación superior */
header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo-badge:hover {
  opacity: 0.9;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.top-nav-link:hover {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  color: var(--text-muted);
}

.lang-current {
  font-weight: 700;
  color: var(--primary);
}

.lang-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.lang-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

/* Tarjetas */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

p {
  margin-bottom: 0.9rem;
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin-left: 1.4rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.45rem;
}

/* Alertas y avisos */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  border-left: 4px solid;
  font-size: 0.95rem;
}

.alert a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.alert a:hover {
  text-decoration: none;
}

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: var(--text-main);
}

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--text-main);
}

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--text-main);
}

/* Bloque y botón de acceso a la aplicación */
.download-action-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 1.25rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.btn-open-app,
.btn-download-bundle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.btn-open-app:hover,
.btn-download-bundle:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-open-app:active,
.btn-download-bundle:active {
  transform: translateY(0);
}

.btn-open-app svg,
.btn-download-bundle svg {
  flex-shrink: 0;
}

.download-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
  .btn-open-app,
  .btn-download-bundle {
    color: #0b0f19;
  }
  .btn-open-app:hover,
  .btn-download-bundle:hover {
    color: #0b0f19;
  }
}

/* Cuadrícula de características para el índice */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.feature-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.feature-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.feature-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Bloques de código */
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  position: relative;
}

code {
  font-family: var(--font-mono);
  background: var(--bg-card-subtle);
  color: var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.code-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.code-wrapper pre {
  margin-bottom: 0;
  padding-right: 4.5rem;
}

.btn-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-copy.copied {
  background: var(--success);
  border-color: var(--success);
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--code-bg);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  margin: 0.4rem 0 0.8rem;
}

.code-box code {
  color: var(--code-text);
  background: transparent;
  padding: 0;
  overflow-x: auto;
}

.code-box .btn-copy {
  position: static;
  flex-shrink: 0;
}

kbd {
  font-family: var(--font-mono);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color-subtle);
  border-bottom: 2px solid var(--border-color-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8em;
  color: var(--text-main);
}

/* Tablas */
.table-responsive {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--bg-card-subtle);
  font-weight: 600;
  color: var(--text-main);
}

tr:last-child td {
  border-bottom: none;
}

/* Barra de navegación entre páginas (Anterior / Índice / Siguiente) */
.page-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.nav-button {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1.15rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.nav-button:hover:not(.disabled) {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.nav-button.prev {
  text-align: left;
}

.nav-button.index {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 120px;
}

.nav-button.next {
  text-align: right;
  align-items: flex-end;
}

.nav-direction {
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
}

.nav-button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-card-subtle);
  box-shadow: none;
}

.nav-button.disabled .nav-title {
  color: var(--text-muted);
}

/* Pie de página */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

/* Responsive */
@media (max-width: 640px) {
  body {
    padding: 1rem 0.75rem 2rem;
  }
  h1 {
    font-size: 1.6rem;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .page-navigation {
    grid-template-columns: 1fr;
  }
  .nav-button.next {
    align-items: flex-start;
    text-align: left;
  }
}

