/*
  Identidad visual de Antheris (docs/arranque.md).
  Contrastes sobre el fondo #101010: dorado #D4AF37 ~9:1 y texto #F5F5F5 ~17:1, ambos
  aptos para texto (AA). El rojo #A51D2D tiene ~2,5:1: solo se usa como detalle
  decorativo, nunca para texto.
*/
:root,
[data-bs-theme="dark"] {
  --antheris-black: #101010;
  --antheris-surface: #1a1a1a;
  --antheris-gold: #d4af37;
  --antheris-gold-hover: #e3c45e;
  --antheris-red: #a51d2d;
  --antheris-white: #f5f5f5;

  --bs-body-bg: var(--antheris-black);
  --bs-body-color: var(--antheris-white);
  --bs-emphasis-color: #ffffff;
  /* Gris para textos secundarios: ~9:1 sobre el fondo. */
  --bs-secondary-color: #b8b8b8;
  --bs-tertiary-bg: var(--antheris-surface);
  --bs-border-color: #2e2e2e;
  --bs-link-color: var(--antheris-gold);
  --bs-link-color-rgb: 212, 175, 55;
  --bs-link-hover-color: var(--antheris-gold-hover);
  --bs-link-hover-color-rgb: 227, 196, 94;
  --bs-heading-color: var(--antheris-white);
  /* Bootstrap pinta <code> en rosa: fuera de la paleta. Se usa un gris claro. */
  --bs-code-color: #d9d9d9;
}

html {
  position: relative;
  min-height: 100%;
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 72px;
}

/* Botón principal dorado con texto negro: ~9:1. */
.btn-primary {
  --bs-btn-color: var(--antheris-black);
  --bs-btn-bg: var(--antheris-gold);
  --bs-btn-border-color: var(--antheris-gold);
  --bs-btn-hover-color: var(--antheris-black);
  --bs-btn-hover-bg: var(--antheris-gold-hover);
  --bs-btn-hover-border-color: var(--antheris-gold-hover);
  --bs-btn-active-color: var(--antheris-black);
  --bs-btn-active-bg: var(--antheris-gold-hover);
  --bs-btn-active-border-color: var(--antheris-gold-hover);
  --bs-btn-disabled-color: var(--antheris-black);
  --bs-btn-disabled-bg: var(--antheris-gold);
  --bs-btn-disabled-border-color: var(--antheris-gold);
}

.btn-outline-primary {
  --bs-btn-color: var(--antheris-gold);
  --bs-btn-border-color: var(--antheris-gold);
  --bs-btn-hover-color: var(--antheris-black);
  --bs-btn-hover-bg: var(--antheris-gold);
  --bs-btn-hover-border-color: var(--antheris-gold);
  --bs-btn-active-color: var(--antheris-black);
  --bs-btn-active-bg: var(--antheris-gold);
}

/* Foco visible y dorado en todo lo que se puede manejar con teclado. */
.btn:focus-visible,
.form-control:focus,
.form-check-input:focus,
a:focus-visible {
  outline: 2px solid var(--antheris-gold);
  outline-offset: 2px;
  box-shadow: none;
}

/* El contorno de un campo necesita contraste 3:1 con el fondo (WCAG 1.4.11): con el
   borde por defecto (#2e2e2e, ~1,4:1) no se ve dónde escribir. #767676 da ~4:1. */
.form-control,
.form-control:focus,
.form-check-input {
  background-color: var(--antheris-surface);
  border-color: #767676;
  color: var(--antheris-white);
}

.form-check-input:checked {
  background-color: var(--antheris-gold);
  border-color: var(--antheris-gold);
}

/* Marca */
.brand {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  text-decoration: none;
}

.brand-name {
  color: var(--antheris-gold);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.25em;
}

.brand-tagline {
  color: var(--antheris-white);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
}

/* El punto rojo de la identidad: solo decorativo. */
.brand-tagline::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-left: 0.6em;
  border-radius: 50%;
  background-color: var(--antheris-red);
  vertical-align: middle;
}

.site-header {
  border-bottom: 1px solid var(--bs-border-color);
}

.site-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 60px;
  white-space: nowrap;
  border-top: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
}

/* Tarjetas de video y avance */
.video-card {
  background-color: var(--antheris-surface);
  border-color: var(--bs-border-color);
  transition: border-color 0.15s ease-in-out;
}

.video-card:hover,
.video-card:focus-within {
  border-color: var(--antheris-gold);
}

.progress {
  --bs-progress-bg: #2e2e2e;
  --bs-progress-bar-bg: var(--antheris-gold);
  height: 0.5rem;
}

.module-title {
  border-left: 3px solid var(--antheris-red);
  padding-left: 0.6rem;
}

/* ---------- Componentes del rediseño (issue #17) ---------- */

.icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

.icon-gold {
  color: var(--antheris-gold);
}

/* Etiqueta pequeña en mayúsculas, como "CORPORATE LEARNING" del logo. */
.eyebrow {
  display: block;
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-title {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.panel {
  background-color: var(--antheris-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  padding: 1.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.back-link:hover {
  color: var(--antheris-gold);
}

/* Portada: anillo de avance y siguiente paso */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  background: radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.12), transparent 55%), var(--antheris-surface);
}

.hero-progress {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 10;
}

.ring-track {
  stroke: #2e2e2e;
}

.ring-value {
  stroke: var(--antheris-gold);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-out;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.ring-percent {
  font-size: 1.7rem;
  font-weight: 600;
}

.ring-percent small {
  font-size: 0.9rem;
  margin-left: 0.1rem;
  color: var(--bs-secondary-color);
}

.hero-text {
  flex: 1 1 280px;
}

.continue-button {
  display: inline-flex;
  align-items: center;
  text-align: left;
  border-radius: 0.8rem;
  box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5);
  animation: invite 2.4s ease-out 1s 2;
}

.continue-label {
  font-weight: 700;
}

.continue-title {
  font-size: 0.85rem;
  opacity: 0.85;
}

@keyframes invite {
  70% {
    box-shadow: 0 0 0 14px rgba(212, 175, 55, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
  }
}

/* Recorrido de módulos (referencia: mockup de x-kaizen) */
.module-path {
  display: grid;
  gap: 0.9rem;
}

.module-card {
  background-color: var(--antheris-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.module-card.is-current {
  border-color: var(--antheris-gold);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35), 0 0 24px rgba(212, 175, 55, 0.18);
}

.module-card summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
}

.module-card summary::-webkit-details-marker {
  display: none;
}

.module-card summary:focus-visible {
  outline: 2px solid var(--antheris-gold);
  outline-offset: -2px;
  border-radius: 0.9rem;
}

.module-step {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #4a4a4a;
  font-weight: 700;
}

.module-card.is-current .module-step {
  border-color: var(--antheris-gold);
  color: var(--antheris-gold);
}

.module-card.is-completed .module-step {
  border-color: var(--antheris-gold);
  background-color: var(--antheris-gold);
  color: var(--antheris-black);
}

.module-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.module-title-text {
  font-size: 1.05rem;
  font-weight: 600;
}

.module-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.module-card .video-list {
  padding: 0 1.25rem 1rem;
}

/* Filas de video (portada y lista lateral) */
.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.video-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
}

.video-row:hover {
  background-color: #222222;
  color: inherit;
}

.video-row.is-current {
  border-color: var(--antheris-gold);
  background-color: rgba(212, 175, 55, 0.08);
}

.video-state {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid #4a4a4a;
  color: var(--bs-secondary-color);
}

.video-state .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.video-state.is-started {
  border-color: var(--antheris-gold);
  color: var(--antheris-gold);
}

.video-state.is-done {
  border-color: var(--antheris-gold);
  background-color: var(--antheris-gold);
  color: var(--antheris-black);
}

/* Etiquetas con contraste AA sobre la superficie oscura */
.badge-done {
  background-color: var(--antheris-gold);
  color: var(--antheris-black);
}

.badge-started {
  background-color: transparent;
  border: 1px solid var(--antheris-gold);
  color: var(--antheris-gold);
}

.badge-pending {
  background-color: #2e2e2e;
  color: #d0d0d0;
}

/* Página del video */
.player-frame {
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  background-color: #000;
}

.module-aside {
  position: sticky;
  top: 1rem;
}

/* Celebración al completar (referencia: Duolingo) */
.completion {
  display: none;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: 0.9rem;
  border: 1px solid var(--antheris-gold);
  background-color: rgba(212, 175, 55, 0.1);
}

.completion.is-visible {
  display: flex;
}

.completion.is-visible:not(.is-static) {
  animation: celebrate 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.completion-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--antheris-gold);
  color: var(--antheris-black);
}

.completion.is-visible:not(.is-static) .completion-icon {
  animation: pop 0.7s ease-out 0.15s both;
}

@keyframes celebrate {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  0% {
    transform: scale(0.4);
  }

  60% {
    transform: scale(1.25);
  }

  100% {
    transform: scale(1);
  }
}

/* Panel del administrador (referencia: TalentLMS) */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.4rem;
  border-radius: 0.6rem;
  background-color: rgba(212, 175, 55, 0.12);
  color: var(--antheris-gold);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.1;
}

.stat-label {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

.nav-card {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  height: 100%;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease-in-out;
}

.nav-card:hover,
.nav-card:focus-visible {
  border-color: var(--antheris-gold);
  color: inherit;
}

/* Quien pidió menos movimiento en su sistema no ve animaciones. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* En la lista lateral se dibujan los dos íconos y se muestra uno según el estado. */
.video-state .icon-done,
.video-state.is-done .icon-pending {
  display: none;
}

.video-state.is-done .icon-done {
  display: inline;
}

/* Zona de acciones definitivas: el rojo de la marca como borde, no como texto. */
.danger-zone {
  border-color: var(--antheris-red);
}

/* La X de Bootstrap en tema oscuro debe verse sobre el aviso dorado. */
.alert-warning .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Saludo con el nombre tal como se escribe, sin mayúsculas forzadas. */
.greeting {
  color: var(--bs-secondary-color);
  font-size: 1rem;
}
