/* ========================================
   TEMPLATES SECTION - Diseño Híbrido Mejorado
   Imágenes grandes + Estilo profesional
   ======================================== */

.templates-section {
  padding: 80px 0;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.templates-section__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Header */
.templates-section__header {
  text-align: center;
  margin-bottom: 56px;
}

.templates-section__title {
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 700;
  color: #16191f;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.templates-section__highlight {
  color: #0066c0;
}

.templates-section__subtitle {
  font-size: 1.125rem;
  color: #5f6368;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Grid */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 640px) {
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .templates-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
  }
}

/* Template Card */
.template-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.template-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  border-color: #0066c0;
}

/* Preview con Imagen */
.template-card__preview {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.template-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.template-card:hover .template-card__preview img {
  transform: scale(1.05);
}

/* Badge flotante */
.template-card__badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.template-card__badge svg {
  width: 14px;
  height: 14px;
}

/* Placeholder para card "Y 4 más" */
.template-card__preview--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f7ff 0%, #e0e7ff 100%);
}

.placeholder-content {
  text-align: center;
  color: #64748b;
}

.placeholder-content svg {
  color: #94a3b8;
  margin-bottom: 12px;
}

.placeholder-content p {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* Content */
.template-card__content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.template-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #16191f;
  margin: 0;
  letter-spacing: -0.01em;
}

.template-card__version {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

.template-card__description {
  font-size: 0.9375rem;
  color: #5f6368;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

/* Feature Tags */
.template-card__features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.feature-tag {
  display: inline-block;
  padding: 6px 12px;
  background: #f0f7ff;
  color: #0066c0;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #d5e3f7;
}

/* Button */
.template-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: #0066c0;
  color: #ffffff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-top: 8px;
  border: none;
  cursor: pointer;
}

.template-card__btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.template-card__btn:hover {
  background: #004d99;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 102, 192, 0.3);
}

.template-card__btn:hover svg {
  transform: scale(1.1);
}

/* Disabled button para card "más templates" */
.template-card__btn--disabled {
  background: #e2e8f0;
  color: #64748b;
  cursor: default;
  pointer-events: none;
}

/* Variante para última card */
.template-card--more {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
}

.template-card--more:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #94a3b8;
}

.template-card--more .template-card__badge {
  background: linear-gradient(135deg, #0066c0, #004d99);
  box-shadow: 0 4px 12px rgba(0, 102, 192, 0.4);
}

/* Responsive */
@media (max-width: 767px) {
  .templates-section {
    padding: 60px 0;
  }

  .templates-section__container {
    padding: 0 20px;
  }

  .templates-section__header {
    margin-bottom: 40px;
  }

  .templates-grid {
    gap: 24px;
  }

  .template-card__preview {
    height: 200px;
  }

  .template-card__content {
    padding: 20px;
  }

  .template-card__title {
    font-size: 1.125rem;
  }

  .template-card__description {
    font-size: 0.875rem;
  }

  .template-card__btn {
    padding: 12px 20px;
    font-size: 0.875rem;
  }
}

/* Animaciones de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.template-card {
  animation: fadeInUp 0.6s ease-out backwards;
}

.template-card:nth-child(1) { animation-delay: 0.1s; }
.template-card:nth-child(2) { animation-delay: 0.2s; }
.template-card:nth-child(3) { animation-delay: 0.3s; }
.template-card:nth-child(4) { animation-delay: 0.4s; }
.template-card:nth-child(5) { animation-delay: 0.5s; }
.template-card:nth-child(6) { animation-delay: 0.6s; }

/* Modal de imagen completa */
.template-image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.template-image-modal.active {
  display: flex;
}

.template-image-modal__content {
  max-width: 95%;
  max-height: 95vh;
  position: relative;
  animation: scaleIn 0.3s ease;
}

.template-image-modal__image {
  max-width: 100%;
  max-height: 95vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.template-image-modal__close {
  position: absolute;
  top: -40px;
  right: 0;
  background: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #16191f;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.template-image-modal__close:hover {
  background: #f1f3f5;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { 
    opacity: 0;
    transform: scale(0.9);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 767px) {
  .template-image-modal__close {
    top: 10px;
    right: 10px;
  }
}
