/* CleanForm PWA install banner + promo section */

html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

.cf-pwa-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10050;
  width: 100%;
  max-width: 100%;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  box-sizing: border-box;
}

.cf-pwa-banner.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}

.cf-pwa-banner__inner {
  width: 100%;
  max-width: min(480px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f2744 0%, #1e3a5f 100%);
  border: 1px solid rgba(45, 212, 191, 0.35);
  box-shadow: 0 16px 40px rgba(15, 39, 68, 0.45);
  color: #fff;
  box-sizing: border-box;
}

.cf-pwa-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

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

.cf-pwa-banner__text strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.cf-pwa-banner__text span {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

.cf-pwa-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

@media (max-width: 520px) {
  .cf-pwa-banner__inner {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    padding: 12px 14px;
  }

  .cf-pwa-banner__icon {
    align-self: center;
  }

  .cf-pwa-banner__text {
    text-align: center;
  }

  .cf-pwa-banner__actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .cf-pwa-banner__install {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
}

.cf-pwa-banner__install {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.cf-pwa-banner__dismiss {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 4px;
}

.cf-pwa-ios-sheet {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 39, 68, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  box-sizing: border-box;
}

.cf-pwa-ios-sheet.is-open {
  display: flex;
}

.cf-pwa-ios-sheet__panel {
  width: min(420px, 100%);
  max-height: min(85vh, calc(100dvh - 32px - env(safe-area-inset-bottom, 0px)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 20px 20px 12px 12px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.cf-pwa-ios-sheet__panel h3 {
  font-size: 1.05rem;
  color: #0f2744;
  margin-bottom: 8px;
}

.cf-pwa-ios-sheet__panel p {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 12px;
}

.cf-pwa-ios-sheet__panel ol {
  margin: 0 0 16px 18px;
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.55;
}

.cf-pwa-ios-sheet__close {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
  background: #0f2744;
  color: #fff;
  cursor: pointer;
}

/* Splash promo section */
.pwa-promo {
  padding: clamp(40px, 8vw, 72px) 0;
  background: linear-gradient(180deg, #ecfdf5 0%, #f8fafc 50%, #ffffff 100%);
  border-top: 1px solid rgba(34, 197, 94, 0.15);
  border-bottom: 1px solid rgba(34, 197, 94, 0.1);
  overflow-x: hidden;
  max-width: 100%;
}

.pwa-promo .container {
  max-width: 100%;
  box-sizing: border-box;
}

.pwa-promo__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 32px);
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.pwa-promo__main {
  min-width: 0;
  max-width: 100%;
}

.pwa-promo__state[hidden] {
  display: none !important;
}

.pwa-promo__eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #059669;
  margin-bottom: 10px;
}

.pwa-promo h2 {
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: #0f2744;
  margin-bottom: 12px;
  line-height: 1.15;
}

.pwa-promo__lead {
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 18px;
}

.pwa-promo__list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.pwa-promo__list li {
  font-size: 0.9rem;
  color: #334155;
  padding-left: 26px;
  position: relative;
}

.pwa-promo__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 800;
}

.pwa-promo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pwa-promo__actions .btn {
  max-width: 100%;
  box-sizing: border-box;
}

.pwa-promo__installed-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dcfce7, #ccfbf1);
  border: 1px solid #86efac;
  color: #065f46;
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.pwa-promo__installed-badge svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.pwa-promo.is-installed {
  background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%);
}

.pwa-promo__card {
  background: linear-gradient(160deg, #0f2744 0%, #1e3a5f 100%);
  border-radius: 20px;
  padding: clamp(16px, 4vw, 28px) clamp(14px, 3vw, 24px);
  color: #fff;
  box-shadow: 0 20px 50px rgba(15, 39, 68, 0.2);
  border: 1px solid rgba(45, 212, 191, 0.25);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.pwa-promo__phone {
  width: min(280px, 100%);
  margin: 0 auto 16px;
  border-radius: 24px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pwa-promo__phone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pwa-promo__phone-head img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.pwa-promo__phone-head strong {
  font-size: 0.88rem;
}

.pwa-promo__phone-head span {
  display: block;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
}

.pwa-promo__offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  margin-bottom: 10px;
}

.pwa-promo__card p {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

@media (max-width: 860px) {
  .pwa-promo__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pwa-promo__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .pwa-promo__actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (min-width: 768px) {
  .cf-pwa-banner {
    left: auto;
    right: max(12px, env(safe-area-inset-right, 12px));
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    width: min(380px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    padding: 0;
  }
}

@media (display-mode: standalone) {
  .cf-pwa-banner,
  .cf-pwa-modal,
  .pwa-promo__actions [data-pwa-install-trigger] {
    display: none !important;
  }
}

html[data-pwa-installed] .cf-pwa-banner,
html[data-pwa-installed] .cf-pwa-modal,
html[data-pwa-installed] [data-pwa-install-trigger],
html[data-pwa-installed] .cf-pwa-install-chip {
  display: none !important;
}

html[data-pwa-installed] [data-pwa-promo-install],
html[data-pwa-installed] [data-pwa-promo-card-install] {
  display: none !important;
}

html[data-pwa-installed] [data-pwa-promo-installed],
html[data-pwa-installed] [data-pwa-promo-card-installed] {
  display: block !important;
}

html[data-pwa-installed] .pwa-promo {
  background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%);
}

.nav__link--pwa-installed {
  color: #059669 !important;
  font-weight: 700;
}

/* Full-screen install modal */
.cf-pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: max(12px, env(safe-area-inset-top, 12px)) 12px max(12px, env(safe-area-inset-bottom, 12px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.cf-pwa-modal.is-open {
  display: flex;
}

.cf-pwa-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 39, 68, 0.62);
  backdrop-filter: blur(4px);
}

.cf-pwa-modal__panel {
  position: relative;
  width: min(420px, 100%);
  max-width: 100%;
  max-height: min(90vh, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 24px;
  padding: 28px 24px 24px;
  box-shadow: 0 32px 80px rgba(15, 39, 68, 0.35);
  text-align: center;
  animation: cfPwaModalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
  margin: auto;
}

@keyframes cfPwaModalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cf-pwa-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
}

.cf-pwa-modal__icon-wrap {
  margin-bottom: 12px;
}

.cf-pwa-modal__icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #f8fafc;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.12);
}

.cf-pwa-modal__eyebrow {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #059669;
}

.cf-pwa-modal__panel h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  color: #0f2744;
  line-height: 1.2;
}

.cf-pwa-modal__body {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.55;
}

.cf-pwa-modal__features {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  text-align: left;
  display: grid;
  gap: 8px;
}

.cf-pwa-modal__features li {
  font-size: 0.86rem;
  color: #334155;
  padding-left: 22px;
  position: relative;
}

.cf-pwa-modal__features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 800;
}

.cf-pwa-modal__actions {
  display: grid;
  gap: 8px;
}

.cf-pwa-modal__install {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  color: #fff;
  cursor: pointer;
}

.cf-pwa-modal__later {
  appearance: none;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.86rem;
  cursor: pointer;
  padding: 8px;
}

/* Compact chip for optional manual trigger */
.cf-pwa-install-chip {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: max(12px, env(safe-area-inset-right, 12px));
  z-index: 9998;
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  background: linear-gradient(135deg, #0f2744, #1e3a5f);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.35);
  cursor: pointer;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.cf-pwa-install-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 10051;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(360px, calc(100% - 24px));
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f2744 0%, #1e3a5f 100%);
  border: 1px solid rgba(45, 212, 191, 0.35);
  box-shadow: 0 20px 50px rgba(15, 39, 68, 0.45);
  color: #fff;
  transform: translateX(-50%) translateY(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  pointer-events: none;
  box-sizing: border-box;
}

.cf-pwa-install-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.cf-pwa-install-toast__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.cf-pwa-install-toast__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cf-pwa-install-toast__text strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.cf-pwa-install-toast__text span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
}
