:root {
  /* Eliminando la definición estática de la variable CSS para que use el valor dinámico del admin */
}

.epc-carousel-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
}

.epc-carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Grid mode: remove flex layout and navigation spacing */
.epc-carousel-wrapper[data-display-mode="grid"] .epc-carousel {
  display: block;
}

.epc-carousel-container {
  flex: 1;
  overflow: hidden;
}

.epc-carousel-track {
  display: flex;
  gap: 20px;
  transition: transform 0.4s ease-in-out;
}

/* Grid mode: use CSS Grid layout for proper rows and columns */
.epc-carousel-wrapper[data-display-mode="grid"] .epc-carousel-track {
  display: grid;
  grid-template-columns: repeat(var(--items-per-row, 3), 1fr);
  gap: 20px;
  transform: none !important;
  transition: none;
}

.epc-carousel-item {
  /* CORRECCIÓN: Ajuste preciso para que todos los items sean visibles sin corte */
  /* Fixed calculation to prevent last item from being cut off */
  /* For 3 items with 2 gaps (20px each = 40px total): (100% - 40px) / 3 */
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: 0;
}

/* Grid mode: items fill their grid cell completely */
.epc-carousel-wrapper[data-display-mode="grid"] .epc-carousel-item {
  flex: none;
  width: 100%;
  min-width: 0;
}

.epc-post-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.epc-post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.epc-post-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f0f0f0;
}

.epc-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.epc-post-card:hover .epc-post-image img {
  transform: scale(1.05);
}

.epc-post-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.epc-post-title {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: #1a1a1a;
}

.epc-post-excerpt {
  margin: 0 0 16px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  flex: 1;
}

.epc-post-excerpt p {
  margin: 0;
}

.epc-post-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--epc-primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: gap 0.2s ease;
}

.epc-post-link:hover {
  gap: 10px;
  color: var(--epc-primary-color);
  opacity: 0.8;
}

.epc-nav {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #333;
}

.epc-nav:hover:not(:disabled) {
  background: var(--epc-primary-color);
  border-color: var(--epc-primary-color);
  color: #fff;
  transform: scale(1.1);
}

.epc-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.epc-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.epc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.epc-dot:hover {
  background: #999;
}

.epc-dot.active {
  background: var(--epc-primary-color);
  width: 24px;
  border-radius: 5px;
}

/* Tablet - 2 elementos */
@media (max-width: 1024px) {
  .epc-carousel-item {
    /* CORRECCIÓN: Ajuste preciso para 2 items con gap de 20px */
    /* Fixed calculation for 2 items with 1 gap (20px) */
    flex: 0 0 calc((100% - 20px) / 2);
  }

  /* Grid mode: maintain configured columns on all devices */
  .epc-carousel-wrapper[data-display-mode="grid"] .epc-carousel-item {
    flex: none;
    width: 100%;
  }

  .epc-post-image {
    height: 180px;
  }
}

/* Móvil - 1 elemento */
@media (max-width: 640px) {
  .epc-carousel-item {
    flex: 0 0 100%;
  }

  /* Grid mode: maintain configured columns on all devices */
  .epc-carousel-wrapper[data-display-mode="grid"] .epc-carousel-item {
    flex: none;
    width: 100%;
  }

  .epc-carousel {
    gap: 12px;
  }

  .epc-nav {
    width: 40px;
    height: 40px;
  }

  .epc-post-image {
    height: 220px;
  }

  .epc-post-content {
    padding: 16px;
  }

  .epc-post-title {
    font-size: 16px;
  }
}
