/* ============================================================================
 * SeptiGenesis — Academia Pública (standalone).
 * Paleta sobria SeptiGenesis: teal #00a99d/#008077 + navy #143e6b/#0d2847
 * sobre fondos claros. Contraste AA (texto blanco sobre teal oscuro). Poppins.
 * Responsive 390 (mobile) → 1440 (desktop), sin overflow horizontal.
 * ==========================================================================*/

:root {
  --ac-teal: #00a99d;
  --ac-teal-dark: #008077;
  --ac-teal-onsoft: #006b63; /* teal text on light teal-soft bg — AA (>=4.5) */
  --ac-teal-soft: #e6f7f5;
  --ac-teal-border: #9fded7;
  --ac-navy: #143e6b;
  --ac-navy-deep: #0d2847;
  --ac-bg: #f6faf9;
  --ac-surface: #ffffff;
  --ac-text: #12252e;
  --ac-text-soft: #4a5c63;
  --ac-border: #dfe8e6;
  --ac-danger: #b00020;
  --ac-radius: 14px;
  --ac-radius-sm: 10px;
  --ac-shadow: 0 6px 24px rgba(13, 40, 71, 0.08);
  --ac-shadow-sm: 0 2px 8px rgba(13, 40, 71, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ac-text);
  background: var(--ac-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ac-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.ac-skip {
  position: absolute;
  left: -999px;
}
.ac-skip:focus {
  left: 12px; top: 12px;
  z-index: 1000;
  background: var(--ac-navy-deep);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--ac-radius-sm);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.ac-header {
  background: var(--ac-surface);
  border-bottom: 1px solid var(--ac-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.ac-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ac-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ac-navy-deep);
}
.ac-brand-logo { display: block; border-radius: 8px; }
.ac-brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.ac-header-right { display: flex; align-items: center; gap: 14px; }
.ac-back {
  color: var(--ac-teal-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.ac-back:hover { text-decoration: underline; }
.ac-lang {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 6px 10px;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-surface);
  color: var(--ac-text);
  cursor: pointer;
}

/* ── Main ─────────────────────────────────────────────────────────────────── */
.ac-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.ac-hero {
  background: linear-gradient(135deg, var(--ac-navy) 0%, var(--ac-teal-dark) 100%);
  color: #fff;
  border-radius: var(--ac-radius);
  padding: 40px 28px;
  box-shadow: var(--ac-shadow);
}
.ac-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b6efe8;
  margin-bottom: 10px;
}
.ac-title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ac-subtitle {
  margin: 0;
  max-width: 640px;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  color: #e8f6f4;
}

/* ── Filtros ──────────────────────────────────────────────────────────────── */
.ac-filters { margin: 28px 0 8px; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.ac-chip {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid var(--ac-teal-border);
  border-radius: 999px;
  background: var(--ac-surface);
  color: var(--ac-teal-onsoft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ac-chip:hover { background: var(--ac-teal-soft); }
.ac-chip.is-active {
  background: var(--ac-teal-dark);
  color: #fff;
  border-color: var(--ac-teal-dark);
}

/* ── Secciones ────────────────────────────────────────────────────────────── */
.ac-section-title {
  margin: 28px 0 4px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ac-navy-deep);
}
.ac-section-hint { margin: 0 0 14px; color: var(--ac-text-soft); font-size: 0.92rem; }
.ac-status { margin: 10px 0; color: var(--ac-text-soft); font-size: 0.92rem; }

/* ── Grid de cursos ───────────────────────────────────────────────────────── */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.ac-card {
  background: var(--ac-surface);
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  overflow: hidden;
  box-shadow: var(--ac-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ac-card:hover { transform: translateY(-3px); box-shadow: var(--ac-shadow); }
.ac-card-cover {
  height: 96px;
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
  color: #fff;
}
.ac-card-cover .ac-cover-sector {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  /* Overlay oscuro suficiente para AA (texto blanco) sobre cualquier
     coverColor claro (p. ej. teal #00a99d). */
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 999px;
}
.ac-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ac-card-name { margin: 0; font-size: 1.08rem; font-weight: 600; color: var(--ac-navy-deep); }
.ac-card-desc { margin: 0; font-size: 0.9rem; color: var(--ac-text-soft); }
.ac-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--ac-text-soft);
  margin-top: 2px;
}
.ac-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}
.ac-card-price { font-weight: 700; color: var(--ac-teal-dark); font-size: 1.02rem; }
.ac-card-price.is-free { color: var(--ac-navy); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.ac-btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--ac-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: background 0.15s, opacity 0.15s;
}
.ac-btn-primary { background: var(--ac-teal-dark); color: #fff; }
.ac-btn-primary:hover { background: #006b63; }
.ac-btn-primary:disabled { opacity: 0.6; cursor: default; }
.ac-btn-block { width: 100%; }

/* ── Mis cursos ───────────────────────────────────────────────────────────── */
.ac-mine { margin-top: 40px; }
.ac-mine-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 520px; }
.ac-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-surface);
  color: var(--ac-text);
  flex: 1;
  min-width: 200px;
}
.ac-input:focus {
  outline: 2px solid var(--ac-teal);
  outline-offset: 1px;
  border-color: var(--ac-teal);
}
.ac-mine-list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.ac-mine-item {
  background: var(--ac-surface);
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--ac-shadow-sm);
}
.ac-mine-item-info { display: flex; flex-direction: column; gap: 4px; min-width: 200px; flex: 1; }
.ac-mine-item-title { font-weight: 600; color: var(--ac-navy-deep); }
.ac-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  width: fit-content;
}
.ac-badge.is-paid { background: var(--ac-teal-soft); color: var(--ac-teal-onsoft); }
.ac-badge.is-pending { background: #fff3d6; color: #8a5209; }
.ac-progress-wrap { height: 8px; border-radius: 999px; background: var(--ac-border); overflow: hidden; margin-top: 4px; }
.ac-progress-bar { height: 100%; background: var(--ac-teal); border-radius: 999px; }
.ac-empty {
  padding: 20px;
  text-align: center;
  color: var(--ac-text-soft);
  background: var(--ac-surface);
  border: 1px dashed var(--ac-border);
  border-radius: var(--ac-radius);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.ac-footer {
  border-top: 1px solid var(--ac-border);
  padding: 24px 20px;
  text-align: center;
  color: var(--ac-text-soft);
  font-size: 0.86rem;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.ac-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ac-modal[hidden] { display: none; }
.ac-modal-backdrop { position: absolute; inset: 0; background: rgba(13, 40, 71, 0.55); }
.ac-modal-card {
  position: relative;
  background: var(--ac-surface);
  border-radius: var(--ac-radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 18px 60px rgba(13, 40, 71, 0.25);
  padding: 24px;
}
.ac-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border: none;
  background: var(--ac-teal-soft);
  color: var(--ac-teal-dark);
  border-radius: 999px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.ac-modal-close:hover { background: var(--ac-teal-border); }
.ac-modal-sector {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ac-teal-onsoft);
  background: var(--ac-teal-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.ac-modal-title { margin: 4px 0 8px; font-size: 1.35rem; font-weight: 700; color: var(--ac-navy-deep); padding-right: 30px; }
.ac-modal-desc { margin: 0 0 10px; color: var(--ac-text-soft); font-size: 0.94rem; }
.ac-modal-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--ac-text-soft); margin-bottom: 12px; }
.ac-modal-meta strong { color: var(--ac-teal-dark); }

.ac-modal-lessons { border-top: 1px solid var(--ac-border); padding-top: 12px; margin-bottom: 16px; }
.ac-lesson {
  padding: 10px 0;
  border-bottom: 1px solid var(--ac-border);
}
.ac-lesson:last-child { border-bottom: none; }
.ac-lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ac-lesson-title { font-weight: 600; color: var(--ac-navy-deep); font-size: 0.96rem; }
.ac-lesson-dur { font-size: 0.8rem; color: var(--ac-text-soft); white-space: nowrap; }
.ac-lesson-summary { margin: 4px 0 0; font-size: 0.87rem; color: var(--ac-text-soft); }
.ac-lesson-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.ac-lesson-tag.is-free { background: var(--ac-teal-soft); color: var(--ac-teal-onsoft); }
.ac-lesson-tag.is-locked { background: #eef1f4; color: #586570; }
.ac-lesson-content {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--ac-text);
  background: var(--ac-teal-soft);
  padding: 8px 10px;
  border-radius: var(--ac-radius-sm);
  word-break: break-word;
}

.ac-enroll-form { display: flex; flex-direction: column; gap: 10px; }
.ac-enroll-h { margin: 0 0 2px; font-size: 1.05rem; color: var(--ac-navy-deep); }
.ac-enroll-hint, .ac-success-note { margin: 4px 0 0; font-size: 0.8rem; color: var(--ac-text-soft); }
.ac-form-error { margin: 0; color: var(--ac-danger); font-size: 0.85rem; }
.ac-enroll-success { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.ac-success-title { margin: 0; font-size: 1.2rem; color: var(--ac-teal-dark); }
.ac-success-text { margin: 0; color: var(--ac-text-soft); font-size: 0.92rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .ac-header-right { gap: 8px; }
  .ac-back { display: none; }
  .ac-hero { padding: 30px 20px; }
  .ac-grid { grid-template-columns: 1fr; }
  .ac-mine-form { flex-direction: column; }
  .ac-mine-form .ac-btn { width: 100%; }
  .ac-modal-card { padding: 20px; }
}
