.medico-product-filter {
  width: 100%;
}

.mpf-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
}

.medico-product-filter.is-loading .mpf-loading-overlay {
  display: flex;
}

.mpf-loading-box {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  min-width: 190px;
  border-radius: 3px;
  background: #00448b;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 18px 22px;
}

.mpf-loading-spinner {
  position: relative;
  width: 34px;
  height: 34px;
  display: block;
}

.mpf-loading-spinner:before,
.mpf-loading-spinner:after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  content: "";
}

.mpf-loading-spinner:before {
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: mpf-spin 760ms linear infinite;
}

.mpf-loading-spinner:after {
  inset: 7px;
  border: 3px solid transparent;
  border-right-color: rgba(255, 255, 255, 0.9);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: mpf-spin 1180ms linear infinite reverse;
}

@keyframes mpf-spin {
  to {
    transform: rotate(360deg);
  }
}

.mpf-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  min-height: 48px;
  margin: 0 auto 14px;
  border: 0;
  border-radius: 3px;
  background: #00448b;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 16px;
  text-align: left;
}

.mpf-toggle:after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
}

.mpf-toggle[aria-expanded="true"]:after {
  content: "-";
}

.mpf-controls {
  margin: 0 auto 20px;
  width: 90%;
  max-width: 100%;
  border: 1px solid #00448b;
  border-radius: 3px;
  padding: 14px;
}

.mpf-controls[hidden] {
  display: none;
}

.mpf-control-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  max-width: 1360px;
  margin: 0 auto;
}

.mpf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 190px;
}

.mpf-field:has([name="pa_duzina"]),
.mpf-field:has([name="pa_sirina"]),
.mpf-field:has([name="pa_visina"]) {
  flex-basis: 150px;
}

.mpf-sale-field,
.mpf-field:has([name="sort"]) {
  flex-basis: 230px;
}

.mpf-field label,
.mpf-field-label {
  color: var(--gcid-primary-color, #194f46);
  font-size: 0.9rem;
  font-weight: 700;
}

.mpf-field select {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 3px;
  background: #fff;
  color: #333;
  font-size: 1rem;
  padding: 8px 10px;
}

.mpf-sale-field {
  justify-content: flex-end;
}

.mpf-switch {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  justify-content: center;
  padding: 7px 10px;
}

.mpf-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.mpf-switch-track {
  position: relative;
  display: block;
  width: 62px;
  height: 28px;
  border-radius: 999px;
  background: rgba(0, 68, 139, 0.2);
  box-shadow: inset 0 0 0 1px rgba(0, 68, 139, 0.18);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.mpf-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease;
}

.mpf-switch input:checked + .mpf-switch-track {
  background: #00448b;
  box-shadow: inset 0 0 0 1px #00448b;
}

.mpf-switch input:checked + .mpf-switch-track .mpf-switch-thumb {
  transform: translateX(34px);
}

.mpf-switch input:focus-visible + .mpf-switch-track {
  outline: 2px solid rgba(0, 68, 139, 0.35);
  outline-offset: 3px;
}

.mpf-actions {
  display: flex;
  flex: 0 0 100%;
  justify-content: center;
  gap: 10px;
}

.mpf-submit,
.mpf-reset {
  align-self: end;
  min-height: 44px;
  border: 0;
  border-radius: 3px;
  background: var(--gcid-primary-color, #194f46);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 14px;
}

.mpf-reset {
  background: var(--gcid-secondary-color, #d9b56f);
}

.mpf-status {
  min-height: 24px;
  margin: 0 auto 10px;
  width: 90%;
  color: #555;
  font-size: 0.95rem;
  font-weight: 600;
}

.mpf-grid {
  display: grid;
  grid-template-columns: repeat(var(--mpf-columns, 5), minmax(0, 1fr));
  gap: 10px;
  margin: 0 auto;
  width: 90%;
  max-width: 100%;
}

.mpf-card {
  position: relative;
  display: flex;
  min-height: 0;
  aspect-ratio: 5 / 7.5;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 0;
  background-color: #f5f2ed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: inherit;
  text-decoration: none;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.mpf-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
}

.mpf-card-badges {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.mpf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 3px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 0.45rem 0.55rem;
  text-align: center;
}

.mpf-badge-primary {
  background: var(--gcid-primary-color, #194f46);
}

.mpf-badge-height {
  background: #00448b;
  color: #fff;
}

.mpf-badge-sale {
  background: var(--gcid-secondary-color, #d9b56f);
}

.mpf-card-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(255, 255, 255, 0.76);
  padding: 20px;
  text-align: center;
}

.mpf-card-panel h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8em;
  max-height: 2.8em;
  margin: 0;
  overflow: hidden;
  padding: 0;
  color: #333;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4em;
}

.mpf-dimension-line {
  color: var(--gcid-primary-color, #194f46);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  margin-top: -4px;
}

.mpf-price {
  color: #333;
  font-weight: 700;
  line-height: 1.1;
}

.mpf-price del {
  opacity: 0.75;
  margin-right: 5px;
}

.mpf-price ins {
  text-decoration: none;
}

.mpf-button.et_pb_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 3px;
  background: var(--gcid-primary-color, #194f46);
  color: #fff !important;
  font-size: 1rem;
  line-height: 1.4 !important;
  padding: 0.45em 1em !important;
  transition: background-color 180ms ease, color 180ms ease;
}

.mpf-card:hover .mpf-button.et_pb_button,
.mpf-button.et_pb_button:hover {
  border: 0 !important;
  background: var(--gcid-secondary-color, #d9b56f);
  color: #fff !important;
  padding: 0.45em 1em !important;
}

.mpf-button.et_pb_button:before,
.mpf-button.et_pb_button:after {
  display: none !important;
  content: none !important;
}

.mpf-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 20px;
  text-align: center;
  font-weight: 700;
}

.medico-product-filter.is-loading .mpf-grid {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 980px) {
  .mpf-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .mpf-field,
  .mpf-field:has([name="pa_duzina"]),
  .mpf-field:has([name="pa_sirina"]),
  .mpf-field:has([name="pa_visina"]),
  .mpf-sale-field,
  .mpf-field:has([name="sort"]) {
    flex-basis: auto;
    grid-column: auto;
  }

  .mpf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .mpf-control-grid {
    grid-template-columns: 1fr;
  }

  .mpf-actions {
    flex-direction: column;
  }

  .mpf-submit,
  .mpf-reset {
    width: 100%;
  }

  .mpf-grid {
    grid-template-columns: 1fr;
  }
}
