/* ══════════════════════════════════════════════
 * CECA Tab Section Widget — Estilos BEM
 * Variables CSS3 del tema ceca-theme
 * ══════════════════════════════════════════════ */

/* ── Animación de entrada ── */
@keyframes cecaTabSectionFadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Bloque principal ── */
.ceca-tab-section {
  background-color: var(--ceca-white, #ffffff);
  font-family: var(--ceca-font-family, "Encode Sans Expanded", sans-serif);
}

/* ── Título global bold + thin ── */
.ceca-tab-section__global-title {
  font-size: 32px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.ceca-tab-section__global-title-bold {
  color: var(--ceca-primary, #002a4f);
  font-weight: 700;
  font-style: normal;
}

.ceca-tab-section__global-title-thin {
  color: var(--ceca-secondary, #aa004f);
  font-weight: 400;
  font-style: italic;
  margin-left: 6px;
}

.ceca-tab-section__container {
  display: flex;
  flex-direction: row;
  gap: 64px;
  padding: 64px 120px;
  width: 100%;
  margin: 0 auto;
}

/* ── Columna izquierda: Tabs ── */
.ceca-tab-section__tabs {
  flex: 0 0 35%;
  max-width: 35%;
}

.ceca-tab-section__tabs-wrapper {
  display: flex;
  flex-direction: column;
  background-color: #fff;
}

.ceca-tab-section__tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 85px;
  padding: 16px 24px;
  border: none;
  border-bottom: 1px solid var(--ceca-neutral-light, #eaeaea);
  border-left: 3px solid transparent;
  background-color: transparent !important;
  color: var(--ceca-primary, #002a4f);
  font-family: var(--ceca-font-family, "Encode Sans Expanded", sans-serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition:
    color var(--ceca-transition, 0.25s ease),
    border-left-color var(--ceca-transition, 0.25s ease),
    background-color var(--ceca-transition, 0.25s ease);
}

.ceca-tab-section__tab:hover {
  background-color: #f1f8ff !important;
  font-weight: 700;
  color: var(--ceca-primary, #002a4f);
}

.ceca-tab-section__tab:focus-visible {
  outline: var(--ceca-focus-outline, 2px solid #002a4f);
  outline-offset: var(--ceca-focus-offset, 2px);
}

.ceca-tab-section__tab--active {
  color: var(--ceca-primary, #002a4f);
  font-weight: 700;
  background-color: #f1f8ff !important;
}

.ceca-tab-section__tab-label {
  flex: 1;
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ceca-tab-section__tab-arrow {
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--ceca-secondary, #aa004f);
  transition: transform var(--ceca-transition, 0.25s ease);
}

.ceca-tab-section__tab--active .ceca-tab-section__tab-arrow {
  transform: rotate(-45deg);
}

.ceca-tab-section__tab-arrow svg {
  width: 24px;
  height: 24px;
}

/* ── Columna derecha: Contenido ── */
.ceca-tab-section__content {
  flex: 1;
  padding: 16px;
  position: relative;
  min-height: 400px;
  background-color: #ffffff;
}

.ceca-tab-section__panel {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.ceca-tab-section__panel--active {
  opacity: 1;
  height: 100%;
  visibility: visible;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: cecaTabSectionFadeUp 0.6s ease both;
}

.ceca-tab-section__panel[hidden] {
  display: none;
}

.ceca-tab-section__panel--active[hidden] {
  display: block;
}

/* ══════════════════════════════════════════════
 * Template A — Imagen/Vídeo + Texto
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tpl-a {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ceca-tab-section__media {
  width: 100%;
  overflow: hidden;
}

.ceca-tab-section__image,
.ceca-tab-section__video {
  display: block;
  width: 100%;
  aspect-ratio: 994 / 600;
  object-fit: cover;
}

.ceca-tab-section__info {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.ceca-tab-section__info-header {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ceca-tab-section__category {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ceca-cyan, #00b5dd);
}

.ceca-tab-section__title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.96px;
  color: var(--ceca-primary, #002a4f);
  margin: 0;
}

.ceca-tab-section__title-bold {
  font-weight: 700;
  color: inherit;
}

.ceca-tab-section__title-accent {
  font-weight: 400;
  font-style: italic;
  color: var(--ceca-secondary, #aa004f);
}

.ceca-tab-section__info-columns {
  flex: 1;
  display: flex;
  gap: 24px;
}

.ceca-tab-section__info-column {
  flex: 1;
  padding-top: 16px;
  border-top: 1px solid var(--ceca-border-color, #ddd);
  font-size: 20px;
  line-height: 1.6;
  color: var(--ceca-text-secondary, #676767);
}

/* ══════════════════════════════════════════════
 * Template B — Texto + Imágenes Superpuestas
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tpl-b {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ceca-tab-section__tpl-b-header {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.ceca-tab-section__tpl-b-left {
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ceca-tab-section__tpl-b-text {
  flex: 1;
  padding-top: 16px;
  border-top: 1px solid var(--ceca-border-color, #ddd);
}

.ceca-tab-section__tpl-b-text p {
  margin: 0;
  font-size: 20px;
  line-height: 1.6;
  color: var(--ceca-text-secondary, #676767);
}

.ceca-tab-section__images {
  position: relative;
  width: 100%;
  padding: 32px 96px 96px 108px;
  min-height: 300px;
}

.ceca-tab-section__main-image {
  display: block;
  width: 630px !important;
  height: 683px !important;
  border-radius: var(--ceca-radius-md, 8px);
  object-fit: cover;
}

.ceca-tab-section__floating-card {
  position: absolute;
  bottom: 0;
  right: 96px;
  width: 376px;
  height: 409px;
  box-shadow: var(
    --ceca-mega-shadow,
    0px 12px 16px rgba(36, 36, 36, 0.08),
    0px 4px 6px rgba(36, 36, 36, 0.03)
  );
  background-color: var(--ceca-secondary, #aa004f);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.ceca-tab-section__floating-card-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 32px;
}

.ceca-tab-section__floating-card-pretitle {
  color: var(--ceca-white, #fff);
  font-family: var(--ceca-font-family, "Encode Sans Expanded", sans-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.ceca-tab-section__floating-card-title {
  color: var(--ceca-white, #fff);
  font-family: var(--ceca-font-family, "Encode Sans Expanded", sans-serif);
  font-size: 35px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: -0.7px;
  margin: 0;
}

/* ══════════════════════════════════════════════
 * Template C — Grid de Iconos
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tpl-c {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.ceca-tab-section__tpl-c-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 700px;
}

.ceca-tab-section__grid-title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.96px;
  color: var(--ceca-primary, #002a4f);
  margin: 0;
}

.ceca-tab-section__grid-description {
  font-size: 20px;
  line-height: 1.6;
  color: var(--ceca-text-secondary, #676767);
  margin: 0;
}

.ceca-tab-section__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.ceca-tab-section__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.ceca-tab-section__card-icon {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.ceca-tab-section__card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ceca-primary, #002a4f);
  margin: 0;
}

.ceca-tab-section__card-text {
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ceca-text-secondary, #676767);
  margin: 0;
}

/* ══════════════════════════════════════════════
 * Template D — Grid de Iconos (Izquierda)
 * ══════════════════════════════════════════════ */

.ceca-tab-section__card-text.ceca-tab-section__rich-text {
  font-size: 18px;
}
.ceca-tab-section__card-title.ceca-tab-section__rich-text {
  font-size: 20px;
}

.ceca-tab-section__tpl-d {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.ceca-tab-section__tpl-d-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 700px;
}

.ceca-tab-section__grid--left {
  gap: 32px;
}

.ceca-tab-section__card--left {
  align-items: flex-start;
  text-align: left;
}

.ceca-tab-section__card--left .ceca-tab-section__card-title {
  font-weight: normal;
}

.ceca-tab-section__card-icon--sm {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

/* ══════════════════════════════════════════════
 * Template E — Solo Texto (Editor enriquecido)
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tpl-e {
  display: flex;
  flex-direction: column;
}

.ceca-tab-section__rich-text {
  font-size: 20px;
  line-height: 1.7;
  color: var(--ceca-text-secondary, #676767);
}

.ceca-tab-section__rich-text h2,
.ceca-tab-section__rich-text h3,
.ceca-tab-section__rich-text h4 {
  color: var(--ceca-primary, #002a4f);
  margin: 0 0 16px;
}

.ceca-tab-section__rich-text p {
  margin: 0 0 16px;
}

.ceca-tab-section__rich-text p:last-child {
  margin-bottom: 0;
}

.ceca-tab-section__rich-text ul,
.ceca-tab-section__rich-text ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.ceca-tab-section__rich-text a {
  color: var(--ceca-cyan, #00b5dd);
  text-decoration: underline;
}

.ceca-tab-section__rich-text a:hover {
  color: var(--ceca-primary, #002a4f);
}

/* ══════════════════════════════════════════════
 * Imagen con texto bajo tabs
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tabs-image {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--ceca-radius-md, 8px);
  overflow: hidden;
  margin-top: 24px;
}

.ceca-tab-section__tabs-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ceca-tab-section__tabs-image-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.ceca-tab-section__tabs-image-text {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 35px;
  line-height: 1.2;
  font-family: var(--ceca-font-family, "Encode Sans Expanded", sans-serif);
}

.ceca-tab-section__tabs-image-bold {
  font-weight: 700;
  color: #ffffff;
}

.ceca-tab-section__tabs-image-thin {
  font-weight: 200;
  color: #ffffff;
}

/* ══════════════════════════════════════════════
 * Responsive
 * ══════════════════════════════════════════════ */

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  .ceca-tab-section__container {
    flex-direction: column;
    padding: 48px 40px;
    gap: 32px;
  }

  .ceca-tab-section__global-title {
    padding: 48px 40px 0;
    font-size: 28px;
  }

  .ceca-tab-section__tabs {
    flex: none;
    max-width: 100%;
  }

  .ceca-tab-section__tabs-wrapper {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .ceca-tab-section__tab {
    min-height: auto;
    min-width: max-content;
    padding: 12px 20px;
    border-bottom: none;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .ceca-tab-section__tab--active {
    border-left-color: transparent;
    border-bottom-color: var(--ceca-primary, #002a4f);
  }

  .ceca-tab-section__tab-arrow {
    display: none;
  }

  .ceca-tab-section__content {
    min-height: auto;
  }

  .ceca-tab-section__title,
  .ceca-tab-section__grid-title {
    font-size: 32px;
  }

  .ceca-tab-section__info {
    flex-direction: column;
    gap: 24px;
  }

  .ceca-tab-section__info-header {
    flex: none;
  }

  .ceca-tab-section__tpl-b-header {
    flex-direction: column;
    gap: 24px;
  }

  .ceca-tab-section__tpl-b-left {
    flex: none;
  }

  .ceca-tab-section__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ceca-tab-section__tabs-image {
    height: 200px;
  }

  .ceca-tab-section__tabs-image-text {
    font-size: 24px;
    padding: 20px;
  }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
  .ceca-tab-section__container {
    padding: 32px 20px;
    gap: 24px;
  }

  .ceca-tab-section__global-title {
    padding: 32px 20px 0;
    font-size: 24px;
  }

  .ceca-tab-section__tab {
    padding: 10px 16px;
    font-size: 15px;
  }

  .ceca-tab-section__title,
  .ceca-tab-section__grid-title {
    font-size: 26px;
  }

  .ceca-tab-section__info-columns {
    flex-direction: column;
    gap: 16px;
  }

  .ceca-tab-section__main-image {
    width: 100%;
  }

  .ceca-tab-section__floating-card {
    position: relative;
    bottom: auto;
    right: auto;
    width: 80%;
    margin: -40px auto 0;
  }

  .ceca-tab-section__images {
    display: none;
    flex-direction: column;
    align-items: center;
  }

  .ceca-tab-section__grid {
    grid-template-columns: 1fr;
  }

  .ceca-tab-section__card-icon {
    width: 80px;
    height: 80px;
  }

  .ceca-tab-section__card-icon--sm {
    width: 40px;
    height: 40px;
  }

  .ceca-tab-section__tabs-image {
    height: 180px;
  }

  .ceca-tab-section__tabs-image-text {
    font-size: 20px;
    padding: 16px;
  }
}

/* ══════════════════════════════════════════════
 * Template F — Datos con Gráficos (Cards + Donuts SVG)
 * ══════════════════════════════════════════════ */

.ceca-tab-section__tpl-f {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  width: 100%;
  min-height: 100%;
}

/* ── Sección Cards ── */

.ceca-tab-section__tpl-f-cards {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.ceca-tab-section__data-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}

.ceca-tab-section__data-card-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 8px;
}

.ceca-tab-section__data-card-label {
  font-size: 20px;
  font-weight: 600;
  color: var(--ceca-dark, #002a4f);
  letter-spacing: 0.02em;
}

.ceca-tab-section__data-card-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  line-height: 1.1;
}

.ceca-tab-section__data-card-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--ceca-dark, #002a4f);
}

.ceca-tab-section__data-card-suffix {
  font-size: 28px;
  font-weight: 300;
  font-style: italic;
  color: var(--ceca-accent, #00a5c8);
}

/* ── Sección Gráficos Donut ── */

.ceca-tab-section__tpl-f-charts {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.ceca-tab-section__donut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 160px;
  max-width: 220px;
}

.ceca-tab-section__donut-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ceca-tab-section__donut-ring {
  width: 215px;
  height: 215px;
  display: block;
}

.ceca-tab-section__donut-fill {
  transform: rotate(-90deg);
  transform-origin: center;
  /* Animación gestionada por JS (Web Animations API) */
}

.ceca-tab-section__donut-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, 0.08);
  stroke-width: 6px;
  filter: blur(5px);
}

.ceca-tab-section__donut-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 700;
  color: var(--ceca-dark, #002a4f);
  line-height: 1;
  white-space: nowrap;
}

.ceca-tab-section__donut-percent small {
  font-size: 18px;
  font-weight: 400;
}

.ceca-tab-section__donut-label {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ceca-text-light, #5a6b7b);
  text-align: center;
  max-width: 215px;
  font-style: italic;
}

/* ── Template F tablet ── */
@media (max-width: 1024px) {
  .ceca-tab-section__tpl-f-cards,
  .ceca-tab-section__tpl-f-charts {
    gap: 32px;
  }

  .ceca-tab-section__data-card-number {
    font-size: 36px;
  }

  .ceca-tab-section__data-card-suffix {
    font-size: 24px;
  }
}

/* ── Template F mobile ── */
@media (max-width: 767px) {
  .ceca-tab-section__tpl-f-cards,
  .ceca-tab-section__tpl-f-charts {
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }

  .ceca-tab-section__data-card {
    max-width: 280px;
  }

  .ceca-tab-section__data-card-number {
    font-size: 32px;
  }

  .ceca-tab-section__data-card-suffix {
    font-size: 20px;
  }

  .ceca-tab-section__donut-ring {
    width: 180px;
    height: 180px;
  }
}
