/**
 * Counselign PWA Styles
 * Install Prompts, Offline Badges, Update Toasts, and iOS Installation Sheet
 */

:root {
  --pwa-navy: #060e57;
  --pwa-navy-soft: #0a1a7a;
  --pwa-navy-dark: #03082a;
  --pwa-blue: #3b82f6;
  --pwa-blue-hover: #2563eb;
  --pwa-surface: #ffffff;
  --pwa-text-main: #0f172a;
  --pwa-text-muted: #64748b;
  --pwa-border: rgba(6, 14, 87, 0.1);
  --pwa-shadow: 0 16px 40px -8px rgba(6, 14, 87, 0.25);
  --pwa-radius: 16px;
  --pwa-font: "DM Sans", system-ui, -apple-system, sans-serif;
  --pwa-mono: "JetBrains Mono", monospace;
}

/* -------------------------------------------------------------------------- */
/* Install Banner / Floating Prompt                                            */
/* -------------------------------------------------------------------------- */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  max-width: 420px;
  width: calc(100vw - 48px);
  background: linear-gradient(
    135deg,
    rgba(6, 14, 87, 0.96) 0%,
    rgba(10, 26, 122, 0.96) 100%
  );
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--pwa-radius);
  padding: 16px 20px;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(59, 130, 246, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 16px;
  transform: translateY(120%);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s ease;
  font-family: var(--pwa-font);
}

.pwa-install-banner.pwa-show {
  transform: translateY(0);
  opacity: 1;
}

.pwa-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

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

.pwa-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 3px 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pwa-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--pwa-mono);
}

.pwa-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.35;
}

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

.pwa-btn-install {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  font-family: var(--pwa-font);
}

.pwa-btn-install:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  transform: translateY(-1px);
}

.pwa-btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

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

/* -------------------------------------------------------------------------- */
/* Online / Offline Status Toast                                              */
/* -------------------------------------------------------------------------- */
.pwa-status-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 999999;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: var(--pwa-font);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

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

.pwa-status-toast.offline {
  background: #ef4444;
  color: #ffffff;
}

.pwa-status-toast.online {
  background: #10b981;
  color: #ffffff;
}

/* -------------------------------------------------------------------------- */
/* Update Available Toast                                                     */
/* -------------------------------------------------------------------------- */
.pwa-update-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 999999;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--pwa-font);
  font-size: 13px;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.4s ease;
}

.pwa-update-toast.pwa-show {
  transform: translateY(0);
  opacity: 1;
}

.pwa-btn-update {
  background: var(--pwa-blue);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.pwa-btn-update:hover {
  background: var(--pwa-blue-hover);
}

/* -------------------------------------------------------------------------- */
/* iOS "Add to Home Screen" Sheet / Modal                                      */
/* -------------------------------------------------------------------------- */
.pwa-ios-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.pwa-ios-overlay.pwa-show {
  opacity: 1;
  visibility: visible;
}

.pwa-ios-sheet {
  background: #ffffff;
  color: var(--pwa-text-main);
  width: 100%;
  max-width: 480px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 28px 24px 36px;
  position: relative;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  font-family: var(--pwa-font);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-ios-overlay.pwa-show .pwa-ios-sheet {
  transform: translateY(0);
}

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

.pwa-ios-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-ios-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pwa-ios-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--pwa-navy);
}

.pwa-ios-subtitle {
  font-size: 12px;
  color: var(--pwa-text-muted);
  margin: 0;
}

.pwa-ios-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: #334155;
  font-weight: 500;
}

.pwa-step-num {
  width: 28px;
  height: 28px;
  background: var(--pwa-navy);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.pwa-step-icon {
  color: var(--pwa-blue);
  font-size: 16px;
  margin: 0 4px;
}

.pwa-ios-btn-done {
  width: 100%;
  background: var(--pwa-navy);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.pwa-ios-btn-done:hover {
  background: var(--pwa-navy-soft);
}

/* -------------------------------------------------------------------------- */
/* Responsive Tweaks                                                          */
/* -------------------------------------------------------------------------- */
@media (max-width: 576px) {
  .pwa-install-banner {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    padding: 14px 16px;
  }

  .pwa-update-toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
  }
}

/* -------------------------------------------------------------------------- */
/* Mobile Only Enforcement for PWA Install UI                                 */
/* -------------------------------------------------------------------------- */
@media (min-width: 992px) {
  /* Completely hide all install banners, sheets, and manual install buttons on Desktop */
  .pwa-install-banner,
  .pwa-ios-overlay,
  .pwa-mobile-only,
  #pwaInstallBanner,
  #pwaIosOverlay,
  #pwaNavInstallBtn,
  [data-pwa-install] {
    display: none !important;
  }
}

