/* Estilos para PWA - Caminos de Veruela */

/* Banner de instalación */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #7e2a25 0%, #7e2a25 100%);
  color: white;
  padding: 15px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
  flex-wrap: wrap;
}

.pwa-logo {
  height: 50px;
  width: auto;
}

.pwa-text {
  flex: 1;
  min-width: 200px;
}

.pwa-text h4 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
}

.pwa-text p {
  margin: 5px 0 0 0;
  font-size: 0.9em;
  opacity: 0.9;
}

#pwa-install-btn {
  background: white;
  color: #7e2a25;
  border: none;
  padding: 10px 25px;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#pwa-install-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

.btn-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  padding: 0 10px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.btn-close:hover {
  opacity: 1;
}

/* Banner de actualización */
.update-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a7c28;
  color: white;
  padding: 15px 30px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 9998;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100%);
  }
  to {
    transform: translateX(-50%) translateY(0);
  }
}

.update-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.update-content p {
  margin: 0;
  font-weight: 600;
}

#update-btn {
  background: white;
  color: #7e2a25;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#update-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

/* Estado de conexión */
.connection-status {
  position: fixed;
  top: 70px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 600;
  z-index: 9997;
  animation: fadeInOut 3s ease-in-out;
}

.connection-status.online {
  background: #28a745;
  color: white;
}

.connection-status.offline {
  background: #ffc107;
  color: #333;
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
}

/* Ajustes para modo standalone */
.standalone-mode {
  /* Agregar padding superior para evitar el notch en iOS */
  padding-top: env(safe-area-inset-top);
}

.standalone-mode #header {
  top: env(safe-area-inset-top);
}

/* Splash screen para iOS */
@media (display-mode: standalone) {
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #7e2a25;
    z-index: 99999;
    animation: fadeOut 0.5s ease-out 0.5s forwards;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    pointer-events: none;
  }
}

/* Optimizaciones táctiles para móviles */
@media (hover: none) and (pointer: coarse) {
  /* Mejorar área de toque */
  a, button, .nav-menu a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Deshabilitar efectos hover en móviles */
  a:hover, button:hover {
    transform: none;
  }
}

/* Preloader mejorado para PWA */
.pwa-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #7e2a25;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeOut 0.5s ease-out 1s forwards;
}

.pwa-preloader img {
  max-width: 200px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

/* Responsive para tablets */
@media (min-width: 768px) and (max-width: 1024px) {
  .pwa-install-banner {
    padding: 20px;
  }
  
  .pwa-text h4 {
    font-size: 1.3em;
  }
}

/* Responsive para móviles */
@media (max-width: 767px) {
  .pwa-install-content {
    flex-direction: column;
    text-align: center;
  }

  .pwa-logo {
    height: 40px;
  }

  .pwa-text {
    min-width: 100%;
  }

  #pwa-install-btn {
    width: 100%;
  }

  .btn-close {
    position: absolute;
    top: 5px;
    right: 5px;
  }

  .update-banner {
    left: 10px;
    right: 10px;
    transform: none;
  }

  .update-content {
    flex-direction: column;
    text-align: center;
  }

  #update-btn {
    width: 100%;
  }
}
