/* ============================================================
   Nexora — PWA Install Banner & Notification Styles v3.0
   FIX: All banners use position:fixed on viewport so they
   appear above #phone which has overflow:hidden + z-index:1
   ============================================================ */

/* ── Install Banner (bottom sheet) ───────────────────────── */
#pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  padding: 0 16px max(20px, env(safe-area-inset-bottom));
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1),
              opacity 0.3s ease;
  pointer-events: none;
}
#pwa-install-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.pwa-banner-inner {
  background: linear-gradient(135deg,
    rgba(18, 12, 40, 0.97) 0%,
    rgba(14, 10, 32, 0.99) 100%);
  border: 1px solid rgba(124, 92, 255, 0.40);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 22px;
  box-shadow:
    0 -8px 50px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 0 80px rgba(124, 92, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  max-width: 520px;
  margin: 0 auto;
}

/* Drag handle */
.pwa-banner-inner::before {
  content: '';
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

/* Purple shimmer */
.pwa-banner-inner::after {
  content: '';
  position: absolute;
  top: -40%; left: -20%;
  width: 140%; height: 140%;
  background: radial-gradient(ellipse at 30% 0%,
    rgba(124, 92, 255, 0.10) 0%,
    transparent 60%);
  pointer-events: none;
}

.pwa-banner-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 6px;
}

.pwa-banner-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c5cff, #00e0ff, #ff4ecd);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(124, 92, 255, 0.55);
}

.pwa-banner-text { flex: 1; }

.pwa-banner-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.pwa-banner-subtitle {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  font-family: 'DM Sans', sans-serif;
}

.pwa-banner-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  align-self: flex-start;
}
.pwa-banner-close:hover { background: rgba(255,255,255,0.14); color: #f1f5f9; }

.pwa-banner-features {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-feat {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(124, 92, 255, 0.10);
  border: 1px solid rgba(124, 92, 255, 0.20);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 11px;
  color: #a78bfa;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
.pwa-feat-icon { font-size: 12px; }

.pwa-banner-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}

.pwa-btn-later {
  padding: 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.pwa-btn-later:hover { background: rgba(255,255,255,0.10); color: #94a3b8; }

.pwa-btn-install {
  padding: 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 22px rgba(124, 92, 255, 0.45);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.pwa-btn-install:hover {
  box-shadow: 0 4px 30px rgba(124, 92, 255, 0.65);
  transform: scale(1.02);
}
.pwa-btn-install:active { transform: scale(0.97); }

/* ── iOS Manual Instruction Banner ───────────────────────── */
#pwa-ios-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  padding: 0 16px max(20px, env(safe-area-inset-bottom));
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1),
              opacity 0.3s ease;
  pointer-events: none;
}
#pwa-ios-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.pwa-ios-inner {
  background: linear-gradient(135deg,
    rgba(18, 12, 40, 0.97) 0%,
    rgba(14, 10, 32, 0.99) 100%);
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 22px;
  box-shadow:
    0 -8px 50px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

/* Drag handle */
.pwa-ios-inner::before {
  content: '';
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.pwa-ios-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-top: 6px;
}

.pwa-ios-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
}

.pwa-ios-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.pwa-ios-close:hover { background: rgba(255,255,255,0.12); color: #f1f5f9; }

.pwa-ios-steps { display: flex; flex-direction: column; gap: 14px; }
.pwa-ios-step  { display: flex; align-items: flex-start; gap: 12px; }

.pwa-ios-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.15);
  border: 1px solid rgba(124, 92, 255, 0.35);
  color: #a78bfa;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: 'Sora', sans-serif;
}

.pwa-ios-step-text {
  font-size: 13px;
  color: #94a3b8;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
}
.pwa-ios-step-text strong { color: #f1f5f9; font-weight: 600; }
.pwa-ios-step-icon { font-size: 15px; }

/* ── Update notification toast (top) ─────────────────────── */
#pwa-update-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-130%);
  opacity: 0;
  z-index: 999999;
  width: calc(100% - 32px);
  max-width: 420px;
  transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1),
              opacity 0.3s ease;
  pointer-events: none;
}
#pwa-update-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.pwa-update-inner {
  background: linear-gradient(135deg,
    rgba(18, 12, 40, 0.97) 0%,
    rgba(14, 10, 32, 0.99) 100%);
  border: 1px solid rgba(124, 92, 255, 0.45);
  border-radius: 18px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pwa-update-icon { font-size: 20px; flex-shrink: 0; }
.pwa-update-text { flex: 1; min-width: 0; }

.pwa-update-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 1px;
}

.pwa-update-sub {
  font-size: 11px;
  color: #64748b;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-update-btn {
  padding: 7px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c5cff, #a78bfa);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.pwa-update-btn:hover { opacity: 0.9; transform: scale(1.03); }

.pwa-update-dismiss {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.pwa-update-dismiss:hover { background: rgba(255,255,255,0.10); color: #94a3b8; }

/* ── Installed success toast ──────────────────────────────── */
#pwa-installed-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-130%);
  opacity: 0;
  z-index: 999999;
  transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1),
              opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
#pwa-installed-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.pwa-installed-inner {
  background: linear-gradient(135deg,
    rgba(0, 229, 160, 0.18),
    rgba(0, 180, 120, 0.12));
  border: 1px solid rgba(0, 229, 160, 0.40);
  border-radius: 50px;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 28px rgba(0, 229, 160, 0.25);
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #00e5a0;
}

/* ── Light mode overrides ─────────────────────────────────── */
.light-mode #pwa-install-banner .pwa-banner-inner,
.light-mode #pwa-ios-banner .pwa-ios-inner,
.light-mode #pwa-update-toast .pwa-update-inner {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(124, 92, 255, 0.22);
  box-shadow: 0 -8px 50px rgba(0,0,0,0.14),
              0 0 0 1px rgba(0,0,0,0.04);
}
.light-mode .pwa-banner-title,
.light-mode .pwa-ios-title,
.light-mode .pwa-update-title   { color: #0f172a; }
.light-mode .pwa-banner-subtitle,
.light-mode .pwa-ios-step-text,
.light-mode .pwa-update-sub     { color: #64748b; }
.light-mode .pwa-ios-step-text strong { color: #1e293b; }
.light-mode .pwa-feat { background: rgba(124,92,255,0.07); color: #7c5cff; }
.light-mode .pwa-btn-later {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.10);
  color: #64748b;
}
.light-mode .pwa-banner-inner::before,
.light-mode .pwa-ios-inner::before { background: rgba(0,0,0,0.12); }
