/* Phase 10 — SW update banner + install guide */

.dz-pwa-chrome {
  position: relative;
  z-index: 960;
}

.dz-sw-update {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(100%, 480px);
  z-index: 960;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, var(--dz-primary, #350066) 0%, var(--dz-primary-dark, #5D189F) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(25, 6, 73, 0.28);
  border-radius: 0 0 10px 10px;
  direction: rtl;
  text-align: center;
}

.dz-sw-update__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: #fff;
  opacity: 0.95;
}

.dz-sw-update__icon .dz-ico {
  width: 18px;
  height: 18px;
}

.dz-sw-update__text {
  font-size: 0.82rem;
  font-weight: 700;
}

.dz-sw-update__btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--dz-primary, #350066);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.3;
}

.dz-sw-update__btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.dz-sw-update__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Force update — blocking modal (version.json force: true) */
.dz-sw-force-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  direction: rtl;
}

.dz-sw-force {
  width: min(100%, 340px);
  margin: 0;
  padding: 28px 20px 22px;
  border-radius: 16px;
  background: var(--dz-surface, #fff);
  color: var(--dz-text, #1a1a1a);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: dz-install-in 0.32s cubic-bezier(0.2, 1.1, 0.32, 1) both;
}

.dz-sw-force__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--dz-primary, #350066) 14%, transparent);
  color: var(--dz-primary, #350066);
}

.dz-sw-force__icon .dz-ico {
  width: 28px;
  height: 28px;
}

.dz-sw-force__title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dz-primary, #350066);
}

.dz-sw-force__msg {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--dz-text-muted, #666);
}

.dz-sw-force__btn {
  appearance: none;
  width: 100%;
  border: 0;
  margin: 0;
  padding: 13px 16px;
  min-height: 48px;
  border-radius: 999px;
  background: var(--dz-primary, #350066);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--dz-primary, #350066) 35%, transparent);
}

.dz-sw-force__btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.dz-sw-force__btn:focus-visible {
  outline: 2px solid var(--dz-primary-dark, #5D189F);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .dz-sw-force {
    background: var(--dz-surface, #1c1230);
    color: var(--dz-text, #f2f2f2);
  }

  .dz-sw-force__btn {
    background: var(--dz-primary-dark, #9f58e1);
  }
}

/* Install progress overlay — shared by nudge + profile */
.dz-install-progress-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  direction: rtl;
}

.dz-install-progress {
  width: min(100%, 320px);
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 28px 22px 22px;
  border-radius: 16px;
  box-sizing: border-box;
  text-align: center;
  background: var(--dz-surface, #fff);
  color: var(--dz-text, #1a1a1a);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  animation: dz-install-nudge-in 0.3s cubic-bezier(0.2, 1.1, 0.32, 1) both;
}

.dz-install-progress__brand {
  margin-bottom: 8px;
}

.dz-install-progress__logo {
  width: 56px;
  height: 56px;
}

.dz-install-progress__check {
  width: 52px;
  height: 52px;
  margin: 4px auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dz-status-ready, #00a651);
  color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--dz-status-ready, #00a651) 35%, transparent);
}

.dz-install-progress__check .dz-ico {
  width: 26px;
  height: 26px;
}

.dz-install-progress__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--dz-primary, #350066);
}

.dz-install-progress__status {
  margin: 0 0 16px;
  min-height: 2.6em;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--dz-text-muted, #666);
}

.dz-install-progress__track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--dz-primary, #350066) 12%, transparent);
}

.dz-install-progress__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dz-primary-dark, #5D189F), var(--dz-status-ready, #00a651));
  transition: width 0.12s linear;
}

.dz-install-progress__bar.is-done {
  background: var(--dz-status-ready, #00a651);
}

.dz-install-progress__pct {
  margin: 10px 0 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--dz-primary, #350066);
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
  .dz-install-progress {
    background: var(--dz-surface, #1c1230);
    color: var(--dz-text, #f2f2f2);
  }
}

/* Install nudge — centered modal + dim scrim (mobile only) */
.dz-install-nudge-backdrop {
  position: fixed;
  inset: 0;
  z-index: 940;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  direction: rtl;
  animation: dz-install-nudge-scrim-in 0.25s ease both;
}

@keyframes dz-install-nudge-scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dz-install-nudge {
  width: min(100%, 340px);
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 26px 20px 18px;
  border-radius: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--dz-surface, #fff);
  color: var(--dz-text, #1a1a1a);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  animation: dz-install-nudge-in 0.35s cubic-bezier(0.2, 1.1, 0.32, 1) both;
}

@keyframes dz-install-nudge-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.dz-install-nudge__brand {
  margin-bottom: 10px;
}

.dz-install-nudge__logo {
  width: 56px;
  height: 56px;
}

.dz-install-nudge__title {
  margin: 0 0 8px;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--dz-primary, #350066);
  line-height: 1.4;
}

.dz-install-nudge__sub {
  margin: 0 0 18px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--dz-text-muted, #666);
}

.dz-install-nudge__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.dz-install-nudge__btn {
  appearance: none;
  border: 0;
  margin: 0;
  width: 100%;
  padding: 12px 16px;
  min-height: 46px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}

.dz-install-nudge__btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.dz-install-nudge__btn--primary {
  background: var(--dz-primary, #350066);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--dz-primary, #350066) 35%, transparent);
}

.dz-install-nudge__btn--ghost {
  background: transparent;
  color: var(--dz-text-muted, #666);
}

@media (prefers-color-scheme: dark) {
  .dz-install-nudge {
    background: var(--dz-surface, #1c1230);
    color: var(--dz-text, #f2f2f2);
  }

  .dz-install-nudge__btn--primary {
    background: var(--dz-primary-dark, #9f58e1);
  }
}

@media (min-width: 901px) {
  .dz-install-nudge-backdrop {
    display: none !important;
  }
}

/* Install guide modal */
.dz-install-guide-backdrop {
  z-index: 1200;
}

.dz-install-guide {
  position: relative;
  width: min(calc(100% - 32px), 360px);
  max-width: calc(100% - 32px);
  max-height: min(90vh, 640px);
  overflow: auto;
  margin: auto;
  padding: 22px 20px 18px;
  border-radius: 16px;
  box-sizing: border-box;
  background: var(--dz-surface, #fff);
  color: var(--dz-text, #1a1a1a);
  box-shadow: 0 16px 40px rgba(25, 6, 73, 0.22);
  direction: rtl;
  text-align: right;
  animation: dz-install-in 0.32s cubic-bezier(0.2, 1.1, 0.32, 1) both;
}

@keyframes dz-install-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dz-install-guide__close {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--dz-muted, #888);
  cursor: pointer;
  padding: 0;
}

.dz-install-guide__close .dz-ico {
  width: 20px;
  height: 20px;
}

.dz-install-guide__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.dz-install-guide__logo {
  width: 56px;
  height: 56px;
}

.dz-install-guide__title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dz-primary, #350066);
  text-align: center;
}

.dz-install-guide--steps {
  max-height: min(88vh, 560px);
  padding: 18px 16px 16px;
}

.dz-install-guide--steps .dz-install-guide__brand {
  margin-bottom: 4px;
}

.dz-install-guide--steps .dz-install-guide__logo {
  width: 44px;
  height: 44px;
}

.dz-install-guide--steps .dz-install-guide__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.dz-install-guide--steps .dz-install-guide__lead {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.dz-install-guide--steps .dz-install-guide__steps {
  gap: 10px;
  margin-bottom: 10px;
}

.dz-install-guide--steps .dz-install-guide__step-title {
  font-size: 0.84rem;
}

.dz-install-guide--steps .dz-install-guide__step-body {
  font-size: 0.78rem;
  line-height: 1.45;
}

.dz-install-guide--steps .dz-install-guide__note {
  margin: 0 0 12px;
  font-size: 0.7rem;
}

.dz-install-guide__lead {
  margin: 0 0 18px;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--dz-muted-text, #666);
  text-align: center;
}

.dz-install-guide__media {
  margin: 0 0 16px;
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--dz-primary, #350066) 8%, transparent);
  aspect-ratio: 16 / 10;
  max-height: 180px;
}

.dz-install-guide__clip {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: color-mix(in srgb, var(--dz-primary, #350066) 6%, transparent);
  border: 0;
}

.dz-install-guide__steps {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dz-install-guide__steps > li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.dz-install-guide__num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--dz-primary, #350066) 14%, transparent);
  color: var(--dz-primary, #350066);
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.dz-install-guide__step-title {
  margin: 0 0 2px;
  font-size: 0.88rem;
  font-weight: 700;
}

.dz-install-guide__step-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--dz-muted-text, #666);
}

.dz-install-guide__share {
  display: inline-flex;
  vertical-align: -3px;
  width: 16px;
  height: 16px;
  color: var(--dz-primary, #350066);
  margin-inline: 2px;
}

.dz-install-guide__share .dz-ico {
  width: 16px;
  height: 16px;
}

.dz-install-guide__note {
  margin: 0 0 14px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--dz-muted-text, #888);
  text-align: center;
}

.dz-install-guide__done {
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  .dz-install-guide {
    background: var(--dz-surface, #1c1230);
    color: var(--dz-text, #f2f2f2);
  }

  .dz-sw-update__btn {
    color: #190649;
  }
}
