/* ---- RESET Y ESTILOS GLOBALES ---- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
  --sofofa-azul-brillante: #266fe0;
  --sofofa-azul-oscuro: #184d9b;
  --sofofa-gris: #474756;
  --sofofa-blanco: #ffffff;
  --sofofa-gris-claro: #f8f9fa;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--sofofa-blanco);
  color: var(--sofofa-gris);
}

/* ---- PRELOADER VIDEO (CORREGIDO) ---- */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--sofofa-azul-oscuro);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.75s ease, visibility 0.75s ease;
  visibility: visible;
  opacity: 1;
}

#preloader-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

#site-content {
  opacity: 0;
  /* Oculto por defecto */
  transition: opacity 0.5s ease;
}

#site-content.visible {
  opacity: 1;
  /* Se hace visible cuando el preloader se va */
}

.container {
  max-width: 1100px;
  margin: auto;
  overflow: hidden;
  padding: 0 20px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--sofofa-azul-oscuro);
}

a {
  color: var(--sofofa-azul-brillante);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.section-title {
  text-align: center;
  font-size: 2.5em;
  margin-bottom: 15px;
  position: relative;
  padding-bottom: 15px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-color: var(--sofofa-azul-brillante);
  border-radius: 2px;
}

.section-subtitle {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 50px auto;
  color: var(--sofofa-gris);
  font-size: 1.1em;
}

/* ---- ANIMACIÓN DE ENTRADA ---- */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* ---- HEADER (VERSIÓN FINAL Y PULIDA) ---- */
header {
  background-color: var(--sofofa-azul-oscuro);
  color: var(--sofofa-blanco);
  padding: 15px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

#header-logo {
  max-height: 70px;
  width: auto;
}

header h1 {
  font-size: 1.8em;
  margin: 0;
  color: var(--sofofa-blanco);
  font-weight: 600;
}

/* ===== ESTILOS DEL MENÚ DE NAVEGACIÓN (PULIDOS) ===== */
#main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 35px;
}

#main-nav a {
  color: var(--sofofa-blanco);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  padding: 10px 5px;
  position: relative;
  transition: color 0.3s ease;
}

#main-nav a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--sofofa-blanco);
  transition: width 0.3s ease;
}

#main-nav a:hover {
  color: #fff;
  text-decoration: none;
}

#main-nav a:hover::after {
  width: 100%;
}

#hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  z-index: 1100;
}

/* ---- 1. HERO SECTION ---- */
#hero {
  position: relative;
  height: 65vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--sofofa-blanco);
  overflow: hidden;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  /* Fallback color */
}

.hero-video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(24, 77, 155, 0.8);
  z-index: -1;
}

.hero-content {
  max-width: 800px;
  padding: 20px;
  z-index: 1;
}

.hero-content h2 {
  font-size: 3em;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--sofofa-blanco);
}

.hero-content p {
  font-size: 1.25em;
  margin-bottom: 30px;
  color: rgba(255, 255, 255, 0.9);
}

.cta-button {
  display: inline-block;
  background: var(--sofofa-azul-brillante);
  color: var(--sofofa-blanco);
  padding: 15px 35px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.1em;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px -5px rgba(38, 111, 224, 0.6);
}

.cta-button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px -5px rgba(38, 111, 224, 0.8);
  text-decoration: none;
  background-color: #2162d2;
}

/* ---- 2. WELCOME SECTION ---- */
#welcome-section {
  padding: 80px 20px;
  background-color: var(--sofofa-blanco);
}

.welcome-main-title {
  text-align: center;
  font-size: 2.8em;
  margin-bottom: 25px;
}

.welcome-intro {
  text-align: center;
  font-size: 1.15em;
  max-width: 800px;
  margin: 0 auto 50px auto;
  line-height: 1.7;
}

.welcome-grid {
  display: flex;
  align-items: flex-start;
  gap: 50px;
}

.welcome-video-col {
  flex: 1.1;
  min-width: 320px;
}

.welcome-text-col {
  flex: 1;
  min-width: 320px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(24, 77, 155, 0.15);
}

.video-wrapper video,
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.welcome-text-col p {
  line-height: 1.8;
  margin-bottom: 20px;
}

.welcome-text-col strong {
  color: var(--sofofa-azul-oscuro);
  font-weight: 700;
}

.welcome-highlight {
  margin-top: 25px !important;
  background-color: #eef4fb;
  border-left: 4px solid var(--sofofa-azul-brillante);
  padding: 15px 20px;
  font-style: italic;
  border-radius: 0 8px 8px 0;
}

/* ---- 3. PORTFOLIO CORE ---- */
#portfolio-core {
  padding: 80px 0;
  background-color: var(--sofofa-gris-claro);
}

#filter-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 20px 50px;
}

.filter-btn {
  background-color: var(--sofofa-blanco);
  color: var(--sofofa-azul-oscuro);
  border: 2px solid #dde8f5;
  border-radius: 25px;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: var(--sofofa-azul-brillante);
  color: var(--sofofa-azul-brillante);
}

.filter-btn.active {
  background-color: var(--sofofa-azul-oscuro);
  color: white;
  border-color: var(--sofofa-azul-oscuro);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

main section h2 {
  display: none;
}

.collapsible-card {
  background: var(--sofofa-blanco);
  margin: 0 auto 20px auto;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(24, 77, 155, 0.08);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.collapsible-card:hover {
  box-shadow: 0 12px 30px rgba(24, 77, 155, 0.12);
}

.card-header {
  padding: 20px 25px;
  cursor: pointer;
  background: var(--sofofa-azul-oscuro);
  color: var(--sofofa-blanco);
  font-size: 1.3rem;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-icon {
  font-size: 1.5em;
  margin-right: 20px;
  color: var(--sofofa-blanco);
  opacity: 0.8;
}

.card-header h3 {
  color: var(--sofofa-blanco);
  font-size: 1.2rem;
  font-weight: 600;
  flex-grow: 1;
}

.card-header::after {
  content: '▼';
  font-size: 0.8em;
  transition: transform 0.4s ease;
  color: var(--sofofa-blanco);
}

.collapsible-card.expanded .card-header::after {
  transform: rotate(180deg);
}

.card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease-out, padding 0.6s ease-out;
  padding: 0 30px;
  background: var(--sofofa-blanco);
  color: var(--sofofa-gris);
  line-height: 1.7;
}

.collapsible-card.expanded .card-body {
  max-height: 1500px;
  padding: 25px 30px 30px 30px;
}

.card-body p {
  margin-bottom: 15px;
}

.card-body p strong {
  color: var(--sofofa-azul-oscuro);
  font-weight: 700;
}

.example-link-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 24px;
  font-weight: 700;
  border: 2px solid var(--sofofa-azul-brillante);
  border-radius: 25px;
  background-color: transparent;
  color: var(--sofofa-azul-brillante);
  cursor: pointer;
  transition: all 0.3s ease;
}

.example-link-btn:hover {
  background-color: var(--sofofa-azul-brillante);
  color: var(--sofofa-blanco);
  text-decoration: none;
}

.pdf-wrapper {
  width: 100%;
  height: 500px;
  overflow: hidden;
  border-radius: 8px;
}

.pdf-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- 4. METHODOLOGY & OTHER SECTIONS ---- */
#methodology,
#clients,
#impact-section,
#case-studies,
#contact-section {
  padding: 80px 20px;
}

#clients,
#case-studies,
#contact-section {
  background-color: var(--sofofa-blanco);
}

#methodology,
#impact-section {
  background-color: var(--sofofa-gris-claro);
}

/* --- Methodology --- */
.methodology-steps {
  display: flex;
  justify-content: space-around;
  gap: 30px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 50px auto 0 auto;
}

.step {
  flex-basis: 30%;
  min-width: 280px;
  text-align: center;
  padding: 20px;
}

.step-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  background-color: var(--sofofa-azul-brillante);
  color: var(--sofofa-blanco);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8em;
  font-weight: bold;
  border: 4px solid #e0e6f0;
}

.step h3 {
  font-size: 1.4em;
  margin-bottom: 10px;
}

/* --- Clients --- */
.logos-viewport {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.fade-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 15%;
  z-index: 2;
  pointer-events: none;
}

.fade-overlay.left {
  left: 0;
  background: linear-gradient(to right, var(--sofofa-blanco), transparent);
}

.fade-overlay.right {
  right: 0;
  background: linear-gradient(to left, var(--sofofa-blanco), transparent);
}

.logos-animation {
  display: flex;
  width: fit-content;
  animation: scroll-left 60s linear infinite;
}

.logos-viewport:hover .logos-animation {
  animation-play-state: paused;
}

.logos-group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 70px;
  padding: 0 35px;
}

.logo-holder {
  width: 160px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-holder img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: grayscale(100%) opacity(0.6);
}

.logo-holder img:hover {
  transform: scale(1.1);
  filter: grayscale(0%) opacity(1);
}

@keyframes scroll-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* --- Impacto --- */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* <-- CÁMBIALO DE VUELTA A 3 */
  gap: 20px;
  /* ... otras propiedades ... */
}

.impact-stat {
  text-align: center;
  flex-basis: 220px;
}

.stat-number {
  font-size: 4em;
  font-weight: 700;
  color: var(--sofofa-azul-oscuro);
  line-height: 1.1;
}

.stat-label {
  font-size: 1.15em;
  color: var(--sofofa-gris);
  margin-top: 5px;
}

/* --- Casos de Éxito --- */
.case-studies-grid {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 50px;
}

.case-study-card {
  background-color: var(--sofofa-blanco);
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(24, 77, 155, 0.1);
  overflow: hidden;
  flex-basis: 48%;
  min-width: 320px;
  max-width: 520px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.case-study-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(24, 77, 155, 0.15);
}

.case-study-image {
  height: 240px;
  overflow: hidden;
}

.case-study-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-study-header {
  padding: 20px 25px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eef2f7;
}

.case-study-header h3 {
  font-size: 1.25em;
  line-height: 1.4;
}

.case-study-header::after {
  content: '▼';
  font-size: 1em;
  color: var(--sofofa-azul-oscuro);
  transition: transform 0.4s ease;
  margin-left: 15px;
}

.case-study-card.active .case-study-header::after {
  transform: rotate(180deg);
}

.case-study-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease-out, padding 0.6s ease-out;
  padding: 0 25px;
  background-color: #fdfdff;
}

.case-study-card.active .case-study-body {
  max-height: 600px;
  padding: 10px 25px 25px 25px;
}

.case-study-body p {
  font-size: 0.95em;
  line-height: 1.7;
}

.case-study-body h4 {
  color: var(--sofofa-azul-brillante);
  margin-top: 15px;
  margin-bottom: 5px;
}

.trailer-btn {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 22px;
  font-weight: 700;
  border-radius: 25px;
  background-color: var(--sofofa-azul-brillante);
  color: var(--sofofa-blanco);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.trailer-btn:hover {
  background-color: var(--sofofa-azul-oscuro);
  transform: scale(1.05);
  text-decoration: none;
}

/* --- Contacto --- */
#contact-section {
  text-align: center;
}

.kam-grid {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 50px;
}

.kam-card {
  flex-basis: 320px;
  background-color: var(--sofofa-gris-claro);
  border-radius: 16px;
  padding: 30px;
  transition: transform 0.3s ease;
  border: 1px solid #eef2f7;
}

.kam-card:hover {
  transform: translateY(-5px);
}

.kam-photo-wrapper {
  margin-bottom: 20px;
}

.kam-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.kam-name {
  font-size: 1.5em;
  margin-bottom: 8px;
  line-height: 1.2;
  /* ← evita crecimiento vertical excesivo */
  min-height: 48px;
  /* ← asegura 2 líneas como máximo */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.kam-title {
  color: var(--sofofa-gris);
  font-size: 1em;
  margin-bottom: 20px;
  font-weight: 400;
  line-height: 1.2;
  min-height: 24px;
}

.kam-contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.kam-contact-list li {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  /* ← ícono y texto alineados */
  gap: 10px;
  /* ← separación consistente */
}

.kam-contact-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  /* mantiene todo en una línea */
}

.kam-contact-list a:hover {
  color: var(--sofofa-azul-oscuro);
}

.kam-contact-list .fas {
  color: var(--sofofa-azul-brillante);
  width: 20px;
  min-width: 20px;
  /* ← icono no colapsa */
  text-align: center;
  font-size: 1rem;
}

.office-locations {
  border-top: 1px solid #e0e6f0;
  padding-top: 40px;
  margin: 60px auto 0 auto;
  color: var(--sofofa-gris);
  max-width: 700px;
}

.office-locations p {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.office-locations .fas {
  color: var(--sofofa-azul-brillante);
}

/* ---- FOOTER ---- */
footer {
  background-color: var(--sofofa-azul-oscuro);
  color: var(--sofofa-blanco);
  padding: 50px 20px 30px;
  text-align: center;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-logo {
  max-height: 70px;
  margin-bottom: 25px;
  filter: brightness(0) invert(1);
}

.footer-mission {
  line-height: 1.7;
  font-style: italic;
  font-weight: 400;
  color: #e0e6f0;
  max-width: 750px;
  margin: 0 auto 25px auto;
}

.footer-link a {
  color: var(--sofofa-blanco);
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.5);
  padding: 8px 18px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.footer-link a:hover {
  background-color: var(--sofofa-blanco);
  color: var(--sofofa-azul-oscuro);
  text-decoration: none;
  border-color: var(--sofofa-blanco);
}

.footer-copyright {
  margin-top: 30px;
  font-size: 0.9em;
  color: #a7b7d7;
}

/* ---- MODAL ---- */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(24, 77, 155, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

#modal-content {
  position: relative;
  background-color: #2d3436;
  padding: 20px;
  border-radius: 16px;
  width: 90%;
  max-width: 1100px;
  height: 90vh;
  max-height: 850px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.4s ease;
  display: flex;
  flex-direction: column;
}

#modal-overlay.visible #modal-content {
  transform: scale(1);
}

#modal-title {
  color: var(--sofofa-blanco);
  text-align: center;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.4em;
  font-weight: 600;
  flex-shrink: 0;
}

#modal-body {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  overflow: hidden;
  background: var(--sofofa-blanco);
  border-radius: 8px;
}

#modal-body iframe,
#modal-body video,
#modal-body .pdf-wrapper {
  width: 100%;
  height: 100%;
  border: none;
}

#modal-close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 40px;
  height: 40px;
  background-color: transparent;
  color: var(--sofofa-blanco);
  border: none;
  border-radius: 50%;
  font-size: 28px;
  font-weight: normal;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  z-index: 1010;
  transition: all 0.3s ease;
}

#modal-close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  background-color: rgba(255, 255, 255, 0.1);
}

/* --- Vimeo Background Iframe --- */
.hero-video-iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;
  /* 16:9 Aspect Ratio */
  min-height: 100%;
  min-width: 100%;
  /* 16:9 Aspect Ratio */
  transform: translate(-50%, -50%);
  pointer-events: none;
  /* z-index removed to rely on container's z-index */
}

body.modal-open {
  overflow: hidden;
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
  .hero-content h2 {
    font-size: 2.5em;
  }

  .welcome-grid {
    flex-direction: column;
  }

  #main-nav {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background-color: var(--sofofa-azul-oscuro);
    z-index: 1050;
    transition: transform 0.4s ease-in-out;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
  }

  #main-nav.open {
    transform: translateX(-280px);
  }

  #main-nav ul {
    flex-direction: column;
    padding: 100px 40px 40px 40px;
    align-items: flex-start;
    gap: 15px;
  }

  #main-nav a {
    font-size: 1.2em;
    color: var(--sofofa-blanco);
  }

  #main-nav a:hover {
    background-color: transparent;
  }

  #main-nav a::after {
    display: block;
  }

  #hamburger-btn {
    display: block;
    z-index: 1100;
    position: relative;
    color: var(--sofofa-blanco);
  }
}

@media (max-width: 768px) {
  .hero-content h2 {
    font-size: 2.2em;
  }

  .hero-content p {
    font-size: 1.1em;
  }

  .section-title {
    font-size: 2.2em;
  }

  .case-studies-grid {
    flex-direction: column;
    align-items: center;
  }

  .case-study-card {
    flex-basis: 90%;
  }

  header h1 {
    font-size: 1.4em;
  }
}

/* ---- MODAL OVERLAY ---- */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 3000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#modal-overlay.visible {
  display: flex;
  opacity: 1;
}

#modal-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 85vh;
  background-color: var(--sofofa-blanco);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: var(--sofofa-azul-oscuro);
  color: var(--sofofa-blanco);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
}

#modal-close-btn:hover {
  background-color: var(--sofofa-azul-brillante);
  transform: rotate(90deg) scale(1.1);
}

#modal-title {
  position: absolute;
  top: 20px;
  left: 25px;
  color: var(--sofofa-azul-oscuro);
  font-size: 1.5em;
  margin: 0;
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  border-radius: 6px;
  max-width: calc(100% - 100px);
}

#modal-body {
  width: 100%;
  height: 100%;
  padding-top: 70px;
}

#modal-body iframe,
#modal-body video {
  width: 100%;
  height: 100%;
  border: none;
}

body.modal-open {
  overflow: hidden;
}

/* Responsive modal */
@media (max-width: 768px) {
  #modal-content {
    width: 95%;
    height: 90vh;
  }

  #modal-title {
    font-size: 1.2em;
    left: 15px;
    top: 15px;
    max-width: calc(100% - 80px);
  }

  #modal-body {
    padding-top: 60px;
  }

  #modal-close-btn {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }
}

/* --- Auth Buttons Styling --- */
.nav-auth-btn {
  padding: 8px 20px !important;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

/* Remove the underline animation from base links */
.nav-auth-btn::after {
  display: none !important;
}

.login-btn {
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--sofofa-blanco) !important;
}

.login-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff !important;
  transform: translateY(-2px);
}

.register-btn {
  background-color: var(--sofofa-azul-brillante);
  color: #fff !important;
  border: 1px solid var(--sofofa-azul-brillante);
  box-shadow: 0 4px 15px rgba(38, 111, 224, 0.3);
}

.register-btn:hover {
  background-color: var(--sofofa-blanco);
  color: var(--sofofa-azul-brillante) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(38, 111, 224, 0.4);
}

.dashboard-btn {
  background-color: rgba(38, 111, 224, 0.2);
  border: 1px solid rgba(38, 111, 224, 0.5);
  color: #fff !important;
}

.dashboard-btn:hover {
  background-color: var(--sofofa-azul-brillante);
  transform: translateY(-2px);
}

/* Responsive adjustment */
@media (max-width: 768px) {
  .auth-buttons-container {
    flex-direction: column;
    margin-left: 0 !important;
    gap: 10px;
    margin-top: 15px;
  }
}

/* ===== HEADER MEJORADO ===== */
.site-header {
  background: var(--sofofa-azul-oscuro) !important;
  /* Force solid match */
  color: var(--sofofa-blanco);
  padding: 12px 0;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .12);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: visible !important;
  /* Permitir dropdowns */
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 320px;
}

#header-logo {
  max-height: 56px;
  /* un poco más compacto */
  width: auto;
}

.site-title {
  margin: 0;
  color: var(--sofofa-blanco);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.site-title span:first-child {
  display: block;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 600;
  opacity: .95;
}

.site-title span:last-child {
  display: block;
  font-size: clamp(22px, 2.6vw, 40px);
  font-weight: 800;
}

/* NAV */
.main-nav .nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 26px;
}

.main-nav a {
  color: var(--sofofa-blanco);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  padding: 10px 6px;
  position: relative;
}

.main-nav a::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: rgba(255, 255, 255, .9);
  transition: width .25s ease;
}

.main-nav a:hover::after {
  width: 100%;
}

/* Auth buttons (sin inline style) */
.auth-buttons-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
}

/* Mobile */
@media (max-width: 992px) {
  .header-left {
    min-width: unset;
  }

  .site-title span:first-child {
    display: none;
  }

  /* deja solo “Formación Digital” si quieres */
  .site-title span:last-child {
    font-size: 22px;
  }
}

@media (max-width: 768px) {
  .site-title {
    display: none;
  }

  /* en móvil, logo + menú limpio */
}

/* ===== PROFILE DROPDOWN STYLES ===== */
.auth-dropdown-container {
  position: relative;
  margin-left: 10px;
}

#profile-menu-btn {
  background: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 45px;
  /* Circular 45x45 */
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#profile-menu-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.profile-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-pic {
  background-color: var(--sofofa-azul-brillante);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Dropdown Content */
.auth-dropdown {
  position: absolute;
  top: 60px;
  right: -10px;
  background-color: var(--sofofa-blanco);
  min-width: 220px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  z-index: 1000;
}

.auth-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 22px;
  width: 12px;
  height: 12px;
  background: var(--sofofa-azul-brillante);
  transform: rotate(45deg);
  box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.04);
}

.auth-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
}

.user-name {
  color: var(--sofofa-azul-oscuro);
  font-weight: 700;
  font-size: 0.95rem;
}

.user-role {
  color: #888;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.dropdown-divider {
  height: 1px;
  background-color: #eee;
  margin: 8px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #000000 !important;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-item i {
  width: 20px;
  text-align: center;
  color: var(--sofofa-azul-brillante);
}

.dropdown-item:hover {
  background-color: #f5f9ff;
  color: var(--sofofa-azul-oscuro);
  text-decoration: none;
}

.logout-btn {
  color: #dc3545;
}

.logout-btn i {
  color: #dc3545;
}

.logout-btn:hover {
  background-color: #fff5f5;
  color: #dc3545;
}

/* ===== Auth & Admin Container Styles ===== */
.auth-container {
  min-height: calc(100vh - 80px);
  /* Ajuste aproximado para navbar */
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  background: transparent !important;
  /* Remove gradient strip */
  flex-grow: 1;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--sofofa-blanco);
  padding: 0;
  /* Padding handled by inner sections */
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  position: relative;
}

/* Modifier for wide cards (Admin Panel Index) */
.auth-card.auth-card--wide {
  max-width: 1200px;
  /* Wider for tables */
}

.auth-card--medium {
  max-width: 1000px;
  /* Even wider for forms as requested */
}

/* Auth Header inside card (Blue strip) */
.auth-card-header {
  background-color: var(--sofofa-azul-oscuro);
  /* Darker Blue */
  border-radius: 12px;
  /* Curved borders */
  margin: 10px 10px 0 10px;
  /* Spacing from card edges if needed, or just rounded top */
  padding: 1.5rem 2rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-card-header h2 {
  margin: 0;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-card-header p {
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

.auth-card-body {
  padding: 2.5rem;
}

/* ===== Admin (mismo look & feel que Login) ===== */
.auth-card--wide {
  max-width: 980px;
  /* más ancho que el login */
  padding: 34px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(90deg, var(--sofofa-azul-brillante), var(--sofofa-azul-oscuro));
  box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
  transition: transform .2s ease, box-shadow .2s ease;
}

.admin-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .16);
  text-decoration: none;
}

.admin-alert-success {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0 18px;
  color: #065f46;
  font-weight: 600;
}

.admin-alert-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d1fae5;
  color: #059669;
  font-size: 12px;
}

.admin-table-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #eef2f7;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.admin-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 16px;
  text-align: left;
}

.admin-table tbody td {
  padding: 14px 16px;
  border-top: 1px solid #f1f5f9;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #f8f9fa;
}

.admin-usercell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.admin-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .10);
  object-fit: cover;
}

.admin-badge-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 2px #fff;
}

.admin-username {
  font-weight: 800;
  color: #0f172a;
  font-size: 14px;
}

.admin-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.admin-email {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #475569;
  font-weight: 600;
  font-size: 13px;
}

.admin-email i {
  color: #94a3b8;
  font-size: 13px;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  border: 1px solid;
}

.admin-pill i {
  font-size: 11px;
}

.admin-pill--admin {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.admin-pill--user {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.admin-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.admin-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}

.admin-icon-btn i {
  font-size: 12px;
}

.admin-icon-btn--edit {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #e0e7ff;
}

.admin-icon-btn--edit:hover {
  background: #4f46e5;
  color: #fff;
  transform: translateY(-1px);
}

.admin-icon-btn--delete {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fee2e2;
}

.admin-icon-btn--delete:hover {
  background: #dc2626;
  color: #fff;
  transform: translateY(-1px);
}

/* ===== Admin banner ===== */
.admin-banner {
  background: linear-gradient(90deg,
      var(--sofofa-azul-oscuro),
      var(--sofofa-azul-brillante));
  border-radius: 18px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.admin-banner h2 {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}

.admin-banner p {
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  margin-top: 6px;
}

.admin-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: #fff;
  color: var(--sofofa-azul-oscuro);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .18);
  transition: transform .2s ease, box-shadow .2s ease;
}

.admin-banner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .22);
  text-decoration: none;
}