/* ------------------ ESTILOS BASE ------------------ */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0056b3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animation Classes */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.animate-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  animation: fadeIn 1.5s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-text {
  animation: slideInUp 1s ease-out 0.5s both;
}

@keyframes slideInUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Lazy Loading mejorado */
.lazy-load {
  opacity: 0.3;
  transition: opacity 0.5s ease;
}

.lazy-load.loaded {
  opacity: 1;
}

/* Service icons visibles inmediatamente */
.service-icon.lazy-load {
  opacity: 0.8;
}

.service-icon.lazy-load.loaded {
  opacity: 1;
}

header {
  background-color: white;
  padding: 5px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

header img {
  height: 110px;
  flex-shrink: 0;
}

nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  flex-grow: 1;
}

nav a {
  text-decoration: none;
  color: #0056b3;
  font-weight: bold;
  transition: color 0.3s ease;
}

nav a:hover {
  color: red;
}

nav button {
  background: none;
  border: none;
  color: #0056b3;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.3s ease;
  white-space: nowrap;
}

nav button:hover {
  color: red;
}

.carrito-link {
  display: inline-block;
  margin-left: 12px;
  position: relative;
  transition: transform 0.2s ease;
}

.carrito-link:hover {
  transform: scale(1.1);
}

/* ------------------ BÚSQUEDA ------------------ */
form.busqueda {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

form.busqueda input {
  padding: 6px 12px;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  min-width: 180px;
}

form.busqueda button {
  background-color: #0056b3;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
  white-space: nowrap;
}

form.busqueda button:hover {
  background-color: red;
}

/* ------------------ BANNER ------------------ */
.banner-slider {
  position: relative;
  width: 100%;
  height: 350px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-slider .slide {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.banner-slider .slide.active {
  opacity: 1;
  z-index: 1;
}

.banner-text {
  position: absolute;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  top: 35%;
  transform: translateY(-50%);
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  z-index: 2;
  margin: 0;
  padding: 0 20px;
  line-height: 1.2;
}

.banner-cta {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.cta-button {
  background: linear-gradient(135deg, #0056b3, #004494);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 200px;
  white-space: nowrap;
}

.cta-button:hover {
  background: linear-gradient(135deg, #dc3545, #c82333);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.cta-button.secondary {
  background: transparent;
  border: 2px solid white;
  color: white;
}

.cta-button.secondary:hover {
  background: white;
  color: #0056b3;
  border-color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.3);
}

.scroll-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 2rem;
  animation: bounce 2s infinite;
  z-index: 2;
  cursor: pointer;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* ------------------ SERVICIOS ------------------ */
.servicios-grid {
  padding: 60px 30px;
  background-color: #f8f8f8;
  text-align: center;
}

.servicios-grid h2 {
  color: #0056b3;
  font-size: 2rem;
  margin-bottom: 40px;
}

.servicios-grid .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto;
  justify-items: center;
}

.servicio {
  background: white;
  padding: 25px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid #000;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 320px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.servicio:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.servicio a {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.servicio img {
  width: 80px;
  height: 80px;
  margin: 0 auto 15px auto;
  object-fit: contain;
  border-radius: 6px;
  background-color: #f9f9f9;
  padding: 10px;
}

.servicio h3 {
  font-size: 1.2rem;
  color: #0056b3;
  margin-bottom: 15px;
  font-weight: bold;
  line-height: 1.3;
}

.servicio p {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.4;
}

.servicio p strong {
  color: #333;
  font-weight: 600;
}

/* ------------------ ESTRUCTURA ESPECÍFICA DE PRODUCTOS ------------------ */
.producto-imagen {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  min-height: 100px;
}

.producto-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.producto-precio {
  color: #0056b3 !important;
  font-weight: bold !important;
  font-size: 1.1rem !important;
  margin: 10px 0 5px 0 !important;
}

.producto-precio strong {
  color: #0056b3 !important;
}

.precio-nota {
  color: #666 !important;
  font-size: 0.8rem !important;
  font-style: italic !important;
  margin: 0 !important;
  text-align: center;
}

/* Estilos para nota "sin IVA" */
small {
  color: #666;
  font-style: italic;
  font-size: 0.8em;
}

/* Mejorar los enlaces de productos */
.servicio a:hover {
  text-decoration: none;
}

.servicio:hover .producto-precio {
  color: #dc3545 !important;
}

.servicio:hover .producto-precio strong {
  color: #dc3545 !important;
}

/* ------------------ SERVICIOS DETALLADOS ------------------ */
.servicios-section {
  padding: 60px 30px;
  background-color: #f8f8f8;
  text-align: center;
}

.servicios-section h2,
.section-title {
  color: #0056b3;
  font-size: 2rem;
  margin-bottom: 15px;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, #0056b3, #dc3545);
  margin: 20px auto;
  border-radius: 2px;
}

.section-subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 40px;
  font-style: italic;
}

.service-card {
  background: white;
  margin: 30px auto;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border: 2px solid #000;
  max-width: 800px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.5s;
}

.service-card:hover::before {
  left: 100%;
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-color: #0056b3;
}

.service-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.service-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  align-self: flex-start;
  transition: transform 0.3s ease;
  display: block;
  object-fit: contain;
}

.service-card:hover .service-icon {
  transform: scale(1.1) rotate(5deg);
}

.service-title {
  color: #0056b3;
  font-size: 1.4rem;
  margin-bottom: 15px;
  font-weight: bold;
  transition: color 0.3s ease;
}

.service-card:hover .service-title {
  color: #dc3545;
}

.service-description {
  margin-bottom: 15px;
}

.service-description p {
  margin: 8px 0;
  color: #333;
  font-size: 0.95rem;
  line-height: 1.5;
}

.service-benefit {
  margin-bottom: 20px;
  background-color: #e6f3ff;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #0056b3;
  position: relative;
  overflow: hidden;
}

.service-benefit::before {
  content: '💡';
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.2rem;
  opacity: 0.7;
}

.service-benefit p {
  margin: 0;
  color: #003366;
  font-size: 0.95rem;
  font-style: italic;
}

.service-cta {
  background: linear-gradient(135deg, #0056b3, #004494);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  align-self: flex-start;
  position: relative;
  overflow: hidden;
  min-width: 200px;
}

.service-cta::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.3s;
}

.service-cta:hover::before {
  left: 100%;
}

.service-cta:hover {
  background: linear-gradient(135deg, #dc3545, #c82333);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.quienes-somos {
  padding: 60px 30px;
  background-color: #f5f5f5;
}

.qs-contenedor {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

/* INTRO BOX */
.qs-intro-box {
  background-color: #d6ecff;
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  max-width: 1000px;
}

.qs-intro-box h2 {
  color: #0056b3;
  font-size: 2rem;
  margin-bottom: 15px;
}

.qs-intro-box p {
  font-size: 1rem;
  color: #003366;
  margin-bottom: 10px;
}

/* IMAGEN CENTRADA */
.qs-imagen {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 10px;
}

.qs-imagen img {
  width: 500px;
  max-width: 100%;
}

/* BLOQUES AZULES */
.qs-info-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
  margin-top: 10px;
  width: 100%;
}

.qs-info-boxes .box {
  background-color: #d6ecff;
  border-radius: 16px;
  padding: 30px;
  flex: 1;
  min-width: 280px;
  max-width: 480px;
  font-weight: bold;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.qs-info-boxes .box:hover {
  transform: translateY(-5px);
}

.qs-info-boxes .box p {
  margin: 12px 0;
  color: #003366;
}

.qs-info-boxes .box ul {
  list-style: none;
  padding: 0;
}

.qs-info-boxes .box ul li {
  margin: 10px 0;
  color: #003366;
  font-weight: normal;
}

/* ------------------ FOOTER ------------------ */
footer {
  background-image: url('/frontend/img/footer.png');
  background-size: cover;
  background-position: center;
  color: white;
  padding: 40px 30px;
}

footer p {
  margin: 5px 0;
  text-align: center;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* ------------------ STICKY FOOTER ------------------ */
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1;
}

/* ------------------ CARRUSEL DE PROYECTOS ------------------ */
.carrusel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#carrusel {
  overflow: hidden;
  width: 100%;
}

.flecha {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s ease;
  border-radius: 6px;
}

.flecha.izquierda {
  left: -50px;
}

.flecha.derecha {
  right: -50px;
}

.flecha:hover {
  background: rgba(0, 0, 0, 0.6);
}

/* ------------------ IMÁGENES EN PROYECTOS REALIZADOS ------------------ */
.imagenes-servicio img {
  max-width: 480px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ------------------ RESPONSIVE TABLETS ------------------ */
@media (max-width: 1024px) and (min-width: 769px) {
  .servicios-grid .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }

  .servicio {
    max-width: 100%;
  }
}

/* ------------------ RESPONSIVE MÓVILES GRANDES ------------------ */
@media (max-width: 768px) and (min-width: 481px) {
  .servicios-grid .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .servicio {
    max-width: 100%;
    padding: 18px 12px;
    min-height: 240px;
  }

  .servicio img {
    width: 65px;
    height: 65px;
  }

  .servicio h3 {
    font-size: 1rem;
  }

  .servicio p {
    font-size: 0.8rem;
  }
}

/* ------------------ RESPONSIVE MÓVILES PEQUEÑOS ------------------ */
@media (max-width: 480px) {
  header {
    padding: 10px 15px;
  }

  header img {
    height: 70px;
  }

  nav {
    gap: 8px;
  }

  nav button {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  form.busqueda {
    max-width: 250px;
  }

  form.busqueda input {
    font-size: 0.85rem;
    padding: 5px 8px;
  }

  form.busqueda button {
    font-size: 0.85rem;
    padding: 5px 10px;
  }

  .carrito-link span {
    font-size: 1.2em !important;
  }

  /* Banner responsive */
  .banner-slider {
    height: 250px;
  }

  .banner-text {
    font-size: 1.2rem;
    top: 25%;
    padding: 0 15px;
  }

  .banner-cta {
    bottom: 15%;
    flex-direction: column;
    gap: 10px;
  }

  .cta-button {
    padding: 10px 20px;
    font-size: 0.9rem;
    min-width: 180px;
  }

  .servicios-grid {
    padding: 30px 15px;
  }

  .servicios-grid .grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .servicio {
    max-width: 100%;
    padding: 20px 15px;
    min-height: 220px;
  }

  .servicio img {
    width: 60px;
    height: 60px;
  }

  .servicio h3 {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .servicio p {
    font-size: 0.8rem;
    margin-bottom: 5px;
  }

  .servicios-grid h2 {
    font-size: 1.6rem;
    margin-bottom: 25px;
  }

  /* Service cards mobile */
  .service-card {
    margin: 15px auto;
    padding: 20px 15px;
    text-align: center;
  }

  .service-content {
    align-items: center;
  }

  .service-icon {
    align-self: center;
    width: 50px;
    height: 50px;
  }

  .service-title {
    font-size: 1rem;
    text-align: center;
  }

  .service-description p {
    font-size: 0.85rem;
    text-align: left;
  }

  .service-benefit p {
    font-size: 0.85rem;
    text-align: left;
  }

  .service-cta {
    align-self: center;
    width: 100%;
    max-width: 250px;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  /* Performance optimizations for mobile */
  .animate-on-scroll {
    transition-duration: 0.4s; /* Shorter animations on mobile */
  }

  .service-card:hover {
    transform: none; /* Disable hover effects on mobile for better performance */
  }

  .loading-spinner {
    width: 40px;
    height: 40px;
  }
}

/* ------------------ RESPONSIVE ------------------ */
@media (max-width: 1024px) {
  header {
    padding: 10px 20px;
    gap: 15px;
  }

  nav {
    gap: 15px;
  }

  nav button {
    font-size: 0.9rem;
    padding: 5px 8px;
  }

  form.busqueda input {
    min-width: 150px;
    font-size: 0.9rem;
  }

  header img {
    height: 90px;
  }

  .service-card {
    margin: 20px auto;
    padding: 25px;
  }

  .service-title {
    font-size: 1.2rem;
  }

  /* Banner adjustments for tablets */
  .banner-slider {
    height: 300px;
  }

  .banner-text {
    font-size: 2rem;
  }

  .cta-button {
    padding: 12px 24px;
    min-width: 180px;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px;
  }

  header img {
    height: 80px;
  }

  nav {
    order: 2;
    text-align: center;
    gap: 10px;
  }

  nav button {
    font-size: 0.85rem;
    padding: 8px 12px;
    margin: 2px;
  }

  form.busqueda {
    order: 3;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  form.busqueda input {
    flex: 1;
    min-width: auto;
  }

  .carrito-link {
    margin-left: 8px;
  }

  /* Banner responsive for tablets */
  .banner-slider {
    height: 280px;
  }

  .banner-text {
    font-size: 1.5rem;
    top: 30%;
    padding: 0 20px;
  }

  .banner-cta {
    bottom: 15%;
    gap: 15px;
  }

  .cta-button {
    padding: 11px 22px;
    font-size: 0.95rem;
    min-width: 170px;
  }

  .servicios-grid {
    padding: 40px 20px;
  }

  .servicios-grid .grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 100%;
  }

  .servicio {
    max-width: 100%;
    padding: 20px 15px;
    min-height: 260px;
  }

  .servicio img {
    width: 70px;
    height: 70px;
    margin-bottom: 12px;
  }

  .servicio h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }

  .servicio p {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  .servicios-grid h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
  }

  /* Responsive para servicios detallados */
  .service-card {
    margin: 15px auto;
    padding: 20px;
    text-align: center;
  }

  .service-content {
    align-items: center;
  }

  .service-icon {
    align-self: center;
  }

  .service-title {
    font-size: 1.1rem;
    text-align: center;
  }

  .service-description p {
    font-size: 0.9rem;
    text-align: left;
  }

  .service-benefit p {
    font-size: 0.9rem;
    text-align: left;
  }

  .service-cta {
    align-self: center;
    width: 100%;
    max-width: 280px;
  }

  .info-boxes {
    flex-direction: column;
    align-items: center;
  }

  .intro-box {
    padding: 20px;
    text-align: center;
  }

  .intro-box h2 {
    font-size: 1.6rem;
  }

  footer {
    padding: 20px;
  }

  footer p {
    font-size: 0.9rem;
  }

  .imagenes-servicio {
    flex-direction: column;
  }

  .imagenes-servicio img {
    max-width: 90%;
  }

  /* Reduce motion for devices with motion sensitivity */
  @media (prefers-reduced-motion: reduce) {
    .animate-on-scroll,
    .service-card,
    .cta-button {
      transition: none;
    }
    
    .loading-spinner {
      animation: none;
    }
    
    .banner-text {
      animation: none;
    }
  }
}
