/* Parent portal PWA: install guide, card QR scanner, install bar, login hub. */

.sls-pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sls-pwa-modal[hidden] { display: none; }

.sls-pwa-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
}

.sls-pwa-modal__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  color: #0f172a;
  border-radius: 20px;
  box-shadow: 0 24px 60px -18px rgba(15, 23, 42, .45);
  animation: sls-pwa-pop .18s ease-out;
}

@keyframes sls-pwa-pop {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sls-pwa-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.sls-pwa-modal__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sls-pwa-modal__brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px #e2e8f0;
}
.sls-pwa-modal__brand h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.sls-pwa-modal__head-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e6f2f4;
  color: #0f6674;
  font-size: 1.15rem;
}

.sls-pwa-modal__close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
}
.sls-pwa-modal__close:hover { background: #e2e8f0; color: #0f172a; }

.sls-pwa-modal__body { padding: 16px; }

.sls-pwa-modal__hint {
  margin: 0 0 14px;
  color: #475569;
  font-size: .92rem;
  line-height: 1.6;
}

.sls-pwa-modal__note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: .85rem;
  line-height: 1.55;
}
.sls-pwa-modal__note[hidden] { display: none; }

.sls-pwa-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.sls-pwa-modal__actions > * { flex: 1 1 140px; }

.sls-pwa-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.sls-pwa-steps[hidden] { display: none; }
.sls-pwa-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.55;
}
.sls-pwa-steps__icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #e6f2f4;
  color: #0f6674;
}

.sls-pwa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sls-pwa-btn:hover { background: #f8fafc; }
.sls-pwa-btn--primary {
  border-color: #0f6674;
  background: #0f6674;
  color: #fff;
}
.sls-pwa-btn--primary:hover { background: #0c5561; }
.sls-pwa-btn--ghost {
  border-color: #0f6674;
  color: #0f6674;
}
.sls-pwa-btn[disabled] { opacity: .55; cursor: wait; }

/* Installed → open the app hand-off */
.sls-pwa-open { text-align: center; }
.sls-pwa-open__icon {
  position: relative;
  width: 96px;
  height: 96px;
  margin: .25rem auto .75rem;
  display: grid;
  place-items: center;
}
.sls-pwa-open__icon img {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(15, 102, 116, .25);
}
.sls-pwa-open__check {
  position: absolute;
  inset-block-end: -2px;
  inset-inline-end: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #16a34a;
  color: #fff;
  font-size: .85rem;
  border: 3px solid #fff;
}
.sls-pwa-open__spin {
  position: absolute;
  inset: -4px;
  border-radius: 26px;
  border: 3px solid rgba(238, 138, 42, .25);
  border-top-color: #ee8a2a;
  animation: sls-pwa-spin 1s linear infinite;
}
.sls-pwa-open__check[hidden], .sls-pwa-open__spin[hidden] { display: none; }
.sls-pwa-open__status {
  margin: 0 0 .35rem;
  font-weight: 800;
  color: #0f6674;
}
.sls-pwa-open .sls-pwa-modal__actions { flex-direction: column; }
.sls-pwa-open .sls-pwa-modal__actions .sls-pwa-btn { width: 100%; justify-content: center; }
@keyframes sls-pwa-spin { to { transform: rotate(360deg); } }

/* Scanner */
.sls-pwa-scan__frame {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background: #0f172a;
}
.sls-pwa-scan__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sls-pwa-scan__corners {
  position: absolute;
  inset: 14%;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .35);
  background:
    linear-gradient(#ee8a2a, #ee8a2a) top left / 28px 4px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) top left / 4px 28px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) top right / 28px 4px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) top right / 4px 28px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) bottom left / 28px 4px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) bottom left / 4px 28px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) bottom right / 28px 4px no-repeat,
    linear-gradient(#ee8a2a, #ee8a2a) bottom right / 4px 28px no-repeat;
}
.sls-pwa-scan__line {
  position: absolute;
  inset-inline: 18%;
  top: 16%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ee8a2a, transparent);
  animation: sls-pwa-scanline 2.2s ease-in-out infinite;
}
@keyframes sls-pwa-scanline {
  0%, 100% { top: 16%; }
  50% { top: 84%; }
}
.sls-pwa-scan__frame.is-off .sls-pwa-scan__line { display: none; }
.sls-pwa-scan__frame.is-off::after {
  content: "\f030";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  color: rgba(255, 255, 255, .35);
}

.sls-pwa-scan__status {
  margin: 12px 0 0;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  color: #0f6674;
  min-height: 1.4em;
}
.sls-pwa-scan__status.is-error { color: #b91c1c; }

@media (prefers-reduced-motion: reduce) {
  .sls-pwa-scan__line, .sls-pwa-modal__panel { animation: none; }
}

body.sls-pwa-modal-open { overflow: hidden; }

/* Bottom install bar (mobile only, dismissible) */
.sls-pwa-bar {
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 10040;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 18px;
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 40px -14px rgba(15, 23, 42, .4);
  transform: translateY(140%);
  transition: transform .28s ease;
}
.sls-pwa-bar.is-visible { transform: none; }
body.sls-portal-app .sls-pwa-bar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.sls-pwa-bar__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px #e2e8f0;
}
.sls-pwa-bar__copy {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  line-height: 1.3;
}
.sls-pwa-bar__copy strong { font-size: .9rem; }
.sls-pwa-bar__copy small { font-size: .78rem; color: #64748b; }
.sls-pwa-bar__install {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  background: #0f6674;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
/* Login hub */
.sls-pwa-hub {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px;
  border-radius: 16px;
  background: #f0f7f8;
  border: 1px solid #cfe4e8;
}
.sls-pwa-hub__scan { width: 100%; justify-content: center; }
.sls-pwa-hub__hint { margin: 0; font-size: .85rem; color: #475569; text-align: center; }
.sls-pwa-hub__install { width: 100%; justify-content: center; }
.sls-pwa-hub__install[hidden] { display: none; }

.sls-pwa-saved[hidden] { display: none; }
.sls-pwa-saved__title { margin: 4px 0 6px; font-weight: 700; font-size: .88rem; color: #0f6674; }
.sls-pwa-saved__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sls-pwa-saved__item { display: flex; align-items: center; gap: 6px; }
.sls-pwa-saved__open {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 600;
  text-decoration: none;
}
.sls-pwa-saved__open:hover { border-color: #0f6674; }
.sls-pwa-saved__forget {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}

.sls-portal-settings-item__icon--pwa { background: #e6f2f4; color: #0f6674; }
.sls-portal-settings-item[hidden] { display: none !important; }

/* Launch splash (installed app only, once per session) */
.sls-pwa-splash { display: none; }
html.sls-pwa-splash-on .sls-pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: grid;
  place-items: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(120% 70% at 50% 0%, #e7f3f5 0%, rgba(231, 243, 245, 0) 60%),
    radial-gradient(90% 60% at 50% 100%, #fff1e3 0%, rgba(255, 241, 227, 0) 65%),
    #ffffff;
  animation: sls-pwa-splash-out .5s ease 19.5s forwards;
  cursor: pointer;
}
html.sls-pwa-splash-on .sls-pwa-splash.is-leaving {
  animation: sls-pwa-splash-out .35s ease forwards;
}
html.sls-pwa-splash-on body { overflow: hidden; }
.sls-pwa-splash__inner {
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.sls-pwa-splash__logo {
  width: min(78vw, 320px);
  height: auto;
  animation: sls-pwa-splash-logo .7s cubic-bezier(.2, .8, .2, 1) both;
}
.sls-pwa-splash__community {
  margin: 26px 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f6674;
  animation: sls-pwa-splash-text .6s ease .35s both;
}
.sls-pwa-splash__slogan {
  margin: 0 auto;
  max-width: 340px;
  font-size: 1rem;
  line-height: 1.85;
  color: #334155;
  animation: sls-pwa-splash-text .6s ease .55s both;
}
.sls-pwa-splash__slogan span { display: block; }
.sls-pwa-splash__slogan span:last-child { color: #ea7a1c; font-weight: 700; }
.sls-pwa-splash__loader {
  display: inline-flex;
  gap: 6px;
  margin-top: 28px;
}
.sls-pwa-splash__loader i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0f6674;
  animation: sls-pwa-dot 1s ease-in-out infinite;
}
.sls-pwa-splash__loader i:nth-child(2) { background: #ee8a2a; animation-delay: .15s; }
.sls-pwa-splash__loader i:nth-child(3) { animation-delay: .3s; }
.sls-pwa-splash__quote {
  position: relative;
  margin: 22px auto 0;
  max-width: 360px;
  min-height: 92px;
  padding: 16px 18px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(15, 102, 116, .14);
  box-shadow: 0 8px 24px rgba(15, 102, 116, .08);
  display: grid;
  place-items: center;
  animation: sls-pwa-splash-text .6s ease .8s both;
}
.sls-pwa-splash__quote-mark {
  position: absolute;
  top: -11px;
  inset-inline-start: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .7rem;
  color: #fff;
  background: #ea7a1c;
}
.sls-pwa-splash__quote blockquote {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.9;
  color: #0f6674;
  transition: opacity .45s ease, transform .45s ease;
}
.sls-pwa-splash__quote blockquote.is-swapping {
  opacity: 0;
  transform: translateY(6px);
}
.sls-pwa-splash__progress {
  display: block;
  width: min(60vw, 220px);
  height: 4px;
  margin: 18px auto 0;
  border-radius: 999px;
  background: rgba(15, 102, 116, .12);
  overflow: hidden;
}
.sls-pwa-splash__progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f6674, #ea7a1c);
  transform-origin: right center;
  animation: sls-pwa-splash-progress 19.5s linear forwards;
}
[dir="ltr"] .sls-pwa-splash__progress i { transform-origin: left center; }
.sls-pwa-splash__skip {
  margin: 12px 0 0;
  font-size: .78rem;
  color: #94a3b8;
  animation: sls-pwa-splash-text .6s ease 3s both;
}
@keyframes sls-pwa-splash-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes sls-pwa-splash-out {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
@keyframes sls-pwa-splash-logo {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes sls-pwa-splash-text {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes sls-pwa-dot {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sls-pwa-splash__logo, .sls-pwa-splash__community, .sls-pwa-splash__slogan, .sls-pwa-splash__loader i,
  .sls-pwa-splash__quote, .sls-pwa-splash__skip { animation: none; }
  .sls-pwa-splash__quote blockquote { transition: none; }
}

/* Dark theme */
[data-portal-theme="dark"] .sls-pwa-modal__panel,
[data-portal-theme="dark"] .sls-pwa-bar { background: #0f172a; color: #e2e8f0; border-color: #1e293b; }
[data-portal-theme="dark"] .sls-pwa-modal__head { border-color: #1e293b; }
[data-portal-theme="dark"] .sls-pwa-modal__hint,
[data-portal-theme="dark"] .sls-pwa-bar__copy small,
[data-portal-theme="dark"] .sls-pwa-hub__hint { color: #94a3b8; }
[data-portal-theme="dark"] .sls-pwa-modal__close { background: #1e293b; color: #cbd5e1; }
[data-portal-theme="dark"] .sls-pwa-steps li { border-color: #1e293b; }
[data-portal-theme="dark"] .sls-pwa-btn { background: #0f172a; color: #e2e8f0; border-color: #334155; }
[data-portal-theme="dark"] .sls-pwa-btn--primary { background: #0f6674; border-color: #0f6674; color: #fff; }
[data-portal-theme="dark"] .sls-pwa-btn--ghost { color: #5eead4; border-color: #0f6674; }
[data-portal-theme="dark"] .sls-pwa-hub { background: #0b2530; border-color: #164e5a; }
[data-portal-theme="dark"] .sls-pwa-saved__open,
[data-portal-theme="dark"] .sls-pwa-saved__forget { background: #0f172a; border-color: #1e293b; color: #e2e8f0; }
[data-portal-theme="dark"] .sls-pwa-modal__note { background: #3b2410; color: #fdba74; }
