/* ============================================================
   CricBata v3.0 — Network Status Indicator
   Styling for online/offline status indicator
   ============================================================ */

#network-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.3s ease;
  z-index: 101;
}

/* Online State */
#network-status-indicator.online {
  color: rgb(34, 197, 94);
}

#network-status-indicator.online .network-status-dot {
  background: rgb(34, 197, 94);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* Offline State */
#network-status-indicator.offline {
  color: rgb(239, 68, 68);
  animation: offlinePulse 2s ease-in-out infinite;
}

#network-status-indicator.offline .network-status-dot {
  background: rgb(239, 68, 68);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: offlineDotPulse 1.5s ease-in-out infinite;
}

.network-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.network-status-text {
  display: inline;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Hide indicator on small screens by default */
@media (max-width: 480px) {
  #network-status-indicator {
    padding: 4px 8px;
    font-size: 10px;
  }

  #network-status-indicator .network-status-text {
    display: none;
  }

  #network-status-indicator .network-status-dot {
    width: 6px;
    height: 6px;
  }
}

/* Animations */
@keyframes offlinePulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes offlineDotPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

@keyframes onlineSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#network-status-indicator.online {
  animation: onlineSlideIn 0.4s ease;
}

/* Respects prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #network-status-indicator.offline {
    animation: none;
  }

  #network-status-indicator.offline .network-status-dot {
    animation: none;
  }

  #network-status-indicator.online {
    animation: none;
  }
}

/* Sync queue indicator (optional) */
.sync-queue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: rgb(239, 68, 68);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  animation: syncBounce 0.6s ease-in-out infinite;
}

@keyframes syncBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* Connection warning banner */
.connection-warning {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgb(239, 68, 68), rgb(239, 68, 68) 100%);
  color: white;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  z-index: 99;
  animation: slideDown 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.connection-warning.hidden {
  display: none;
}

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

/* Sync progress indicator */
.sync-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
  animation: slideUp 0.3s ease;
  z-index: 500;
}

.sync-progress .spinner {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

@media (max-width: 640px) {
  .sync-progress {
    bottom: 80px;
    right: 12px;
    left: 12px;
    justify-content: center;
  }
}
