/* ==========================================================================
   AppBlocks — Opiniones de clientes (Testimonials Section)
   Estilos aislados (.ab-testimonials-*) sin modificar main.css
   ========================================================================== */

.ab-testimonials-section {
  background: var(--bg-surface-subtle, #f8fafc);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  padding: 4.5rem 0;
  overflow-x: clip;
}

.ab-testimonials-section[hidden] {
  display: none !important;
}

.ab-testimonials-header {
  max-width: 42rem;
  margin: 0 auto 2.75rem auto;
  text-align: center;
}

.ab-testimonials-header h2 {
  margin-top: 0.35rem;
  margin-bottom: 0.65rem;
  color: var(--text-primary, #0f172a);
}

.ab-testimonials-subtitle {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-muted, #64748b);
  margin: 0;
}

/* Composición equilibrada:
   Desktop: 3 tarjetas por fila (5 elementos => 3 arriba + 2 centradas abajo)
   Tablet:  2 tarjetas por fila
   Móvil:   1 tarjeta por fila */
.ab-testimonials-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.ab-testimonial-card {
  flex: 0 1 calc((100% - 2.5rem) / 3);
  max-width: calc((100% - 2.5rem) / 3);
  min-width: 0;
  box-sizing: border-box;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: var(--radius-lg, 14px);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ab-testimonial-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.ab-testimonial-top {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1;
}

.ab-testimonial-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  color: #f59e0b;
  line-height: 1;
}

.ab-testimonial-star {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.ab-testimonial-star--empty {
  color: #cbd5e1;
}

.ab-testimonial-comment {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.68;
  color: var(--text-body, #334155);
  font-weight: 400;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.ab-testimonial-app-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
  padding-top: 0.25rem;
}

.ab-testimonial-app-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  max-width: 100%;
  padding: 0.28rem 0.65rem;
  border-radius: 7px;
  background: var(--bg-surface-subtle, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  color: var(--text-primary, #0f172a);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}

.ab-testimonial-app-icon {
  width: 13px;
  height: 13px;
  color: var(--brand-blue, #2563eb);
  flex-shrink: 0;
}

.ab-testimonial-app-name {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.ab-testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  min-width: 0;
}

.ab-testimonial-avatar-wrap {
  width: 46px;
  height: 46px;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ab-testimonial-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ab-testimonial-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f7;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  user-select: none;
}

.ab-testimonial-meta {
  min-width: 0;
  flex: 1;
}

.ab-testimonial-name {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  line-height: 1.3;
  overflow-wrap: break-word;
}

.ab-testimonial-role {
  margin: 0.15rem 0 0 0;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--text-muted, #64748b);
  overflow-wrap: break-word;
}

/* Variante PDP: integrada sobre fondo blanco sin bordes externos redundantes */
.ab-testimonials-section--pdp {
  background: var(--bg-surface, #ffffff);
  border-bottom: none;
  padding: 0;
}

.ab-testimonials-section--pdp .ab-testimonials-header {
  margin-bottom: 2rem;
}

/* Ajuste inteligente en Desktop cuando hay 1 o 2 reviews */
.ab-testimonials-grid[data-count="2"] .ab-testimonial-card {
  flex: 0 1 calc((100% - 1.25rem) / 2);
  max-width: calc((100% - 1.25rem) / 2);
}

.ab-testimonials-grid[data-count="1"] .ab-testimonial-card {
  flex: 0 1 36rem;
  max-width: 36rem;
}

/* Tablet: 2 tarjetas por fila */
@media (max-width: 1024px) {
  .ab-testimonial-card,
  .ab-testimonials-grid[data-count="2"] .ab-testimonial-card {
    flex: 0 1 calc((100% - 1.25rem) / 2);
    max-width: calc((100% - 1.25rem) / 2);
  }

  .ab-testimonials-grid[data-count="1"] .ab-testimonial-card {
    flex: 0 1 36rem;
    max-width: 36rem;
  }
}

/* Móvil: 1 tarjeta por fila, comentarios completos y cero scroll horizontal */
@media (max-width: 640px) {
  .ab-testimonials-section {
    padding: 3.25rem 0;
  }

  .ab-testimonials-section--pdp {
    padding: 0;
  }

  .ab-testimonials-header {
    margin-bottom: 2rem;
  }

  .ab-testimonials-grid {
    gap: 1rem;
  }

  .ab-testimonial-card,
  .ab-testimonials-grid[data-count="2"] .ab-testimonial-card,
  .ab-testimonials-grid[data-count="1"] .ab-testimonial-card {
    flex: 1 1 100%;
    max-width: 100%;
    padding: 1.25rem;
  }

  .ab-testimonial-comment {
    font-size: 0.92rem;
    line-height: 1.65;
  }

  .ab-testimonial-avatar-wrap {
    width: 44px;
    height: 44px;
  }
}
