/* ==============================================
   POST INDIVIDUAL - ESTILOS ESPECÍFICOS
   ============================================== */

/* Sección Hero - OPTIMIZADA para 1920x750px */
.post-hero {
  position: relative;
  height: 65vh; /* Aumentado de 60vh para aprovechar mejor el aspect ratio 1920x750 */
  min-height: 450px; /* Aumentado de 400px */
  max-height: 700px; /* Límite máximo para pantallas muy grandes */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 60px;
}

.post-hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center; /* Garantiza centrado óptimo */
  z-index: 1;
}

.post-hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.post-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.post-hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  color: white;
  max-width: 800px;
  padding: 0 20px;
}

.post-hero-title {
  font-size: 3rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
  line-height: 1.2;
}

.post-hero-date {
  font-size: 1.1rem;
  opacity: 0.9;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Breadcrumb personalizado para posts */
.post-breadcrumb {
  background: transparent;
  padding: 20px 0;
  margin-bottom: 0;
}

.post-breadcrumb .breadcrumb {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  padding: 12px 24px;
  margin: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.post-breadcrumb .breadcrumb-item {
  font-weight: 500;
  font-size: 0.9rem;
}

.post-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #6c757d;
  font-weight: 600;
  font-size: 1.1rem;
}

.post-breadcrumb .breadcrumb-item.active {
  color: #007bff;
  font-weight: 600;
}

/* Contenido del post */
.post-content {
  margin-bottom: 60px;
}

.post-content-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #444;
}

.post-content-text p {
  margin-bottom: 1.5rem;
}

.post-content-text h1,
.post-content-text h2,
.post-content-text h3,
.post-content-text h4,
.post-content-text h5,
.post-content-text h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #2c3e50;
  font-weight: 600;
}

.post-content-text h1 {
  font-size: 2.5rem;
  border-bottom: 3px solid #007bff;
  padding-bottom: 10px;
}

.post-content-text h2 {
  font-size: 2rem;
  color: #007bff;
}

.post-content-text h3 {
  font-size: 1.5rem;
}

.post-content-text ul,
.post-content-text ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.post-content-text li {
  margin-bottom: 0.5rem;
}

.post-content-text blockquote {
  background: #f8f9fa;
  border-left: 4px solid #007bff;
  padding: 20px 25px;
  margin: 25px 0;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  position: relative;
}

.post-content-text blockquote::before {
  content: "";
  font-size: 4rem;
  color: #007bff;
  position: absolute;
  top: -10px;
  left: 10px;
  opacity: 0.3;
}

.post-content-text img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.post-content-text a {
  color: #007bff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.post-content-text a:hover {
  color: #0056b3;
  border-bottom-color: #0056b3;
  text-decoration: none;
}

/* Video de YouTube */
.post-video {
  margin-bottom: 60px;
}

.post-video-title {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2rem;
  color: #2c3e50;
  font-weight: 600;
}

.video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* Aspect ratio 16:9 */
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  border: 3px solid #f8f9fa;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* Galería de imágenes - OPTIMIZADA para 1200x800px */
.post-images {
  margin-bottom: 60px;
}

.post-images-title {
  text-align: center;
  margin-bottom: 40px;
  font-size: 2rem;
  color: #2c3e50;
  font-weight: 600;
}

.post-images img {
  width: 100%;
  height: auto; /* Cambiado de height: 300px fijo a auto para mantener proporción */
  min-height: 270px; /* Altura mínima para consistencia visual */
  max-height: 380px; /* Altura máxima para evitar imágenes demasiado altas */
  object-fit: cover;
  object-position: center center;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.post-images img:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Ajustes específicos por cantidad de columnas para 1200x800px (aspect ratio 3:2) */

/* 1 imagen (12 columnas) - Aprovecha mejor el aspect ratio 3:2 */
.post-images .row .col-12 img {
  max-height: 480px; /* Altura que permite aprovechar el 3:2 en fullwidth */
  height: auto;
}

/* 2 imágenes (6 columnas cada una) - Ratio 3:2 optimizado */
.post-images .row .col-md-6 img {
  height: 300px; /* Altura que funciona bien con el aspect ratio 3:2 */
  max-height: 300px;
}

/* 3 imágenes o mas (4 columnas cada una) - Más compactas */
.post-images .row .col-md-4 img {
  height: 270px; /* Altura menor para columnas más estrechas pero proporcional */
  max-height: 270px;
}

/* Estilos específicos para imágenes clickeables */
.post-content-image {
  cursor: pointer !important;
  position: relative;
}

.post-content-image::before {
  content: "🔍";
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 50%;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.post-content-image:hover::before {
  opacity: 1;
}

/* Modal de imágenes */
#imageModal .modal-dialog {
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
}

#imageModal .modal-content {
  background: rgba(0, 0, 0, 0.8) !important;
  border: none !important;
  border-radius: 0 !important;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#imageModal .modal-header {
  position: absolute;
  top: 5%;
  right: 5%;
  z-index: 1060;
  border: none !important;
  padding: 0;
  background: transparent;
}

#imageModal .btn-close,
#imageModal .close {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  opacity: 0.8;
  transition: all 0.3s ease;
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

#imageModal .btn-close:hover,
#imageModal .close:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 1;
  transform: scale(1.1);
  color: white;
}

#imageModal .modal-body {
  flex: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 60px 20px 20px 20px !important;
  min-height: 0;
}

#imageModal #modalImage {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#imageModal .modal-footer {
  background: transparent !important;
  border: none !important;
  padding: 0 20px 20px 20px !important;
  flex-shrink: 0;
}

#imageModal #modalImageCaption {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-style: italic;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin: 0;
  padding: 0;
  text-align: center;
}

/* Animaciones para el modal */
#imageModal.fade .modal-dialog {
  transform: scale(0.8);
  transition: transform 0.3s ease-out;
}

#imageModal.show .modal-dialog {
  transform: scale(1);
}

/* Backdrop personalizado */
#imageModal.modal {
  background: transparent;
}

/* Loading state para imágenes del modal */
#imageModal #modalImage[src=""] {
  opacity: 0;
}

#imageModal #modalImage {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Efectos de animación para las imágenes */
.post-images .col-12,
.post-images .col-md-6,
.post-images .col-md-4 {
  animation: fadeInUp 0.8s ease-out;
}

.post-images .col-12:nth-child(1),
.post-images .col-md-6:nth-child(1),
.post-images .col-md-4:nth-child(1) {
  animation-delay: 0.1s;
}

.post-images .col-12:nth-child(2),
.post-images .col-md-6:nth-child(2),
.post-images .col-md-4:nth-child(2) {
  animation-delay: 0.2s;
}

.post-images .col-12:nth-child(3),
.post-images .col-md-6:nth-child(3),
.post-images .col-md-4:nth-child(3) {
  animation-delay: 0.3s;
}

.post-images .col-12:nth-child(4),
.post-images .col-md-6:nth-child(4),
.post-images .col-md-4:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navegación */
.post-navigation {
  text-align: center;
  margin-top: 60px;
  padding: 40px 0;
  border-radius: 20px;
}

.btn-back-to-blog {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 15px 30px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(36, 188, 181, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-back-to-blog::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-back-to-blog:hover {
  color: white;
  text-decoration: none;
  box-shadow: 0 15px 30px rgba(36, 188, 181, 0.4);
}

.btn-back-to-blog:hover::before {
  left: 100%;
}

.btn-back-to-blog i {
  transition: transform 0.3s ease;
  font-size: 1.1rem;
}

.btn-back-to-blog:hover i {
  transform: translateX(-5px);
}

/* Metadatos del post */
.post-meta {
  background: rgba(36, 188, 181, 0.05);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 30px;
  border-left: 4px solid #007bff;
}

.post-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  color: #6c757d;
  font-size: 0.9rem;
}

.post-meta-item i {
  color: #007bff;
}

/* Estados de carga */
.post-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.post-loading .spinner-border {
  width: 3rem;
  height: 3rem;
  margin-bottom: 20px;
}

.post-loading p {
  font-size: 1.1rem;
  color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
  .post-hero {
    height: 50vh;
    min-height: 300px;
    margin-bottom: 40px;
  }

  .post-hero-title {
    font-size: 2rem;
  }

  .post-hero-date {
    font-size: 1rem;
  }

  .post-content,
  .post-video,
  .post-images {
    margin-bottom: 40px;
  }

  .post-content-text {
    font-size: 1rem;
  }

  .post-content-text h1 {
    font-size: 2rem;
  }

  .post-content-text h2 {
    font-size: 1.5rem;
  }

  .post-video-title,
  .post-images-title {
    font-size: 1.5rem;
  }

  .post-images img {
    height: 250px;
  }

  .post-navigation {
    margin-top: 40px;
    padding: 30px 0;
  }

  .btn-back-to-blog {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .video-container {
    border-radius: 10px;
  }

  .video-container iframe {
    border-radius: 7px;
  }
}

@media (max-width: 576px) {
  .post-hero-title {
    font-size: 1.5rem;
  }

  .post-hero-date {
    font-size: 0.9rem;
  }

  .post-content-text {
    font-size: 0.95rem;
  }

  .post-content-text h1 {
    font-size: 1.75rem;
  }

  .post-content-text h2 {
    font-size: 1.25rem;
  }

  .post-images img {
    height: 200px;
    border-radius: 10px;
  }

  .btn-back-to-blog {
    padding: 10px 20px;
    font-size: 0.85rem;
  }

  .post-meta {
    padding: 15px;
  }

  .post-meta-item {
    margin-right: 15px;
    margin-bottom: 5px;
  }
}

/* Mejoras adicionales para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .post-images img,
  .btn-back-to-blog,
  .btn-back-to-blog i {
    transition: none;
  }

  .post-images .col-12,
  .post-images .col-md-6,
  .post-images .col-md-4 {
    animation: none;
  }
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
  .post-content-text {
    color: #e9ecef;
  }

  .post-content-text h1,
  .post-content-text h2,
  .post-content-text h3,
  .post-content-text h4,
  .post-content-text h5,
  .post-content-text h6 {
    color: #ffffff;
  }

  .post-video-title,
  .post-images-title {
    color: #ffffff;
  }

  .post-content-text blockquote {
    background: #343a40;
    color: #e9ecef;
  }

  .post-meta {
    background: rgba(36, 188, 181, 0.1);
  }
}
