/* Estilos para el modo offline y notificaciones */
body.offline {
    filter: grayscale(0.5);
}

.connection-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.connection-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.connection-toast.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

body.offline {
  filter: grayscale(1);
}

/* Opcional: Deshabilitar botones al estar offline */
body.offline button,
body.offline input[type="submit"] {
  pointer-events: none;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Estilos para el botón de instalación */
#installPwa {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    background: var(--color-primario, #0d6efd);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: none;
    z-index: 1000;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Mejoras para dispositivos Apple */
@supports (-webkit-touch-callout: none) {
    #installPwa {
        padding: 14px 28px;
    }
    
    .connection-toast {
        padding-bottom: 24px; /* Safe area para iPhone X+ */
    }
}

/* Media queries para diferentes tamaños de pantalla */
@media (max-width: 768px) {
    #installPwa {
        bottom: 40px;
        transform: translateX(50%);
        width: calc(100% - 40px);
        max-width: 320px;
    }
}

/* Soporte para modo oscuro */
@media (prefers-color-scheme: dark) {
    .connection-toast {
        background: rgba(255, 255, 255, 0.9);
        color: black;
    }

/* Estilos para Banners como Toasts (Flotantes abajo a la derecha) */
#pushPermissionBanner,
.update-notification {
  position: fixed !important;
  bottom: 80px !important; /* Arriba del botón de instalación */
  right: 20px !important;
  width: 320px !important;
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
  padding: 16px !important;
  z-index: 9999 !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  transition: transform 0.3s ease, opacity 0.3s ease !important;
}

/* Si hay ambos, el de actualización va arriba */
.update-notification {
  bottom: 220px !important;
}

#pushPermissionBanner .push-banner-row,
.update-notification .sw-update-content {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  align-items: stretch !important;
}

#pushPermissionBanner .push-banner-title,
.update-notification p {
  font-weight: 700 !important;
  color: #333 !important;
  font-size: 15px !important;
  margin: 0 !important;
}

#pushPermissionBanner .push-banner-text {
  font-size: 13px !important;
  color: #666 !important;
  line-height: 1.4 !important;
  margin: 0 !important;
}

#enablePushBtn,
.update-notification .btn-primary {
  background: #0d6efd !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 10px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

.update-notification .btn-secondary {
  background: #f8f9fa !important;
  color: #666 !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  padding: 8px !important;
  font-size: 12px !important;
  cursor: pointer !important;
}

#pushPermissionBanner .btn-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
}

@media (max-width: 480px) {
  #pushPermissionBanner,
  .update-notification {
    left: 20px !important;
    width: auto !important;
    bottom: 20px !important;
  }
  
  .update-notification {
    bottom: 160px !important;
  }
}
