.wab-filter-popup {
  display: inline-block;
}

.wab-filter-popup__trigger {
  background-color: #0770e3;
  border: none;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 26px;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.wab-filter-popup__trigger:hover,
.wab-filter-popup__trigger:focus {
  background-color: #0559b4;
  transform: translateY(-1px);
}

.wab-filter-popup__overlay {
  align-items: center;
  background: rgba(21, 21, 31, 0.65);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 9999;
  overflow-y: auto;
}

.wab-filter-popup__overlay[hidden] {
  display: none;
}

.wab-filter-popup__modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 22px 48px rgba(15, 20, 40, 0.25);
  max-height: none;
  max-width: min(720px, calc(100vw - 32px));
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wab-filter-popup__close {
  background: transparent;
  border: none;
  color: #1f2933;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 12px 16px;
  position: absolute;
  right: 4px;
  top: 4px;
}

.wab-filter-popup__header {
  padding: 28px 32px 16px;
}

.wab-filter-popup__header h3 {
  font-size: 22px;
  margin: 0 0 6px;
}

.wab-filter-popup__header p {
  color: #4a5568;
  font-size: 14px;
  margin: 0;
}

.wab-filter-popup__form {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.wab-filter-popup__steps {
  flex: 0 1 auto;
  overflow: visible;
  padding: 0 32px 24px;
}

.wab-filter-popup__step {
  display: none;
  animation: wabFadeIn 0.3s ease;
}

.wab-filter-popup__step.is-active {
  display: block;
}

.wab-filter-popup__step h4 {
  font-size: 18px;
  margin: 0 0 14px;
}

.wab-filter-popup__step h5 {
  font-size: 15px;
  margin: 18px 0 10px;
}

.wab-filter-popup__options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.wab-filter-popup__option {
  border: 1.4px solid #d7dbe3;
  border-radius: 12px;
  color: #1f2733;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.wab-filter-popup__option input {
  display: none;
}

.wab-filter-popup__option span {
  pointer-events: none;
}

.wab-filter-popup__option.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wab-filter-popup__option.is-selected {
  border-color: #0770e3;
  box-shadow: 0 8px 18px rgba(7, 112, 227, 0.24);
  transform: translateY(-2px);
}

.wab-filter-popup__group {
  margin-top: 20px;
}

.wab-filter-popup__group--inline {
  align-items: center;
  display: flex;
  gap: 10px;
}

.wab-filter-popup__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.wab-filter-popup__group select,
.wab-filter-popup__group input[type="date"],
.wab-filter-popup__group input[type="text"],
.wab-filter-popup__group select:focus,
.wab-filter-popup__group input[type="date"]:focus {
  border-radius: 10px;
  border: 1.4px solid #cbd5e0;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
}

.wab-filter-popup__group select:focus,
.wab-filter-popup__group input[type="date"]:focus,
.wab-filter-popup__group input[type="text"]:focus {
  border-color: #0770e3;
  box-shadow: 0 0 0 3px rgba(7, 112, 227, 0.15);
}

.wab-filter-popup__toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.wab-filter-popup__toggle input {
  height: 18px;
  width: 18px;
}

.wab-filter-popup__toggle-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

[data-role="multi-display"],
[data-role="range-display"] {
  cursor: pointer;
  background-color: #fff;
}

[data-role="multi-display"]::placeholder,
[data-role="range-display"]::placeholder {
  color: #94a3b8;
}

.wab-filter-popup__summary {
  background: #f8fafc;
  border-radius: 12px;
  margin-top: 24px;
  padding: 16px 18px;
}

.wab-filter-popup__summary h5 {
  margin: 0 0 10px;
}

.wab-filter-popup__summary ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: #4a5568;
}

.wab-filter-popup__summary li {
  margin: 4px 0;
}

.wab-filter-popup__footer {
  align-items: center;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
}

.wab-filter-popup__nav,
.wab-filter-popup__apply {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  transition: background-color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.wab-filter-popup__nav {
  background: #e2e8f0;
  color: #334155;
}

.wab-filter-popup__nav[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.wab-filter-popup__nav:not([disabled]):hover,
.wab-filter-popup__nav:not([disabled]):focus {
  background: #cbd5e1;
}

.wab-filter-popup__apply {
  background: #0770e3;
  color: #fff;
}

.wab-filter-popup__apply[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.wab-filter-popup__apply:not([disabled]):hover,
.wab-filter-popup__apply:not([disabled]):focus {
  background: #0559b4;
  transform: translateY(-1px);
}

.wab-filter-popup__helper {
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

.wab-filter-popup__error {
  color: #ef4444;
  font-size: 13px;
  margin: 0 24px 18px;
  text-align: right;
}

@keyframes wabFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .wab-filter-popup__modal {
    max-width: 100%;
    border-radius: 14px;
  }

  .wab-filter-popup__header,
  .wab-filter-popup__steps {
    padding-left: 20px;
    padding-right: 20px;
  }

  .wab-filter-popup__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .wab-filter-popup__nav,
  .wab-filter-popup__apply {
    width: 100%;
  }
}

/* Range & multi-date popovers */
.wab-range-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.wab-range-wrapper input[type="text"] {
  width: 100%;
}

.wab-range-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 14px 16px;
  z-index: 10000;
  width: min(540px, calc(100vw - 48px));
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.wab-range-popover.single-month {
  width: min(360px, calc(100vw - 48px));
}

.wab-range-popover.hidden {
  display: none;
}

.wab-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
}

.wab-range-header .title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.wab-range-header .nav {
  display: flex;
  gap: 8px;
}

.wab-range-header button {
  border: 1px solid #d0d7e3;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.wab-months {
  display: flex;
  gap: 16px;
}

.wab-month {
  width: 240px;
}

.wab-range-popover.single-month .wab-month {
  width: 260px;
}

.wab-month h4 {
  margin: 4px 0 8px;
  font-size: 14px;
  text-transform: capitalize;
}

.wab-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.wab-dow {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  padding: 4px 0;
}

.wab-day {
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.wab-day.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.wab-day.in-range {
  background: #e2e8ff;
  color: #1d4ed8;
}

.wab-day.start,
.wab-day.end,
.wab-day.selected {
  background: #0a66ff;
  color: #fff;
  font-weight: 600;
}

.wab-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.wab-footer .clear {
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 13px;
}

.wab-footer .apply {
  border: none;
  background: #0a66ff;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.wab-footer .apply[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .wab-range-popover {
    width: calc(100vw - 32px);
  }

  .wab-months {
    flex-direction: column;
    gap: 10px;
  }

  .wab-month,
  .wab-range-popover.single-month .wab-month {
    width: 100%;
  }
}
