/* ── Reset & variables ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #E31E2A;
  --brand-dark:  #b01520;
  --brand-light: #fef2f2;
  --bg:          #f5f5f5;
  --surface:     #ffffff;
  --surface2:    #f9fafb;
  --text:        #212121;
  --text-muted:  #6b7280;
  --border:      #e5e7eb;
  --success:     #16a34a;
  --sidebar-w:   260px;
  --logo-h:      70px;
  --logo-bg:     #555555;
}

body {
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
nav.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

/* Logo area — mismo gris que la app */
.sidebar-logo {
  background: var(--logo-bg);
  height: var(--logo-h);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 20px;
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

/* Env badge — igual que "Desarrollo" en la app */
.sidebar-env {
  padding: 8px 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.sidebar-section {
  padding: 12px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-align: center;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar a:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.sidebar a.active {
  background: var(--brand);
  color: #ffffff;
  border-left-color: var(--brand-dark);
  font-weight: 600;
}

.sidebar a .icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.sidebar a.active .icon { opacity: 1; filter: brightness(10); }
.sidebar a:hover .icon  { opacity: 1; }

/* Footer del sidebar */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Main content ────────────────────────────────────────────────── */
main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px 60px;
  min-height: 100vh;
}

/* ── Section panels ──────────────────────────────────────────────── */
.section-panel { display: none; }
.section-panel.visible { display: block; }

/* ── Section header ──────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
}

.section-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.section-icon svg { width: 26px; height: 26px; color: #fff; }

.section-meta h1  { font-size: 26px; font-weight: 700; color: var(--brand); }
.section-meta p   { color: var(--text-muted); font-size: 14px; margin-top: 4px; max-width: 600px; line-height: 1.6; }

/* ── Video card ──────────────────────────────────────────────────── */
.video-card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 20px rgba(0,0,0,.06);
  margin-bottom: 36px;
}

.video-card .vc-header {
  background: #1a1a1a;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vc-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.vc-header .dot.r { background: #ff5f57; }
.vc-header .dot.y { background: #febc2e; }
.vc-header .dot.g { background: #28c840; }
.vc-header .vc-title { color: rgba(255,255,255,.85); font-size: 13px; margin-left: 8px; }

.video-wrapper {
  position: relative;
  background: #0a0f1a;
}

.video-wrapper video {
  width: 100%;
  display: block;
  max-height: 520px;
  object-fit: contain;
}

.video-placeholder {
  width: 100%;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0a0f1a;
}

.video-placeholder .play-icon {
  width: 72px; height: 72px;
  border: 3px solid rgba(227,30,42,.4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.video-placeholder .play-icon svg { width: 30px; height: 30px; color: var(--brand); margin-left: 4px; }
.video-placeholder p { color: rgba(255,255,255,.4); font-size: 13px; text-align: center; }

/* ── Steps ───────────────────────────────────────────────────────── */
.steps-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 20px;
  padding-left: 4px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.step-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: 1px solid var(--border);
  transition: box-shadow .18s;
}

.step-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.step-body h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.step-body p  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Info boxes ──────────────────────────────────────────────────── */
.info-box {
  background: var(--brand-light);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #7f1d1d;
  margin-bottom: 24px;
  line-height: 1.6;
}

.tip-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid var(--success);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #166534;
  margin-bottom: 24px;
  line-height: 1.6;
}

.tip-box strong, .info-box strong { font-weight: 700; }

/* ── Fields reference table ──────────────────────────────────────── */
.fields-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.fields-card-header {
  background: var(--surface2);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  border-bottom: 1px solid var(--border);
}

table.fields { width: 100%; border-collapse: collapse; }
table.fields th {
  background: var(--surface2);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .5px;
}

table.fields th:last-child { border-right: none; }

table.fields td {
  padding: 11px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  vertical-align: top;
}

table.fields td:last-child { border-right: none; }
table.fields tr:last-child td { border-bottom: none; }
table.fields .badge-req {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
table.fields .badge-opt {
  display: inline-block;
  background: #f0fdf4;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  margin-left: var(--sidebar-w);
  background: #ffffff;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
  padding: 14px;
  font-size: 12px;
}

footer.no-sidebar {
  margin-left: 0;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Home header (solo index.html) ───────────────────────────────── */
.home-header {
  background: var(--logo-bg);
  height: var(--logo-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
}

.home-header img {
  height: 54px;
  width: auto;
}

/* ── Module topbar (rrhh.html y demás módulos) ───────────────────── */
.module-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--logo-h);
  background: var(--logo-bg);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 110;
  gap: 0;
}

.module-topbar img {
  height: 54px;
  width: auto;
}

.module-topbar-title {
  display: none;
}

.module-topbar-back {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: color .15s;
}

.module-topbar-back:hover { color: #ffffff; }
.module-topbar-back svg { stroke: currentColor; }

nav.sidebar { top: var(--logo-h); }

main { padding-top: calc(var(--logo-h) + 36px); }

/* ── Home / módulos grid ─────────────────────────────────────────── */
.home-main {
  padding: 48px 48px 60px;
  flex: 1;
  min-height: 100vh;
}

.home-main.no-sidebar {
  margin-left: 0;
}

.home-main h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
}

.home-main .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

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

.module-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .18s, transform .18s;
}

.module-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
}

.module-card.disabled {
  opacity: .45;
  pointer-events: none;
  cursor: default;
}

.module-card .mod-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
}

.module-card .mod-icon svg { width: 24px; height: 24px; color: #fff; }

.module-card .mod-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
}

.module-card .mod-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.module-card .mod-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
}

.mod-badge.disponible {
  background: #dcfce7;
  color: #15803d;
}

.mod-badge.proximamente {
  background: #f1f5f9;
  color: #64748b;
}
