/* baGPT — PWA / Add to Home Screen */
#bagpt-pwa-install-root {
  position: relative;
  z-index: 50200;
  pointer-events: none;
}

.bagpt-pwa-is-hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.bagpt-pwa-banner {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50210;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.bagpt-pwa-banner.bagpt-pwa-is-hidden {
  display: none !important;
  pointer-events: none !important;
}

.bagpt-pwa-banner[data-bagpt-pwa-banner="open"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.bagpt-pwa-banner__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px 10px 38px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #12121a;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 14px 40px -12px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.bagpt-pwa-banner__close {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 0.18s ease, color 0.18s ease;
}

.bagpt-pwa-banner__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
}

.bagpt-pwa-banner__icon {
  flex-shrink: 0;
  border-radius: 12px;
  pointer-events: none;
}

.bagpt-pwa-banner__text {
  flex: 1 1 140px;
  min-width: 0;
  text-align: right;
  pointer-events: none;
}

.bagpt-pwa-banner__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.bagpt-pwa-banner__body {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #e4e4e7;
}

.bagpt-pwa-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
  pointer-events: auto;
}

.bagpt-pwa-btn {
  position: relative;
  z-index: 1;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(45, 212, 191, 0.25);
}

.bagpt-pwa-btn--primary {
  background: linear-gradient(140deg, rgba(52, 216, 199, 0.22), rgba(70, 130, 180, 0.22));
  border-color: rgba(52, 216, 199, 0.4);
  color: #e0f7fa;
}

.bagpt-pwa-btn--primary:hover:not(:disabled) {
  background: rgba(129, 140, 255, 0.6);
}

.bagpt-pwa-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bagpt-pwa-btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.88);
}

.bagpt-pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 50220;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: auto;
}

.bagpt-pwa-sheet.bagpt-pwa-is-hidden {
  display: none !important;
  pointer-events: none !important;
}

body.bagpt-pwa-sheet-open {
  overflow: hidden;
}

body.bagpt-pwa-sheet-open--stack #bagpt-settings-modal.is-open {
  pointer-events: none;
}

body.bagpt-pwa-sheet-open--stack #bagpt-settings-modal.is-open .bagpt-settings-shell {
  opacity: 0.35;
}

.bagpt-pwa-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.bagpt-pwa-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: min(88dvh, 640px);
  overflow-y: auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  background: #0c0c10;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5);
  text-align: right;
  pointer-events: auto;
}

.bagpt-pwa-sheet__title {
  margin: 0 0 14px;
  padding-inline-end: 40px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.bagpt-pwa-sheet__close {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.bagpt-pwa-sheet__block h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.bagpt-pwa-sheet__block p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.55);
}

.bagpt-pwa-sheet__steps {
  margin: 0;
  padding: 0 1.1em 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
}

.bagpt-pwa-sheet__hint {
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.42) !important;
}

.bagpt-pwa-sheet__hint--warn {
  color: rgba(251, 191, 36, 0.85) !important;
  line-height: 1.65;
}

/* صفحه AI Studio — هم‌خوان با کروم تیره/شیشه‌ای استودیو (نه باکس teal پایین صفحه) */
body.bagpt-ai-studio-body .bagpt-pwa-banner {
  top: calc(10px + env(safe-area-inset-top, 0px));
  bottom: auto;
  left: 50%;
  right: auto;
  width: min(calc(100vw - 24px), 520px);
  transform: translateX(-50%);
}

body.bagpt-ai-studio-body .bagpt-pwa-banner__inner {
  padding: 10px 14px 10px 38px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background: #1a1528;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 12px 36px -10px rgba(0, 0, 0, 0.8);
}

body.bagpt-ai-studio-body .bagpt-pwa-banner__title {
  color: #fff;
}

body.bagpt-ai-studio-body .bagpt-pwa-banner__body {
  color: #ede9fe;
}

body.bagpt-ai-studio-body .bagpt-pwa-btn--primary {
  background: linear-gradient(140deg, rgba(100, 149, 237, 0.22), rgba(70, 130, 180, 0.14));
  border-color: rgba(100, 149, 237, 0.38);
  color: #e0f7fa;
}

body.bagpt-ai-studio-body .bagpt-pwa-btn--primary:hover:not(:disabled) {
  background: linear-gradient(140deg, rgba(100, 149, 237, 0.45), rgba(70, 130, 180, 0.32));
  border-color: rgba(100, 149, 237, 0.55);
}
