/* === Modal (førstegangsbesøk) === */
.kompf-push-modal[hidden] {
  display: none;
}

.kompf-push-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kompf-push-modal.is-open {
  opacity: 1;
}

.kompf-push-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 52, 89, 0.55);
  backdrop-filter: blur(2px);
}

.kompf-push-modal__panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 2.25rem 2rem 1.75rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1);
}

.kompf-push-modal.is-open .kompf-push-modal__panel {
  transform: translateY(0) scale(1);
}

/* Animasjon når modal "suser" ned i hjørnet */
.kompf-push-modal.is-closing-to-widget .kompf-push-modal__backdrop {
  opacity: 0;
  transition: opacity 0.45s ease;
}

.kompf-push-modal.is-closing-to-widget .kompf-push-modal__panel {
  transform-origin: bottom right;
  transform: translate(40vw, 35vh) scale(0.15);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.6, 0.05, 0.35, 1), opacity 0.5s ease;
}

.kompf-push-modal__icon {
  display: block;
  font-size: 40px;
  margin-bottom: 0.5rem;
}

.kompf-push-modal__title {
  margin: 0 0 0.6em;
  font-size: 22px;
  font-weight: 700;
  color: #033459;
  line-height: 1.25;
}

.kompf-push-modal__body {
  margin: 0 0 1.5em;
  font-size: 15px;
  line-height: 1.55;
  color: #333;
}

.kompf-push-modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.kompf-push-modal__accept,
.kompf-push-modal__dismiss {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 0.7em 1.5em;
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.kompf-push-modal__accept {
  background: #033459;
  color: #fff;
}
.kompf-push-modal__accept:hover {
  background: #022540;
  transform: translateY(-1px);
}

.kompf-push-modal__dismiss {
  background: transparent;
  color: #666;
  border: 1px solid #e5e5e5;
}
.kompf-push-modal__dismiss:hover {
  color: #033459;
  border-color: #033459;
}

body.kompf-push-modal-open {
  overflow: hidden;
}

/* === Hjelpe-modal (når varsler er blokkert i nettleseren) === */
.kompf-push-help[hidden] { display: none; }
.kompf-push-help {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.kompf-push-help.is-open {
  opacity: 1;
  visibility: visible;
}
/* Panelet — sentreres vertikalt så lenge det får plass, ellers scroller modal-containeren */
.kompf-push-help__panel {
  margin: auto;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}
.kompf-push-help__intro {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  flex: 0 0 auto;
}
/* Steg-listen tar tilgjengelig høyde og får egen scroll om innholdet er for langt */
.kompf-push-help__steps {
  margin: 0 0 1.5rem;
  padding: 0 0 0 1.25rem;
  font-size: 14px;
  line-height: 1.55;
  color: #033459;
  text-align: left;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.kompf-push-help__steps li {
  margin-bottom: 0.55rem;
}
.kompf-push-help__steps li:last-child {
  margin-bottom: 0;
}
/* Knappene må alltid være synlige nederst */
.kompf-push-help .kompf-push-modal__actions {
  flex: 0 0 auto;
  margin-top: 0;
}

/* Landscape mobil: kompakter padding og skjul ikon-emoji når plass er knapp */
@media (max-height: 480px) {
  .kompf-push-help__panel {
    padding: 1rem 1.25rem !important;
  }
  .kompf-push-help__panel .kompf-push-modal__icon {
    display: none;
  }
  .kompf-push-help__panel .kompf-push-modal__title {
    font-size: 18px !important;
    margin-bottom: 0.5rem !important;
  }
  .kompf-push-help__intro {
    margin-bottom: 0.6rem;
  }
  .kompf-push-help__steps {
    margin-bottom: 0.85rem;
  }
}

/* Bjellen i 'blokkert'-tilstand: tonet ned, men fortsatt klikkbar */
.kompf-push-toggle.is-denied {
  background: #f5f5f5;
  color: #6f6f6f;
  border: 1px solid #d8d8d8;
}
.kompf-push-toggle.is-denied:hover,
.kompf-push-toggle.is-denied:focus {
  background: #ececec;
  color: #033459;
  border-color: var(--kompf-orange, #F4A100);
}
.kompf-push-toggle.is-denied .kompf-push-toggle__icon {
  filter: grayscale(0.6);
}

/* === Floating widget (etter dismiss eller fallback) === */
.kompf-push-widget[hidden] {
  display: none;
}

.kompf-push-widget {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 99999;
}

.kompf-push-widget.is-entering .kompf-push-toggle {
  animation: kompf-push-pop-in 0.55s cubic-bezier(0.6, 0.05, 0.35, 1) backwards;
}

@keyframes kompf-push-pop-in {
  from {
    transform: translate(40vw, -35vh) scale(2.4);
    opacity: 0;
  }
  60% {
    transform: translate(0, 0) scale(1.05);
    opacity: 1;
  }
  to {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}

.kompf-push-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.7rem 1.1rem;
  background: #033459;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(3, 52, 89, 0.25);
  transition: padding 0.35s ease, background 0.2s ease, transform 0.15s ease, max-width 0.4s cubic-bezier(0.6, 0.05, 0.35, 1);
  max-width: 320px;
  overflow: hidden;
  white-space: nowrap;
}

.kompf-push-toggle:hover {
  background: #022540;
  transform: translateY(-1px);
}

.kompf-push-toggle:disabled {
  background: #999;
  cursor: not-allowed;
}

.kompf-push-toggle__icon {
  font-size: 18px;
  flex: 0 0 auto;
}

.kompf-push-toggle__label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Krympet til kun ikon */
.kompf-push-widget.is-collapsed .kompf-push-toggle {
  padding: 0;
  max-width: 48px;
  width: 48px;
  height: 48px;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.kompf-push-widget.is-collapsed .kompf-push-toggle__label {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.kompf-push-widget.is-collapsed .kompf-push-toggle__icon {
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Hover på kollapset utvider midlertidig */
.kompf-push-widget.is-collapsed .kompf-push-toggle:hover {
  max-width: 320px;
  padding: 0.7rem 1.1rem;
}

.kompf-push-widget.is-collapsed .kompf-push-toggle:hover .kompf-push-toggle__label {
  opacity: 1;
  width: auto;
  flex: 1 1 auto;
}

.kompf-push-toggle[aria-pressed="true"] {
  background: #22863a;
}

.kompf-push-toggle[aria-pressed="true"]:hover {
  background: #1c6e30;
}

@media (max-width: 480px) {
  .kompf-push-modal__panel { padding: 1.75rem 1.25rem 1.25rem; }
  .kompf-push-modal__title { font-size: 19px; }
  .kompf-push-modal__body  { font-size: 14px; }
  .kompf-push-widget { bottom: 0.75rem; right: 0.75rem; }
  .kompf-push-toggle { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .kompf-push-modal,
  .kompf-push-modal__panel,
  .kompf-push-modal.is-closing-to-widget .kompf-push-modal__panel,
  .kompf-push-toggle,
  .kompf-push-widget.is-entering .kompf-push-toggle {
    transition: none !important;
    animation: none !important;
  }
}
