/* ==========================================================================
   Vedic Numero - PWA Guided Install Banner & Bottom Sheet (Mobile & Cross-Browser)
   Supports: Chrome iOS, Safari iOS, Android Chrome, Desktop Chrome/Safari
   Location: assests/css/pwa-install.css
   ========================================================================== */

:root {
  --vn-pwa-primary: #d1070e;
  --vn-pwa-primary-dark: #b8060c;
  --vn-pwa-gold: #d4af37;
  --vn-pwa-gold-soft: #f4ecd8;
  --vn-pwa-gold-glow: rgba(212, 175, 55, 0.4);
  --vn-pwa-text: #2c1810;
  --vn-pwa-text-muted: #6f5f58;
  --vn-pwa-sheet-bg: #ffffff;
  --vn-pwa-card-bg: #fdfaf4;
  --vn-pwa-border: #ede4d3;
}

/* --------------------------------------------------------------------------
   1. Floating Install Banner (Compact, Never Overlapping, iOS/Android Ready)
   -------------------------------------------------------------------------- */
#vn-pwa-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 440px;
  margin: 0 auto;
  z-index: 99998;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(44, 24, 16, 0.2), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 10px 12px;
  display: none;
  box-sizing: border-box;
  animation: vnBannerSlideUp 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Outfit", sans-serif;
  color: var(--vn-pwa-text);
  user-select: none;
  -webkit-user-select: none;
}

@keyframes vnBannerSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.vn-pwa-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.vn-pwa-app-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #efe4d2;
  object-fit: cover;
}

.vn-pwa-text-block {
  flex: 1;
  min-width: 0;
  padding: 0 2px;
  cursor: pointer;
}

.vn-pwa-banner-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--vn-pwa-text);
  margin: 0 0 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-pwa-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(212, 175, 55, 0.22);
  color: #8c620e;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  flex-shrink: 0;
}

.vn-pwa-banner-desc {
  font-size: 11.5px;
  color: var(--vn-pwa-text-muted);
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.vn-pwa-btn-install {
  background: linear-gradient(135deg, var(--vn-pwa-primary) 0%, var(--vn-pwa-primary-dark) 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(165, 42, 42, 0.32);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}

.vn-pwa-btn-install:active {
  transform: scale(0.95);
  background: #731717;
}

.vn-pwa-btn-close {
  background: transparent;
  border: none;
  color: #a09289;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  padding: 0;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.vn-pwa-btn-close:active,
.vn-pwa-btn-close:hover {
  color: var(--vn-pwa-text);
  background: rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------------------------------
   2. Guided Install Bottom Sheet (Fits Dynamic Mobile Viewports)
   -------------------------------------------------------------------------- */
#vn-pwa-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: rgba(20, 14, 10, 0.58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#vn-pwa-sheet-overlay.vn-active {
  display: block;
  opacity: 1;
}

#vn-pwa-bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  max-width: 480px;
  margin: 0 auto;
  background: var(--vn-pwa-sheet-bg);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.25);
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom, 12px)) 18px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1);
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Outfit", sans-serif;
  color: var(--vn-pwa-text);
  /* Constrain height to dynamic viewport to avoid clipping behind top address bar in Chrome/Safari */
  max-height: 84vh;
  max-height: min(84dvh, 660px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#vn-pwa-bottom-sheet.vn-active {
  transform: translateY(0);
}

.vn-pwa-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #dbd2c8;
  margin: 0 auto 10px auto;
}

.vn-pwa-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f2e9dc;
}

.vn-pwa-sheet-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.vn-pwa-sheet-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #eddcc6;
  object-fit: cover;
  flex-shrink: 0;
}

.vn-pwa-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--vn-pwa-text);
  margin: 0 0 2px 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-pwa-sheet-subtitle {
  font-size: 12px;
  color: var(--vn-pwa-text-muted);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-pwa-sheet-close {
  background: #f3ece3;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6e5e55;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.15s, color 0.15s;
}

.vn-pwa-sheet-close:active {
  background: #e2d7c9;
  color: #2c1810;
}

/* Browser Specific Notice Card */
.vn-pwa-browser-notice {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vn-pwa-browser-notice strong {
  color: #0f172a;
}

.vn-pwa-browser-notice.chrome {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.vn-pwa-browser-notice.chrome strong {
  color: #1d4ed8;
}

/* Step Cards */
.vn-pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px 0;
}

.vn-pwa-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--vn-pwa-card-bg);
  border: 1px solid var(--vn-pwa-border);
  border-radius: 12px;
  padding: 10px 12px;
  box-sizing: border-box;
}

.vn-pwa-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--vn-pwa-primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.vn-pwa-step-body {
  flex: 1;
  min-width: 0;
}

.vn-pwa-step-heading {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--vn-pwa-text);
  margin: 0 0 3px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.vn-pwa-step-text {
  font-size: 12px;
  color: var(--vn-pwa-text-muted);
  line-height: 1.35;
  margin: 0;
}

/* Share Badges */
.vn-pwa-share-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #007aff;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.vn-pwa-share-badge.chrome-badge {
  background: #1a73e8;
}

.vn-pwa-share-badge svg {
  stroke: #ffffff;
}

/* Compact Mock Previews */
.vn-pwa-mock-menu-row {
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid #ded6c8;
  border-radius: 7px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #1c1c1e;
}

.vn-pwa-mock-plus-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #2c2c2e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.vn-pwa-mock-topbar {
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid #ded6c8;
  border-radius: 7px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.vn-pwa-mock-add-btn {
  color: #007aff;
  font-weight: 700;
  font-size: 12px;
}

/* Sheet Footer */
.vn-pwa-sheet-footer {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vn-pwa-btn-gotit {
  background: linear-gradient(135deg, var(--vn-pwa-primary) 0%, var(--vn-pwa-primary-dark) 100%);
  color: #ffffff;
  border: none;
  border-radius: 11px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 12px rgba(165, 42, 42, 0.28);
  transition: transform 0.15s, opacity 0.15s;
}

.vn-pwa-btn-gotit:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.vn-pwa-footer-dismiss {
  background: transparent;
  border: none;
  color: #8c7e75;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  text-align: center;
  text-decoration: underline;
}

/* Desktop & Tablet Modal */
@media (min-width: 600px) {
  #vn-pwa-bottom-sheet {
    bottom: 30px;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    transform: translateY(30px) scale(0.96);
    opacity: 0;
  }
  #vn-pwa-bottom-sheet.vn-active {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   3. Inline Instruction Card (on login.php)
   -------------------------------------------------------------------------- */
.vn-install-guide-card {
  background: linear-gradient(135deg, #fffdf8 0%, #fbf5ea 100%);
  border: 1.5px solid #e5c98d;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(165, 42, 42, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Outfit", sans-serif;
  color: #2c1810;
  animation: vnFadeIn 0.3s ease-out;
}

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

.vn-install-guide-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.vn-install-guide-badge-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: #d1070e;
}

.vn-install-guide-badge-btn {
  background: #d1070e;
  color: #ffffff;
  border: none;
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(209, 7, 14, 0.2);
}

.vn-install-guide-steps {
  font-size: 12.5px;
  line-height: 1.45;
  color: #3b2a22;
  margin-bottom: 4px;
}

.vn-install-guide-steps strong {
  color: #1a1512;
  font-weight: 600;
}

.vn-share-mini-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: #007aff;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  margin: 0 2px;
}

.vn-share-mini-icon svg {
  stroke: #ffffff;
  display: inline-block;
  vertical-align: -1px;
}

.vn-install-guide-note {
  font-size: 11px;
  color: #7f6c65;
  line-height: 1.3;
}
