/* ==========================================================================
   Sistema de diseño de LibroIngles.org (se carga al final en todas las páginas)
   Combina la calidez de Duolingo (Nunito, botones con relieve, redondeces)
   con la limpieza de una app de lectura (Bible.com): azul = confianza,
   naranja/dorado = progreso, mucho aire y texto cómodo.
   ========================================================================== */

:root {
  --ds-ui: 'Nunito', 'Alegreya Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ds-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --ds-blue: #1d4ed8;
  --ds-blue-dark: #1e3a8a;
  --ds-blue-soft: #eaf1ff;
  --ds-orange: #f59e0b;
  --ds-orange-dark: #b45309;
  --ds-surface: #ffffff;
  --ds-ink: #1f2937;
  --ds-muted: #5b6678;
  --ds-line: #e2e8f0;
  --ds-line-strong: #cbd5e1;
}

body.active {
  --ds-blue: #60a5fa;
  --ds-blue-dark: #2563eb;
  --ds-blue-soft: rgba(96, 165, 250, 0.14);
  --ds-orange: #fbbf24;
  --ds-orange-dark: #f59e0b;
  --ds-surface: #111c33;
  --ds-ink: #e8edf5;
  --ds-muted: #a7b4c8;
  --ds-line: rgba(148, 163, 184, 0.24);
  --ds-line-strong: rgba(148, 163, 184, 0.4);
}

/* ---------- Tipografía global ---------- */
body,
button,
input,
select,
textarea {
  font-family: var(--ds-ui);
}

.pl,
.ml,
.pg {
  font-family: var(--ds-ui);
}

/* ---------- Barra de navegación ---------- */
.header .nav .nav-opcions > li > a,
.header .nav .nav-opcions .dropdown-toggle {
  font-weight: 700;
  letter-spacing: 0.1px;
}

.texto-logo,
.texto-logo a {
  margin: 0;
  font-family: var(--ds-ui);
  font-weight: 900;
}

.header #login-link {
  border-bottom-width: 4px;
  font-weight: 800;
}

.header #login-link:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.dropdown:not(.user-menu) .dropdown-menu a,
.user-menu #user-dropdown-menu .dropdown-item {
  font-family: var(--ds-ui);
  font-weight: 700;
}

/* ---------- Botones con relieve (landing, páginas, biblioteca) ---------- */
.pl-btn,
.ml-btn,
.pg-btn {
  border-bottom-width: 4px;
  font-weight: 800;
  box-shadow: none;
}

.pl-btn:active,
.ml-btn:active,
.pg-btn:active,
.ml-chip:active,
.pl-subnav-cta:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.pl-btn-primary,
.ml-btn-primary,
.pg-btn-primary {
  border-color: var(--ds-blue-dark);
}

.pl-btn-ghost,
.ml-btn-ghost,
.pg-btn-ghost {
  border-color: var(--ds-line-strong);
  border-bottom-width: 4px;
}

.pl-btn-light {
  border-color: #cbd5e1;
}

.pl-btn-outline-light {
  border-bottom-width: 4px;
}

.ml-chip {
  border-width: 2px;
  border-bottom-width: 4px;
  font-weight: 800;
}

.ml-chip.is-active {
  border-color: var(--ds-blue-dark);
}

.pl-subnav-cta {
  border-bottom: 4px solid var(--ds-blue-dark);
  font-weight: 800;
}

/* Progreso en la biblioteca: naranja, igual que en la lectura */
.ml-progress {
  height: 12px;
}

.ml-progress span {
  position: relative;
  background: var(--ds-orange);
}

.ml-progress span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  right: 6px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.ml-progress-text {
  color: var(--ds-orange-dark);
}

body.active .ml-progress-text {
  color: var(--ds-orange);
}

/* ---------- Ventana de traducción (al tocar una frase) ---------- */
.modal .modal-content {
  padding: 16px 18px 16px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  border: 2px solid var(--ds-line-strong);
  border-bottom-width: 5px;
  border-radius: 20px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
  backdrop-filter: none;
  font-family: var(--ds-ui);
}

body.active .modal .modal-content {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border-color: var(--ds-line-strong);
}

.modal .modal-content:active {
  transform: none;
}

.modal .modal-content::before {
  display: none;
}

.modal .modal-content .meaning,
.modal .modal-content .meaning:hover,
.modal .modal-content .meaning:active,
body.active .modal .modal-content .meaning:hover {
  padding: 0;
  min-height: 0;
  display: block;
  background: transparent;
  box-shadow: none;
  transform: none;
  border: none;
  border-radius: 0;
}

/* Frase en inglés */
.modal .modal-content .meaning.definition {
  margin: 0 0 10px;
  font-family: var(--ds-serif);
  font-size: 1.02rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ds-muted);
  opacity: 1;
}

/* Traducción al español */
.modal .modal-content .meaning.example,
.modal .modal-content .meaning.example:hover {
  margin: 0;
  font-family: var(--ds-ui);
  font-size: 1.3rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.35;
  color: var(--ds-blue);
  opacity: 1;
  background: transparent;
  border: none;
  padding: 0;
}

.modal-content .pronunciation-section {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid var(--ds-line);
}

.modal-content .voice-selector {
  flex: 1;
  margin: 0;
  padding: 0;
  min-height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  transform: none;
}

.modal-content .voice-selector label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-muted);
}

.modal-content .voice-selector select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  border: 2px solid var(--ds-line-strong);
  border-bottom-width: 4px;
  border-radius: 12px;
  font-family: var(--ds-ui);
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-content .voice-selector select:focus {
  border-color: var(--ds-blue);
  box-shadow: none;
  outline: none;
}

.modal-content .pronunciation-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  margin: 0;
  background: var(--ds-blue);
  color: #fff;
  border: 2px solid var(--ds-blue-dark);
  border-bottom-width: 5px;
  border-radius: 50%;
  box-shadow: none;
  font-size: 1.2rem;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

body.active .modal-content .pronunciation-icon {
  color: #0b1220;
}

.modal-content .pronunciation-icon:hover {
  background: var(--ds-blue);
  filter: brightness(1.08);
  transform: none;
}

.modal-content .pronunciation-icon:active {
  transform: translateY(2px);
  border-bottom-width: 3px;
}

.modal-content .pronunciation-icon.speaking {
  background: var(--ds-orange);
  border-color: var(--ds-orange-dark);
  color: #1a1a1a;
}

.modal .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--ds-muted);
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal .close:hover {
  background: var(--ds-blue-soft);
  color: var(--ds-blue);
}

/* ---------- Foco visible coherente ---------- */
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #f5b301;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .modal.opening,
  .modal.closing {
    animation: none !important;
  }
}

/* Ventana de traducción en modo oscuro (pisa reglas antiguas de body.active) */
body.active .modal .modal-content .meaning.example,
body.active .modal .modal-content .meaning.example:hover {
  background: transparent;
  border: none;
  color: var(--ds-blue);
  box-shadow: none;
}

body.active .modal .modal-content .meaning.definition {
  color: var(--ds-muted);
}

body.active .modal .modal-content .voice-selector,
body.active .modal .modal-content .voice-selector:hover {
  background: transparent;
  border: none;
  box-shadow: none;
}

body.active .modal .modal-content .voice-selector label {
  color: var(--ds-muted);
}

body.active .modal .modal-content .voice-selector select,
body.active .modal .modal-content .voice-selector select:hover {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border-color: var(--ds-line-strong);
  box-shadow: none;
}

body.active .modal .modal-content .pronunciation-icon,
body.active .modal .modal-content .pronunciation-icon:hover {
  background: var(--ds-blue);
  border-color: var(--ds-blue-dark);
  color: #0b1220;
  box-shadow: none;
}

body.active .modal .modal-content .pronunciation-icon.speaking {
  background: var(--ds-orange);
  border-color: var(--ds-orange-dark);
  color: #1a1a1a;
}

/* ---------- Títulos con la tipografía del sitio ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ds-ui);
}

/* ---------- Páginas de acceso (iniciar sesión, registro, recuperar) ---------- */
body .login-container,
body .register-container,
body .forgot-container {
  border: 2px solid var(--ds-line);
  border-bottom-width: 5px;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

body .login-header h1,
body .register-header h1,
body .forgot-header h1 {
  font-family: var(--ds-ui);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ds-ink);
}

body .login-header p,
body .register-header p,
body .forgot-header p {
  font-weight: 600;
  color: var(--ds-muted);
}

body .form-group label {
  font-weight: 800;
  color: var(--ds-ink);
}

body .form-group input {
  border: 2px solid var(--ds-line-strong);
  border-bottom-width: 4px;
  border-radius: 14px;
  font-family: var(--ds-ui);
  font-weight: 600;
}

body .form-group input:focus {
  border-color: var(--ds-blue);
  box-shadow: none;
}

body .login-button,
body .register-button,
body .forgot-button {
  background: var(--ds-blue);
  color: #fff;
  border: 2px solid var(--ds-blue-dark);
  border-bottom-width: 5px;
  border-radius: 14px;
  box-shadow: none;
  font-family: var(--ds-ui);
  font-size: 1.1rem;
  font-weight: 800;
  transition: transform 0.1s ease, filter 0.15s ease;
}

body .login-button:hover:not(:disabled),
body .register-button:hover:not(:disabled),
body .forgot-button:hover:not(:disabled) {
  background: var(--ds-blue);
  filter: brightness(1.08);
  transform: none;
  box-shadow: none;
}

body .login-button:active:not(:disabled),
body .register-button:active:not(:disabled),
body .forgot-button:active:not(:disabled) {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

body .register-link,
body .forgot-link,
body .login-link {
  border: 2px solid var(--ds-line-strong);
  border-bottom-width: 4px;
  border-radius: 14px;
  font-weight: 800;
  background: var(--ds-surface);
  color: var(--ds-blue);
}

body .register-link:hover,
body .forgot-link:hover,
body .login-link:hover {
  background: var(--ds-blue-soft);
  border-color: var(--ds-blue);
}

body .back-link {
  font-weight: 800;
  color: var(--ds-blue);
}

/* Aviso de calidad de voz en el reproductor (etiqueta corta; el detalle va en el tooltip/aviso) */
.voice-quality-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  width: fit-content;
  margin: 2px 0 10px;
  padding: 3px 10px;
  border: 1.5px solid var(--ds-line-strong);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-muted);
  font-family: var(--ds-ui);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.voice-quality-hint:hover {
  border-color: var(--ds-orange);
  color: var(--ds-orange-dark);
}


/* ===== Footer del sitio ===== */
footer.footer.site-footer {
  all: unset !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  margin-top: auto !important;
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 10 !important;
  font-family: var(--ds-ui) !important;
  background: var(--ds-surface) !important;
  color: var(--ds-ink) !important;
  border-top: 3px solid var(--ds-orange) !important;
  box-shadow: none !important;
  padding: 40px 20px 20px !important;
}
body.active footer.footer.site-footer {
  background: var(--ds-surface) !important;
  color: var(--ds-ink) !important;
  border-top: 3px solid var(--ds-orange) !important;
  box-shadow: none !important;
}
footer.footer.site-footer .sf-inner {
  display: grid !important;
  grid-template-columns: 1.6fr 1fr 1.2fr;
  gap: 32px;
  max-width: 1040px;
  margin: 0 auto;
  text-align: left;
}
footer.footer.site-footer p,
body.active footer.footer.site-footer p {
  all: unset !important;
  display: block !important;
  font-family: var(--ds-ui) !important;
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
  color: var(--ds-muted) !important;
  text-shadow: none !important;
}
footer.footer.site-footer h2,
body.active footer.footer.site-footer h2 {
  font-family: var(--ds-ui) !important;
  font-size: 0.8rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--ds-ink) !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  border: 0 !important;
}
footer.footer.site-footer a,
body.active footer.footer.site-footer a {
  all: unset !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  font-family: var(--ds-ui) !important;
  color: var(--ds-muted) !important;
  filter: none !important;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease !important;
}
footer.footer.site-footer a:hover,
footer.footer.site-footer a:focus-visible,
body.active footer.footer.site-footer a:hover,
body.active footer.footer.site-footer a:focus-visible {
  color: var(--ds-blue) !important;
  transform: none !important;
  filter: none !important;
}
footer.footer.site-footer a:focus-visible {
  outline: 2px solid var(--ds-orange) !important;
  outline-offset: 3px !important;
  border-radius: 6px !important;
}
footer.footer.site-footer .sf-logo,
body.active footer.footer.site-footer .sf-logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  color: var(--ds-ink) !important;
  margin-bottom: 10px !important;
}
footer.footer.site-footer .sf-logo img { width: 36px !important; height: 36px !important; border-radius: 8px !important; }
footer.footer.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
footer.footer.site-footer .sf-links a,
body.active footer.footer.site-footer .sf-links a {
  display: inline-block !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
}
footer.footer.site-footer .social-media {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  padding: 0 !important;
  justify-content: flex-start !important;
  background: none !important;
}
footer.footer.site-footer .social-media a,
body.active footer.footer.site-footer .social-media a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 42px !important;
  height: 42px !important;
  border: 2px solid var(--ds-line-strong) !important;
  border-bottom-width: 4px !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--ds-ink) !important;
}
footer.footer.site-footer .social-media a:hover,
body.active footer.footer.site-footer .social-media a:hover {
  border-color: var(--ds-orange) !important;
  color: var(--ds-orange-dark) !important;
}
footer.footer.site-footer svg,
body.active footer.footer.site-footer svg {
  width: 22px !important;
  height: 22px !important;
  fill: currentColor !important;
  filter: none !important;
}
footer.footer.site-footer .sf-bottom {
  display: flex !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 8px 20px !important;
  max-width: 1040px;
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--ds-line);
}
footer.footer.site-footer .sf-bottom p,
body.active footer.footer.site-footer .sf-bottom p {
  font-size: 0.85rem !important;
}
@media (max-width: 760px) {
  footer.footer.site-footer { padding: 32px 16px 18px !important; }
  footer.footer.site-footer .sf-inner { grid-template-columns: 1fr; gap: 26px; }
  footer.footer.site-footer .sf-bottom { flex-direction: column; text-align: left; }
}
