/**
 * assets/css/pwa.css — CarVerify Pro PWA Styles
 * Covers: offline bar, install banner (Android),
 *         iOS hint, update banner, sidebar install button
 */

/* ─────────────────────────────────────────────────────────
   OFFLINE BAR — top strip when no connection
   ───────────────────────────────────────────────────────── */
#cvp-offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #DC2626;
  color: #fff;
  text-align: center;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  letter-spacing: 0.2px;
}

#cvp-offline-bar.cvp-offline-bar--visible {
  transform: translateY(0);
}

/* Push content down when offline bar shows */
#cvp-offline-bar.cvp-offline-bar--visible ~ * .cvp-topbar,
#cvp-offline-bar.cvp-offline-bar--visible ~ .cvp-shell .cvp-topbar {
  top: 36px;
}

/* ─────────────────────────────────────────────────────────
   SHARED BANNER BASE
   ───────────────────────────────────────────────────────── */
#cvp-install-banner,
#cvp-ios-hint,
#cvp-update-banner {
  position: fixed;
  z-index: 9990;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  opacity: 0;
}

#cvp-install-banner.cvp-banner--visible,
#cvp-ios-hint.cvp-banner--visible,
#cvp-update-banner.cvp-banner--visible {
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────
   INSTALL BANNER (Android / Chrome)
   ───────────────────────────────────────────────────────── */
#cvp-install-banner {
  bottom: calc(80px + env(safe-area-inset-bottom));
  width: calc(100vw - 32px);
  max-width: 480px;
  background: #FDF8F0;
  border: 1px solid #E2D5C4;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
}

.cvp-install-inner,
.cvp-ios-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.cvp-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}

.cvp-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cvp-install-text strong {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #2C2A28;
}

.cvp-install-text span {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  color: #8B7A66;
  line-height: 1.4;
}

.cvp-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cvp-btn-install {
  background: #C67B2E;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.cvp-btn-install:hover { background: #B56A1E; }
.cvp-btn-install:active { transform: scale(0.96); }

.cvp-btn-dismiss {
  background: none;
  border: none;
  color: #8B7A66;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.cvp-btn-dismiss:hover {
  color: #2C2A28;
  background: rgba(0,0,0,0.05);
}

/* ─────────────────────────────────────────────────────────
   iOS HINT BANNER — bottom with arrow pointing to Share
   ───────────────────────────────────────────────────────── */
#cvp-ios-hint {
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: calc(100vw - 32px);
  max-width: 400px;
  background: #FDF8F0;
  border: 1px solid #E2D5C4;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.cvp-ios-arrow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 10px;
  overflow: hidden;
}

.cvp-ios-arrow::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 20px;
  height: 20px;
  background: #FDF8F0;
  border-right: 1px solid #E2D5C4;
  border-bottom: 1px solid #E2D5C4;
}

.cvp-share-icon {
  font-size: 14px;
  display: inline-block;
  vertical-align: middle;
}

/* ─────────────────────────────────────────────────────────
   UPDATE BANNER — top of screen
   ───────────────────────────────────────────────────────── */
#cvp-update-banner {
  top: 12px;
  bottom: auto;
  transform: translateX(-50%) translateY(-120%);
  width: calc(100vw - 32px);
  max-width: 520px;
  background: #2C2A28;
  color: #FDF8F0;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
}

#cvp-update-banner.cvp-banner--visible {
  transform: translateX(-50%) translateY(0);
}

#cvp-update-banner span {
  flex: 1;
}

#cvp-update-btn {
  background: #C67B2E;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

#cvp-update-btn:hover { background: #B56A1E; }

#cvp-update-dismiss {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

#cvp-update-dismiss:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────
   SIDEBAR INSTALL BUTTON (injected by sidebar snippet)
   ───────────────────────────────────────────────────────── */
#cvp-sidebar-install-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #8B7A66;
  transition: all 0.2s;
  text-align: left;
}

#cvp-sidebar-install-btn:hover {
  background: #FCF5EA;
  color: #C67B2E;
  padding-left: 28px;
}

.cvp-sidebar-install-icon {
  width: 22px;
  height: 22px;
  color: #C67B2E;
  flex-shrink: 0;
}

.cvp-sidebar-install-badge {
  margin-left: auto;
  background: #C67B2E;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────
   PWA SPLASH / STANDALONE MODE TWEAKS
   ───────────────────────────────────────────────────────── */

/* When running as standalone PWA, remove browser chrome gaps */
@media (display-mode: standalone) {
  body {
    /* Prevent rubber-band overscroll on iOS */
    overscroll-behavior: none;
  }

  /* iOS status bar area (safe-area) */
  .cvp-sidebar {
    padding-top: env(safe-area-inset-top);
  }

  .cvp-topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(64px + env(safe-area-inset-top));
  }

  .cvp-mobile-nav,
  .cvp-bot-nav {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  /* On desktop, install banner sits above bottom-left */
  #cvp-install-banner {
    bottom: 24px;
    left: calc(280px + 24px); /* clear the sidebar */
    transform: translateX(0) translateY(120%);
  }

  #cvp-install-banner.cvp-banner--visible {
    transform: translateX(0) translateY(0);
  }

  #cvp-ios-hint {
    bottom: 24px;
    left: calc(280px + 24px);
    transform: translateX(0) translateY(120%);
  }

  #cvp-ios-hint.cvp-banner--visible {
    transform: translateX(0) translateY(0);
  }
}