/* ========== RESET & BASE ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}

body {
  background-image: url("../../../assets/img/hero-bg-light.webp");
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--gray-800);
  line-height: 1.6;
  margin: 0;
  padding-top: 70px;
  background-size: cover;

  /* Centra la imagen */
  background-position: center center;

  /* Evita que la imagen se repita */
  background-repeat: no-repeat;

  /* Fija la imagen para que no se mueva al hacer scroll */
  background-attachment: fixed;

  /* Asegura que el fondo cubra todo el viewport */
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.664);
  /* Capa blanca semitransparente */
  z-index: -1;
  pointer-events: none;
}

/* ========== PAGE WRAPPER ========== */
.page-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ========== HEADER ========== */
.site-header {
  border-radius: 20px;
  padding: 20px 28px;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(30, 58, 95, 0.15);
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -20%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(93, 185, 32, 0.281);
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  width: auto;
  height: 110px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px;
}
.header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-title {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.header-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 10px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}
.btn-outline {
  background: linear-gradient(135deg, #1e3a5f 0%, #2a5f8a 100%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.btn-outline:hover {
  background: rgba(19, 48, 71, 0.74);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* ========== TABS ========== */
.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: none;
  border-radius: 14px;
  background: #fff;
  color: #64748b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}
.tab-btn i {
  font-size: 1.15rem;
  transition: transform 0.25s ease;
}
.tab-btn:hover {
  background: #f1f5f9;
  color: #334155;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.tab-btn:hover i {
  transform: scale(1.1);
}
.tab-btn.active {
  background: linear-gradient(135deg, #1e3a5f, #2a5f8a);
  color: #fff;
  box-shadow: 0 4px 16px rgba(30, 58, 95, 0.25);
}
.tab-btn.active i {
  transform: scale(1.1);
}

/* ========== TAB PANELS ========== */
.tab-content {
  position: relative;
  min-height: 400px;
}
.tab-pane {
  display: none;
  animation: fadeUp 0.35s ease;
}
.tab-pane.active {
  display: block;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== LOADER ========== */
.tab-loader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: #94a3b8;
  font-size: 0.95rem;
}
.tab-loader.active {
  display: flex;
}
.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #2a5f8a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== SECTION HEADER ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  color: #00770a;
}
.section-header h2 {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}
.section-count {
  font-size: 0.85rem;
  color: #64748b;
  background: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.search-box {
  position: relative;
  width: 100%;
  max-width: 360px;
}
.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1rem;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.88rem;
  background: #fff;
  color: #1e293b;
  transition: all 0.2s ease;
  outline: none;
}
.search-box input:focus {
  border-color: #2a5f8a;
  box-shadow: 0 0 0 3px rgba(42, 95, 138, 0.1);
}

/* ========== CARDS GRID ========== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

/* ========== CARD ========== */
.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}
.card-media {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #f8fafc;
}
.card-media img {
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  transition: transform 0.5s ease;
  margin: 8px;
  border-radius: 8px;
  background: #fff;
}
.card-media video {
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: cover;
  transition: transform 0.5s ease;
  margin: 8px;
  border-radius: 8px;
}
.card:hover .card-media img,
.card:hover .card-media video {
  transform: scale(1.05);
}
.card-media .placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #94a3b8;
}
.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(4px);
}
.card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}
.card:hover .card-play {
  background: rgba(0, 0, 0, 0.15);
}
.card-play i {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.85);
  transition: all 0.3s ease;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.card:hover .card-play i {
  transform: scale(1.1);
  color: #fff;
}
.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-body h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body p {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #94a3b8;
}
.card-meta i {
  font-size: 0.85rem;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}
.empty-state i {
  font-size: 3.5rem;
  margin-bottom: 16px;
  color: #cbd5e1;
}
.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 0.9rem;
}

/* ========== UNITS (expandable) ========== */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unit-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.25s ease;
}
.unit-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  gap: 12px;
  user-select: none;
}
.unit-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.unit-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: #2a5f8a;
  background: #eef2ff;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.unit-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-arrow {
  font-size: 1.15rem;
  color: #94a3b8;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
.unit-card.open .unit-arrow {
  transform: rotate(180deg);
}
.unit-sessions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.unit-card.open .unit-sessions {
  max-height: 2000px;
}
.unit-sessions-inner {
  padding: 0 20px 16px;
}
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  margin-bottom: 8px;
  transition: background 0.2s ease;
}
.session-item:hover {
  background: #f1f5f9;
}
.session-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
}
.session-info {
  flex: 1;
  min-width: 0;
}
.session-info strong {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}
.session-info span {
  font-size: 0.78rem;
  color: #94a3b8;
  display: block;
}
.session-action {
  color: #94a3b8;
  font-size: 1rem;
  transition: color 0.2s ease;
}
.session-action:hover {
  color: #2a5f8a;
}
.no-sessions {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 8px 0;
  text-align: center;
}

/* ========== MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
}
.modal-container {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  animation: modalIn 0.3s ease;
  position: relative;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  color: #475569;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: rgba(0, 0, 0, 0.15);
  color: #0f172a;
  transform: scale(1.05);
}
.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: #94a3b8;
}
.modal-body {
  padding: 0;
}
.modal-body img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #f8fafc;
}
.modal-body video {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 20px 20px 0 0;
}
.modal-info {
  padding: 24px;
}
.modal-info h2 {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.modal-info .modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-info .modal-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #64748b;
  background: #f8fafc;
  padding: 4px 12px;
  border-radius: 8px;
}
.modal-info .modal-meta i {
  font-size: 0.9rem;
  color: #2a5f8a;
}
.modal-info .modal-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #475569;
}
.modal-info .modal-desc p {
  margin-bottom: 12px;
}
.modal-video-wrap {
  background: #000;
  border-radius: 20px 20px 0 0;
}
.modal-video-wrap video {
  display: block;
  max-height: 400px;
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  color: #1e293b;
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast i {
  font-size: 1.1rem;
}
.toast.success i {
  color: #16a34a;
}
.toast.error i {
  color: #dc2626;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .page-wrapper {
    padding: 16px 12px 40px;
  }
  .site-header {
    padding: 16px 20px;
    border-radius: 16px;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-right {
    width: 100%;
  }
  .btn-outline {
    width: 100%;
    justify-content: center;
  }
  .header-logo {
    width: 40px;
    height: 40px;
  }
  .header-title {
    font-size: 1.15rem;
  }
  .tabs-nav {
    gap: 6px;
    margin-bottom: 20px;
    padding: 2px;
  }
  .tab-btn {
    padding: 10px 16px;
    font-size: 0.8rem;
    gap: 8px;
  }
  .tab-btn span {
    display: none;
  }
  .tab-btn i {
    font-size: 1.25rem;
  }
  .section-header h2 {
    font-size: 1.2rem;
  }
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .modal-container {
    max-width: 100%;
    margin: 10px;
    border-radius: 16px;
  }
  .modal-info {
    padding: 18px;
  }
  .modal-info h2 {
    font-size: 1.15rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
