/* RabariMatch PWA Install Banner & Offline Notification Styles */

:root {
  --pwa-primary: #1e3c72;
  --pwa-secondary: #2a5298;
  --pwa-accent: #ff416c;
  --pwa-gold: #f59e0b;
}

/* Floating PWA Install Notification Card / Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: calc(100% - 32px);
  max-width: 480px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 16px 20px;
  z-index: 10550;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(30, 60, 114, 0.12);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-install-banner.show {
  transform: translateX(-50%) translateY(0);
}

/* App Icon Container in Banner */
.pwa-install-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(30, 60, 114, 0.25);
  object-fit: cover;
}

/* Content Area */
.pwa-install-body {
  flex: 1;
  min-width: 0;
}

.pwa-install-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1e3c72;
  margin: 0 0 2px 0;
  line-height: 1.25;
}

.pwa-install-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action Buttons */
.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pwa-install {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #ffffff !important;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-pwa-install:hover, .btn-pwa-install:focus {
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(30, 60, 114, 0.4);
}

.btn-pwa-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  padding: 4px;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.btn-pwa-close:hover {
  color: #334155;
}

/* iOS Installation Help Modal */
.pwa-ios-modal .modal-content {
  border-radius: 24px;
  border: none;
  overflow: hidden;
}

.pwa-ios-header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.pwa-ios-step:last-child {
  border-bottom: none;
}

.pwa-ios-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eff6ff;
  color: #1e3c72;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Toast Notification for Online/Offline Status */
.pwa-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10600;
  pointer-events: none;
}

.pwa-toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.pwa-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.pwa-toast.online {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
}

.pwa-toast.offline {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
}

.pwa-toast.slow {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #ffffff;
}

/* =========================================================
   SLOW INTERNET SPEED WARNING BANNER / FLOATING PILL
   ========================================================= */
.network-slow-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  width: calc(100% - 32px);
  max-width: 580px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-left: 5px solid #f59e0b;
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(245, 158, 11, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 12px 16px;
  z-index: 10590;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.network-slow-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.network-slow-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.network-slow-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #d97706;
  font-size: 1.25rem;
  position: relative;
}

.network-slow-icon-wrap .slow-pulse-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #fff;
  animation: slowPulse 1.8s infinite;
}

@keyframes slowPulse {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.3); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.network-slow-content {
  min-width: 0;
}

.network-slow-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #92400e;
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.network-slow-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: #fef3c7;
  color: #b45309;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid #fde68a;
}

.network-slow-desc {
  font-size: 0.78rem;
  color: #78350f;
  margin: 2px 0 0 0;
  line-height: 1.35;
}

.network-slow-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-slow-retest {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-slow-retest:hover {
  background: #fde68a;
  color: #78350f;
  transform: translateY(-1px);
}

.btn-slow-dismiss {
  background: transparent;
  border: none;
  color: #b45309;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.2s ease;
}

.btn-slow-dismiss:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #78350f;
}

/* =========================================================
   OFFLINE STICKY TOP BANNER
   ========================================================= */
.network-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #b91c1c 0%, #dc2626 50%, #b91c1c 100%);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 10650;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.35s ease;
  text-align: center;
}

.network-offline-banner.show {
  transform: translateY(0);
}

.network-offline-banner .offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: slowPulse 1.5s infinite;
}

.btn-offline-banner-retry {
  background: #ffffff;
  color: #dc2626;
  border: none;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-offline-banner-retry:hover {
  background: #fef2f2;
  transform: scale(1.04);
}

/* =========================================================
   OFFLINE FULLSCREEN OVERLAY MODAL
   ========================================================= */
.network-offline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.network-offline-overlay.show {
  opacity: 1;
  visibility: visible;
}

.network-offline-card {
  background: #ffffff;
  border-radius: 24px;
  max-width: 440px;
  width: 100%;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.network-offline-overlay.show .network-offline-card {
  transform: scale(1);
}

.network-offline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #dc2626, #f59e0b, #1e3c72);
}

.network-offline-icon-box {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fef2f2;
  color: #dc2626;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
  border: 2px solid #fee2e2;
}

.network-offline-icon-box .pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(220, 38, 38, 0.4);
  animation: slowPulse 2s infinite;
}

.network-offline-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 8px;
}

.network-offline-text {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-offline-reconnect {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #ffffff;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 30px;
  width: 100%;
  box-shadow: 0 8px 20px rgba(30, 60, 114, 0.28);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-offline-reconnect:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(30, 60, 114, 0.38);
  color: #ffffff;
}

.btn-offline-reconnect:disabled {
  opacity: 0.7;
  transform: none;
  cursor: not-allowed;
}

.network-offline-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 5px 14px;
  border-radius: 20px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}

.network-offline-status-pill.online {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.network-offline-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.2s ease;
  line-height: 1;
}

.network-offline-close-btn:hover {
  color: #334155;
}

/* Media Permissions Prompt Modal */
.pwa-permissions-modal .modal-content {
  border-radius: 24px;
  border: none;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.pwa-perms-header {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
  border-bottom: 1px solid #e2e8f0;
}

.pwa-perms-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  font-size: 1.5rem;
}

/* Suppress all Install UI elements if the PWA is installed or running in standalone mode */
@media (display-mode: standalone) {
  .pwa-install-banner,
  .pwa-home-install-card,
  .btn-pwa-install-trigger {
    display: none !important;
  }
}

body.pwa-installed .pwa-install-banner,
body.pwa-installed .pwa-home-install-card,
body.pwa-installed .btn-pwa-install-trigger {
  display: none !important;
}

@media (max-width: 576px) {
  .network-slow-banner {
    flex-direction: column;
    align-items: stretch;
    top: 12px;
    padding: 12px;
    gap: 10px;
  }
  .network-slow-actions {
    justify-content: flex-end;
  }
}


