/* Collab PWA UI Components & Alerts */

:root {
  --pwa-primary: #f97316;
  --pwa-primary-hover: #ea580c;
  --pwa-dark-bg: #0f172a;
  --pwa-card-bg: rgba(15, 23, 42, 0.94);
  --pwa-border: rgba(249, 115, 22, 0.3);
  --pwa-text: #f8fafc;
  --pwa-text-muted: #94a3b8;
}

/* 1. Install Floating Card / Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  max-width: 380px;
  width: calc(100% - 48px);
  background: var(--pwa-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--pwa-border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 25px rgba(249, 115, 22, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--pwa-text);
  font-family: system-ui, -apple-system, sans-serif;
}

.pwa-install-banner.pwa-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

.pwa-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.pwa-banner-info {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
  margin-bottom: 2px;
}

.pwa-banner-desc {
  font-size: 0.75rem;
  color: var(--pwa-text-muted);
  line-height: 1.3;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-btn-install {
  background: linear-gradient(135deg, var(--pwa-primary), #ea580c);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-btn-install:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.pwa-btn-dismiss {
  background: transparent;
  border: none;
  color: var(--pwa-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pwa-btn-dismiss:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* 2. PWA Toasts & Status Notifications */
.pwa-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  z-index: 999999;
  background: var(--pwa-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 8px 16px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: system-ui, -apple-system, sans-serif;
}

.pwa-toast.pwa-toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-toast-icon {
  width: 16px;
  height: 16px;
  color: var(--pwa-primary);
  animation: pwaSpin 2s linear infinite;
}

@keyframes pwaSpin {
  to { transform: rotate(360deg); }
}

.pwa-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pwa-dot-red {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.pwa-dot-green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.pwa-toast-offline {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(30, 20, 20, 0.95);
}

.pwa-toast-online {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 35, 25, 0.95);
}

.pwa-toast-update {
  border-color: var(--pwa-border);
}

.pwa-toast-btn {
  background: var(--pwa-primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pwa-toast-btn:hover {
  background: var(--pwa-primary-hover);
}

/* 3. iOS Install Modal */
.pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.pwa-modal-backdrop.pwa-modal-show {
  opacity: 1;
  pointer-events: auto;
}

.pwa-modal-card {
  background: #0f172a;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 20px;
  max-width: 400px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  color: #f8fafc;
  font-family: system-ui, -apple-system, sans-serif;
}

.pwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pwa-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.pwa-modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.pwa-modal-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.pwa-modal-body ol {
  margin-top: 12px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pwa-modal-body .inline-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  color: var(--pwa-primary);
}

.pwa-modal-btn {
  width: 100%;
  padding: 10px;
  background: var(--pwa-primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* 4. Install Pill for desktop rail or navigation */
.pwa-rail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.pwa-rail-btn:hover::after {
  content: attr(data-pwa-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 1000;
}
