/**
 * Kommun setup modal – första Google/Facebook-inloggning
 */

body.kommun-setup-open {
  overflow: hidden;
}

.kommun-setup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.28s ease;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 110%, rgba(15, 23, 42, 0.55), transparent 50%),
    rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
}

.kommun-setup-backdrop.active {
  opacity: 1;
}

.kommun-setup-modal {
  position: relative;
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 440px;
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 28px 60px -18px rgba(2, 6, 23, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: scale(0.96) translateY(14px);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.kommun-setup-backdrop.active .kommun-setup-modal {
  transform: scale(1) translateY(0);
}

.kommun-setup-modal.kommun-setup-shake {
  animation: kommun-setup-shake 0.4s ease;
}

@keyframes kommun-setup-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.kommun-setup-visual {
  height: 6px;
  background: linear-gradient(90deg, #0f172a 0%, #1d4ed8 45%, #38bdf8 100%);
  flex-shrink: 0;
}

.kommun-setup-header {
  padding: 1.5rem 1.5rem 0.35rem;
  text-align: center;
  flex-shrink: 0;
}

.kommun-setup-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.85rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
}

.kommun-setup-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.kommun-setup-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.kommun-setup-header p#kommunSetupDesc {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 0.9375rem;
  color: #64748b;
  line-height: 1.5;
}

.kommun-setup-body {
  padding: 1.1rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.kommun-setup-body > label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.875rem;
  font-weight: 650;
  color: #334155;
}

.kommun-setup-search-wrap {
  position: relative;
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}

.kommun-setup-search-wrap i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}

.kommun-setup-search {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 1rem;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.kommun-setup-search:focus {
  outline: none;
  background: #fff;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.kommun-setup-selected {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  flex-shrink: 0;
  animation: kommun-setup-pop 0.22s ease;
}

@keyframes kommun-setup-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.kommun-setup-selected[hidden] {
  display: none !important;
}

.kommun-setup-selected-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kommun-setup-selected strong {
  flex: 1;
  font-size: 1rem;
  color: #0f172a;
}

.kommun-setup-clear {
  border: none;
  background: #fff;
  color: #1e3a5f;
  font-size: 0.8125rem;
  font-weight: 650;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 0 1px #bfdbfe;
}

.kommun-setup-clear:hover {
  background: #eff6ff;
}

.kommun-setup-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
}

.kommun-setup-list-head span:first-child {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.kommun-setup-list-count {
  font-size: 0.75rem;
  color: #94a3b8;
}

.kommun-setup-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  overflow-y: auto;
  max-height: min(38vh, 260px);
  min-height: 140px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.kommun-setup-list li {
  margin: 0;
}

.kommun-setup-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 0.85rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font-size: 0.975rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.kommun-setup-option:hover {
  background: #fff;
}

.kommun-setup-option.is-selected {
  background: #0f172a;
  color: #fff;
}

.kommun-setup-option-check {
  opacity: 0;
  font-size: 0.8rem;
  transform: scale(0.8);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.kommun-setup-option.is-selected .kommun-setup-option-check {
  opacity: 1;
  transform: scale(1);
}

.kommun-setup-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
}

.kommun-setup-hint {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.45;
  margin: 0 0 0.9rem;
  flex-shrink: 0;
}

.kommun-setup-error {
  display: none;
  margin-bottom: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.kommun-setup-error.visible {
  display: block;
}

.kommun-setup-submit {
  width: 100%;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
  flex-shrink: 0;
}

.kommun-setup-submit:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.kommun-setup-submit:not(:disabled):hover {
  transform: translateY(-1px);
}

.kommun-setup-submit:not(:disabled):active {
  transform: translateY(0);
}

.kommun-setup-cancel {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

.kommun-setup-cancel:hover {
  color: #334155;
  background: #f1f5f9;
}

@media (max-width: 480px) {
  .kommun-setup-backdrop {
    padding: 0.65rem;
    align-items: flex-end;
  }

  .kommun-setup-modal {
    max-width: none;
    border-radius: 20px 20px 16px 16px;
    max-height: 94vh;
  }

  .kommun-setup-header,
  .kommun-setup-body {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .kommun-setup-header h2 {
    font-size: 1.28rem;
  }

  .kommun-setup-list {
    max-height: min(42vh, 280px);
  }
}
