/*
 * Custom CSS para mejoras de responsividad móvil
 * Tema Zentryx
 */

/* FIX CRÍTICO: Prevenir scroll horizontal en móviles */
html {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  margin: 0;
  padding: 0;
}

/* Asegurar que todos los elementos no excedan el viewport */
* {
  max-width: 100%;
}

/* Permitir que ciertos elementos tengan su tamaño natural */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* Títulos de servicios - Responsividad */
#services h4 {
  font-size: 16px;
  line-height: 1.4;
  padding: 0 10px;
}

@media (min-width: 576px) {
  #services h4 {
    font-size: 18px;
  }
}

@media (min-width: 768px) {
  #services h4 {
    font-size: 20px;
    padding: 0;
  }
}

@media (min-width: 992px) {
  #services h4 {
    font-size: 22px;
  }
}

/* Mejoras para la navegación móvil */
.menu-toggle {
  z-index: 1000;
}

#sidebar-wrapper {
  z-index: 999;
}

/* Espaciado de secciones en móvil */
.content-section {
  padding: 3rem 0;
}

@media (min-width: 768px) {
  .content-section {
    padding: 5rem 0;
  }
}

@media (min-width: 992px) {
  .content-section {
    padding: 7.5rem 0;
  }
}

/* Mejoras para el texto lead en móvil */
.lead {
  font-size: 1rem;
  line-height: 1.6;
}

@media (min-width: 576px) {
  .lead {
    font-size: 1.1rem;
  }
}

@media (min-width: 768px) {
  .lead {
    font-size: 1.25rem;
  }
}

/* Ajustes para containers en móvil - CRÍTICO */
.container,
.container-fluid {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
  max-width: 100%;
}

@media (min-width: 576px) {
  .container,
  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

@media (min-width: 768px) {
  .container,
  .container-fluid {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* Fix para rows de Bootstrap */
.row {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: 100%;
}

/* Reducir gutters en móvil */
@media (max-width: 575px) {
  .gx-4,
  .gx-lg-5 {
    --bs-gutter-x: 1rem !important;
  }
}

/* Mejoras para masthead en móviles muy pequeños */
@media (max-width: 375px) {
  .masthead {
    min-height: 40rem;
    padding-top: 6rem;
    padding-bottom: 6rem;
  }

  .bgzentryx2 {
    min-height: 40rem;
    padding-top: 6rem;
    padding-bottom: 6rem;
  }

  .masthead .logoz1 img,
  .bgzentryx2 .logoz1 img {
    width: clamp(120px, 50vw, 200px);
  }

  .btn-xl-z1,
  .btn-xl-z2 {
    font-size: 13px;
    padding: 0.8rem 1rem;
  }
}

/* Fix CRÍTICO para el iframe del mapa */
.map {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.map iframe {
  pointer-events: auto;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

@media (max-width: 767px) {
  .map iframe {
    min-height: 250px;
  }
}

/* Mejoras para los iconos de servicios en mobile */
@media (max-width: 575px) {
  .service-icon {
    margin: 0 auto 1rem;
  }

  #services .col-lg-3 {
    margin-bottom: 2rem !important;
  }
}

/* Mejora de legibilidad de frase2 */
.frase2 {
  font-size: 1rem;
  line-height: 1.6;
}

@media (min-width: 576px) {
  .frase2 {
    font-size: 1.1rem;
  }
}

@media (min-width: 768px) {
  .frase2 {
    font-size: 1.25rem;
  }
}

@media (min-width: 992px) {
  .frase2 {
    font-size: 1.5rem;
  }
}

/* Mejoras específicas para sección bgzentryx2 */
.bgzentryx2 .frase2 {
  color: white !important;
  font-weight: 400;
  margin-bottom: 2rem;
}

/* Centrado vertical mejorado para bgzentryx2 */
@media (min-width: 992px) {
  .bgzentryx2 {
    min-height: 100vh;
  }
}

@media (max-width: 991px) {
  .bgzentryx2 {
    min-height: 60vh;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

@media (max-width: 575px) {
  .bgzentryx2 {
    min-height: 50vh;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .bgzentryx2 h1 {
    font-size: 1.75rem !important;
  }

  .bgzentryx2 .frase2 {
    font-size: 0.95rem !important;
  }
}

/* Ajustes para títulos h3 de servicios */
#services h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 576px) {
  #services h3 {
    font-size: 1.4rem;
  }
}

@media (min-width: 768px) {
  #services h3 {
    font-size: 1.6rem;
  }
}

/* Ajustes para títulos h2 de servicios */
#services h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
}

@media (min-width: 576px) {
  #services h2 {
    font-size: 2.2rem;
  }
}

@media (min-width: 768px) {
  #services h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
  }
}

/* Fix para sidebar navigation */
#sidebar-wrapper {
  max-width: 250px;
  overflow-x: hidden;
}

/* Asegurar que las secciones no causen overflow */
section,
header,
footer,
.masthead,
.bgzentryx2,
.content-section {
  max-width: 100vw;
  overflow-x: hidden;
}

/* Fix específico para padding de Bootstrap en móviles */
@media (max-width: 575px) {
  .px-4 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .menu-toggle,
  .sidebar-nav a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Fix CRÍTICO: Prevenir overflow de columnas */
[class*="col-"] {
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  max-width: 100%;
}

/* Asegurar que imágenes no causen overflow */
.logoz1 img,
.service-icon,
img {
  max-width: 100%;
  height: auto;
}

/* Fix para evitar scroll horizontal en mobile */
@media (max-width: 575px) {
  body,
  html {
    max-width: 100vw;
    overflow-x: hidden !important;
  }

  /* Reducir padding de elementos px-4 */
  .px-4,
  .px-lg-5 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Asegurar que container no exceda viewport */
  .container {
    max-width: 100% !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* Corrección adicional para pantallas muy pequeñas */
@media (max-width: 360px) {
  .container,
  .px-4,
  .px-lg-5 {
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
  }

  .row {
    --bs-gutter-x: 0.5rem !important;
  }
}

/* Estilos para SweetAlert2 en móviles */
.swal-popup-mobile {
  font-size: 14px !important;
}

@media (max-width: 575px) {
  .swal2-popup {
    width: 95% !important;
    padding: 1rem !important;
  }

  .swal2-html-container {
    font-size: 13px !important;
    line-height: 1.5;
  }

  .swal2-html-container .iconotam {
    height: 5rem !important;
    width: 5rem !important;
    line-height: 5.5rem !important;
    font-size: 3rem !important;
  }

  .swal2-html-container h4 {
    font-size: 18px !important;
  }

  .swal2-html-container ul.list-group {
    font-size: 12px !important;
  }

  .swal2-title {
    font-size: 20px !important;
  }

  .swal2-confirm {
    font-size: 14px !important;
    padding: 0.5rem 1.5rem !important;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .swal2-popup {
    width: 85% !important;
  }

  .swal2-html-container {
    font-size: 14px !important;
  }
}

/* Asegurar que los iconos de servicios no disparen scroll */
.service-icon {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Prevenir cualquier comportamiento de scroll */
  scroll-behavior: auto !important;
}

/* Smooth scroll behavior global */
html {
  scroll-behavior: smooth;
}

/* SweetAlert2 - Configuración básica */

/* ========================================
   PORTAFOLIO ZENTRYX - Sección Personalizada
   Diseño UX/UI responsive con hover-zoom
   ======================================== */

/* Sección principal - Fondo blanco */
.portazentryx {
  background-color: #ffffff;
  padding: 4rem 0;
}

@media (min-width: 768px) {
  .portazentryx {
    padding: 6rem 0;
  }
}

@media (min-width: 992px) {
  .portazentryx {
    padding: 8rem 0;
  }
}

/* Títulos de la sección */
.portazentryx .content-section-heading h3 {
  color: #6c757d;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

.portazentryx .content-section-heading h2 {
  color: #1a1a1a;
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

@media (min-width: 768px) {
  .portazentryx .content-section-heading h2 {
    font-size: 2.5rem;
  }
}

@media (min-width: 992px) {
  .portazentryx .content-section-heading h2 {
    font-size: 3rem;
  }
}

/* Portfolio Card Container */
.portfolio-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  height: 100%;
  background-color: #000;
}

.portfolio-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(-5px);
}

/* Wrapper de imagen con aspect ratio */
.portfolio-img-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  background-color: #f8f9fa;
}

@media (min-width: 576px) {
  .portfolio-img-wrapper {
    height: 250px;
  }
}

@media (min-width: 768px) {
  .portfolio-img-wrapper {
    height: 280px;
  }
}

@media (min-width: 992px) {
  .portfolio-img-wrapper {
    height: 300px;
  }
}

/* Imagen - Efecto Hover-Zoom Básico */
.hover-zoom-basic .portfolio-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.hover-zoom-basic:hover .portfolio-img-wrapper img {
  transform: scale(1.1);
}

/* Overlay con gradiente para legibilidad */
.portfolio-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  color: #ffffff;
  padding: 1.5rem 1.25rem 1rem;
  transition: all 0.3s ease;
  z-index: 2;
}

.hover-zoom-basic:hover .portfolio-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(0, 0, 0, 0.1) 100%
  );
  padding-bottom: 1.25rem;
}

/* Título del proyecto */
.portfolio-overlay h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: #ffffff;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.3;
  transition: all 0.3s ease;
}

@media (min-width: 576px) {
  .portfolio-overlay h4 {
    font-size: 1.15rem;
  }
}

@media (min-width: 992px) {
  .portfolio-overlay h4 {
    font-size: 1.25rem;
  }
}

.hover-zoom-basic:hover .portfolio-overlay h4 {
  transform: translateY(-3px);
  color: #ffffff;
}

/* Descripción del proyecto */
.portfolio-overlay p {
  font-size: 0.85rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  opacity: 0.95;
  transition: all 0.3s ease;
}

@media (min-width: 576px) {
  .portfolio-overlay p {
    font-size: 0.875rem;
  }
}

@media (min-width: 992px) {
  .portfolio-overlay p {
    font-size: 0.9rem;
  }
}

.hover-zoom-basic:hover .portfolio-overlay p {
  opacity: 1;
  color: #ffffff;
}

/* Espaciado entre cards en mobile */
@media (max-width: 575px) {
  .portazentryx .row > [class*='col-'] {
    margin-bottom: 1.5rem;
  }

  .portazentryx .row > [class*='col-']:last-child {
    margin-bottom: 0;
  }
}

/* Animación de entrada sutil (opcional) */
.portfolio-card {
  animation: fadeInUp 0.6s ease-out;
}

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

/* Delay escalonado para cada card (efecto cascada) */
.portazentryx .col-12:nth-child(1) .portfolio-card { animation-delay: 0.05s; }
.portazentryx .col-12:nth-child(2) .portfolio-card { animation-delay: 0.1s; }
.portazentryx .col-12:nth-child(3) .portfolio-card { animation-delay: 0.15s; }
.portazentryx .col-12:nth-child(4) .portfolio-card { animation-delay: 0.2s; }
.portazentryx .col-12:nth-child(5) .portfolio-card { animation-delay: 0.25s; }
.portazentryx .col-12:nth-child(6) .portfolio-card { animation-delay: 0.3s; }
.portazentryx .col-12:nth-child(7) .portfolio-card { animation-delay: 0.35s; }
.portazentryx .col-12:nth-child(8) .portfolio-card { animation-delay: 0.4s; }

/* Accesibilidad - Focus states */
.portfolio-card:focus-within {
  outline: 3px solid #007bff;
  outline-offset: 3px;
}

/* Mejora para touch devices */
@media (hover: none) and (pointer: coarse) {
  .portfolio-card {
    /* En dispositivos touch, mostrar overlay siempre visible */
  }

  .portfolio-overlay {
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.9) 0%,
      rgba(0, 0, 0, 0.6) 50%,
      rgba(0, 0, 0, 0) 100%
    );
  }
}

/* Fix para evitar que las imágenes causen layout shift */
.portfolio-img-wrapper img {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Asegurar que la grid no cause overflow */
.portazentryx .row {
  margin-left: -0.75rem !important;
  margin-right: -0.75rem !important;
}

.portazentryx [class*='col-'] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

@media (min-width: 992px) {
  .portazentryx .row {
    margin-left: -1.5rem !important;
    margin-right: -1.5rem !important;
  }

  .portazentryx [class*='col-'] {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* ========================================
   PORTFOLIO LIGHTBOX MODAL
   ======================================== */

/* Modal Content - Fondo oscuro profesional */
.portfolio-modal-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: none;
  border-radius: 1rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Modal Header - Título y botón cerrar */
.portfolio-modal-header {
  background: linear-gradient(90deg, #1D809F 0%, #0f4c5c 100%);
  border-bottom: 2px solid rgba(29, 128, 159, 0.3);
  padding: 1.5rem 2rem;
  position: relative;
}

.portfolio-modal-header .modal-title {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Source Sans Pro', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0;
}

@media (min-width: 768px) {
  .portfolio-modal-header .modal-title {
    font-size: 1.75rem;
  }
}

@media (min-width: 992px) {
  .portfolio-modal-header .modal-title {
    font-size: 2rem;
  }
}

.portfolio-modal-header .btn-close {
  opacity: 1;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.portfolio-modal-header .btn-close:hover {
  transform: rotate(90deg) scale(1.1);
  opacity: 0.8;
}

/* Modal Body - Contenedor de imagen y descripción */
.portfolio-modal-body {
  background-color: #1a1a2e;
  padding: 2rem;
  text-align: center;
}

@media (min-width: 768px) {
  .portfolio-modal-body {
    padding: 2.5rem 3rem;
  }
}

@media (min-width: 992px) {
  .portfolio-modal-body {
    padding: 3rem 4rem;
  }
}

/* Imagen del proyecto - Con sombra y border radius */
.portfolio-modal-img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(29, 128, 159, 0.2);
  transition: transform 0.3s ease;
  max-height: 70vh;
  object-fit: contain;
  background-color: #0f0f1e;
}

.portfolio-modal-img:hover {
  transform: scale(1.02);
}

/* Descripción del proyecto */
.portfolio-modal-description {
  color: #e0e0e0;
  font-size: 1rem;
  line-height: 1.7;
  text-align: left;
  font-family: 'Source Sans Pro', sans-serif;
  margin-top: 2rem !important;
  padding: 1.5rem;
  background: rgba(29, 128, 159, 0.05);
  border-left: 4px solid #1D809F;
  border-radius: 0.5rem;
}

@media (min-width: 768px) {
  .portfolio-modal-description {
    font-size: 1.1rem;
    padding: 2rem;
  }
}

@media (min-width: 992px) {
  .portfolio-modal-description {
    font-size: 1.15rem;
  }
}

/* Modal Dialog - Tamaño y centrado */
.modal-dialog.modal-xl {
  max-width: 1200px;
  margin: 1.75rem auto;
}

@media (max-width: 575px) {
  .modal-dialog.modal-xl {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .portfolio-modal-body {
    padding: 1.5rem 1rem;
  }

  .portfolio-modal-description {
    font-size: 0.95rem;
    padding: 1rem;
  }
}

/* Animación de entrada del modal */
.modal.fade .modal-dialog {
  transform: scale(0.8) translateY(-50px);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Backdrop oscuro */
.modal-backdrop.show {
  opacity: 0.85;
  background-color: #000000;
}

/* Cursor pointer en las cards para indicar que son clickeables */
.portfolio-card[data-bs-toggle="modal"] {
  cursor: pointer;
}

.portfolio-card[data-bs-toggle="modal"]:hover {
  transform: translateY(-8px);
}

/* Accesibilidad - Focus state */
.portfolio-card[data-bs-toggle="modal"]:focus {
  outline: 3px solid #1D809F;
  outline-offset: 3px;
}

/* Scrollbar personalizado para el modal en navegadores webkit */
.portfolio-modal-body::-webkit-scrollbar {
  width: 8px;
}

.portfolio-modal-body::-webkit-scrollbar-track {
  background: #0f0f1e;
  border-radius: 10px;
}

.portfolio-modal-body::-webkit-scrollbar-thumb {
  background: #1D809F;
  border-radius: 10px;
  transition: background 0.3s ease;
}

.portfolio-modal-body::-webkit-scrollbar-thumb:hover {
  background: #2a9fc0;
}
