/**
 * Styles PWA - TéléTaxi
 * Bannière d'installation, notifications de mise à jour
 */

/* ===========================
   BANNIÈRE D'INSTALLATION PWA
   =========================== */

.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.pwa-install-banner.show {
  transform: translateY(0);
}

.pwa-install-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.pwa-install-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-text strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

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

.pwa-install-banner .btn-install {
  background: white;
  color: #667eea;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-install-banner .btn-install:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-install-banner .btn-install:active {
  transform: translateY(0);
}

.pwa-install-banner .btn-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.pwa-install-banner .btn-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
  .pwa-install-banner {
    padding: 12px 16px;
  }

  .pwa-install-content {
    flex-wrap: wrap;
    gap: 12px;
  }

  .pwa-install-icon {
    font-size: 24px;
  }

  .pwa-install-text {
    flex: 1 1 100%;
    order: 1;
  }

  .pwa-install-text strong {
    font-size: 15px;
  }

  .pwa-install-text p {
    font-size: 13px;
  }

  .pwa-install-banner .btn-install {
    order: 2;
    flex: 1;
    justify-content: center;
    padding: 12px 20px;
  }

  .pwa-install-banner .btn-close {
    order: 0;
    margin-left: auto;
  }
}

/* ===========================
   NOTIFICATION DE MISE À JOUR
   =========================== */

.pwa-update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  z-index: 10000;
  max-width: 400px;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s ease-in-out;
}

.pwa-update-notification.show {
  transform: translateX(0);
}

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

.pwa-update-content i {
  font-size: 24px;
  color: #007bff;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.pwa-update-content span {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.pwa-update-notification .btn-update {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-update-notification .btn-update:hover {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.pwa-update-notification .btn-later {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-update-notification .btn-later:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

/* Responsive */
@media (max-width: 768px) {
  .pwa-update-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .pwa-update-content {
    flex-wrap: wrap;
  }

  .pwa-update-content span {
    flex: 1 1 100%;
    margin-bottom: 8px;
  }

  .pwa-update-notification .btn-update,
  .pwa-update-notification .btn-later {
    flex: 1;
    padding: 10px 16px;
  }
}

/* ===========================
   MESSAGE DE SUCCÈS
   =========================== */

.pwa-success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  z-index: 10000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s ease-in-out;
}

.pwa-success-message.show {
  transform: translateX(0);
}

.pwa-success-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-success-content i {
  font-size: 24px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.pwa-success-content span {
  font-size: 15px;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .pwa-success-message {
    top: 10px;
    right: 10px;
    left: 10px;
  }
}

/* ===========================
   INDICATEUR MODE OFFLINE
   =========================== */

.pwa-offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ff9800;
  color: white;
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 10001;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}

.pwa-offline-indicator.show {
  transform: translateY(0);
}

.pwa-offline-indicator i {
  margin-right: 8px;
}

/* ===========================
   SPINNER DE CHARGEMENT PWA
   =========================== */

.pwa-loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10002;
}

.pwa-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 123, 255, 0.2);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===========================
   BADGE D'APPLICATION INSTALLÉE
   =========================== */

.pwa-installed-badge {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9998;
  opacity: 0;
  animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  10%, 90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.pwa-installed-badge i {
  font-size: 14px;
}

/* ===========================
   ANIMATION D'INSTALLATION
   =========================== */

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

.pwa-installing {
  animation: installPulse 1.5s ease-in-out infinite;
}

/* ===========================
   MODE STANDALONE (APP INSTALLÉE)
   =========================== */

@media all and (display-mode: standalone) {
  /* Cacher la bannière d'installation si déjà installée */
  .pwa-install-banner {
    display: none !important;
  }

  /* Ajustements pour le mode standalone */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iOS Safari en mode standalone */
@media all and (display-mode: standalone) and (-webkit-touch-callout: default) {
  body {
    padding-top: max(env(safe-area-inset-top), 20px);
  }
}


