/* Banner trạng thái mạng dùng chung: nổi trên giao diện, không làm dịch chuyển nội dung. */
.booklink-network-status {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 2147482900;
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.booklink-network-status[hidden] {
  display: none;
}

.booklink-network-status__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(146, 64, 14, 0.2);
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.96);
  color: #92400e;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: booklinkNetworkStatusIn 180ms ease-out both;
}

.booklink-network-status__dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

.booklink-network-status[data-network-state="reconnecting"] .booklink-network-status__dot {
  animation: booklinkNetworkStatusPulse 900ms ease-in-out infinite;
}

.booklink-network-status[data-network-state="connected"] .booklink-network-status__content {
  border-color: rgba(22, 163, 74, 0.2);
  background: rgba(240, 253, 244, 0.97);
  color: #166534;
}

.booklink-network-status[data-network-state="connected"] .booklink-network-status__dot {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

@keyframes booklinkNetworkStatusIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes booklinkNetworkStatusPulse {
  50% { opacity: 0.45; transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .booklink-network-status__content,
  .booklink-network-status__dot {
    animation: none !important;
  }
}
