/* Ненавязчивый баннер «доступно обновление» — киоск и операторские страницы */

#wespUpdateBanner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4500;
  display: none;
  box-sizing: border-box;
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.97), rgba(29, 78, 216, 0.98));
  color: #f8fafc;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

#wespUpdateBanner.wesp-update-banner--visible {
  display: block;
}

#wespUpdateBanner .wesp-update-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

#wespUpdateBanner .wesp-update-banner-text {
  flex: 1 1 200px;
  min-width: 0;
}

#wespUpdateBanner .wesp-update-banner-text strong {
  font-weight: 600;
}

#wespUpdateBanner .wesp-update-banner-changelog {
  display: none;
  width: 100%;
  margin: 4px 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow: auto;
}

#wespUpdateBanner.wesp-update-banner--expanded .wesp-update-banner-changelog {
  display: block;
}

#wespUpdateBanner .wesp-update-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#wespUpdateBanner .wesp-update-banner-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#wespUpdateBanner .wesp-update-banner-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

#wespUpdateBanner .wesp-update-banner-btn--primary {
  background: #fff;
  color: #1d4ed8;
  border-color: #fff;
}

#wespUpdateBanner .wesp-update-banner-btn--primary:hover {
  background: #eff6ff;
}

#wespUpdateOverlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.72);
  box-sizing: border-box;
}

#wespUpdateOverlay.wesp-update-overlay--visible {
  display: flex;
}

#wespUpdateOverlay .wesp-update-overlay-panel {
  background: #fff;
  color: #111827;
  border-radius: 10px;
  padding: 24px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

#wespUpdateOverlay .wesp-update-overlay-title {
  margin: 0 0 10px;
  font-size: 1.125rem;
  font-weight: 600;
}

#wespUpdateOverlay .wesp-update-overlay-body {
  margin: 0 0 16px;
  font-size: 0.95rem;
  color: #4b5563;
  line-height: 1.5;
}

#wespUpdateOverlay .wesp-update-progress-wrap {
  text-align: left;
}

#wespUpdateOverlay .wesp-update-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

#wespUpdateOverlay .wesp-update-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--primary-color, #2196f3),
    var(--primary-dark, #1976d2)
  );
  transition: width 0.25s ease;
}

#wespUpdateOverlay .wesp-update-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: #6b7280;
}

#wespUpdateOverlay .wesp-update-progress-percent {
  font-weight: 600;
  color: #1d4ed8;
  flex-shrink: 0;
}

#wespUpdateOverlay .wesp-update-progress-detail {
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-overlay-panel {
  background: #242424;
  color: #f3f4f6;
}

#wespUpdateOverlay .wesp-update-progress-bar.wesp-update-progress-bar--error {
  background: linear-gradient(90deg, #dc2626, #b91c1c);
}

#wespUpdateOverlay .wesp-update-overlay-panel--rollback {
  border: 1px solid #fecaca;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-overlay-panel--rollback {
  border-color: #7f1d1d;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-overlay-body {
  color: #d1d5db;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-progress-track {
  background: #374151;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-progress-meta {
  color: #9ca3af;
}

html[data-theme="dark"] #wespUpdateOverlay .wesp-update-progress-percent {
  color: #93c5fd;
}

@media (max-width: 480px) {
  #wespUpdateBanner .wesp-update-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  #wespUpdateBanner .wesp-update-banner-actions {
    justify-content: stretch;
  }
  #wespUpdateBanner .wesp-update-banner-btn {
    flex: 1;
    text-align: center;
  }
}
