/**
 * Header Product Search Modal
 */

.wpbridge-header-product-search {
  --wpbridge-primary: #c7903d;
  --wpbridge-primary-dark: #a87327;
  --wpbridge-primary-soft: #f3e3c8;
  --wpbridge-bg: #faf8f4;
  --wpbridge-surface: #ffffff;
  --wpbridge-text: #1f2933;
  --wpbridge-muted: #6b7280;
  --wpbridge-border: #e9e2d8;
  --wpbridge-radius: 18px;
  --wpbridge-shadow: 0 12px 34px rgba(31, 41, 51, 0.08);
}

.wpb-product-search-button,
.wpb-product-search-button--menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(199, 144, 61, 0.35);
  border-radius: 999px;
  background: #fff;
  color: var(--wpbridge-primary-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    background-color 0.2s ease;
}

.wpb-product-search-button:hover,
.wpb-product-search-button:focus-visible,
.wpb-product-search-button--menu:hover,
.wpb-product-search-button--menu:focus-visible {
  border-color: var(--wpbridge-primary);
  color: var(--wpbridge-primary-dark);
  box-shadow: 0 10px 22px rgba(199, 144, 61, 0.14);
  transform: translateY(-1px);
  outline: 0;
}

.wpb-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(20, 24, 29, 0.44);
  backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.wpb-modal-overlay.wpb-open {
  opacity: 1;
  visibility: visible;
}

.wpb-modal-container {
  width: min(1180px, 100%);
  height: min(86vh, 920px);
  max-height: min(86vh, 920px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(233, 226, 216, 0.9);
  border-radius: 24px;
  background: linear-gradient(180deg, #fff 0%, #faf8f4 100%);
  box-shadow: 0 28px 80px rgba(20, 24, 29, 0.18);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
}

.wpb-modal-overlay.wpb-open .wpb-modal-container {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.wpb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(233, 226, 216, 0.85);
}

.wpb-modal-title {
  margin: 0;
  color: var(--wpbridge-text);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.wpb-modal-close {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wpbridge-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--wpbridge-muted);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.wpb-modal-close:hover,
.wpb-modal-close:focus-visible {
  border-color: var(--wpbridge-primary);
  color: var(--wpbridge-primary);
  box-shadow: 0 10px 20px rgba(31, 41, 51, 0.08);
  transform: translateY(-1px);
  outline: 0;
}

.wpb-modal-close span {
  font-size: 24px;
  line-height: 1;
}

.wpb-modal-search-field {
  padding: 0 28px 22px;
}

.wpb-modal-search-input {
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  border: 1px solid var(--wpbridge-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--wpbridge-text);
  font-size: 15px;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.wpb-modal-search-input::placeholder {
  color: var(--wpbridge-muted);
}

.wpb-modal-search-input:focus {
  border-color: var(--wpbridge-primary);
  box-shadow: 0 0 0 4px rgba(199, 144, 61, 0.14);
  outline: 0;
}

.wpbridge-header-product-search .wpb-product-search-results-theme {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0 28px 28px;
}

.wpb-modal-results {
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-right: 4px;
}

.wpb-modal-results.wpb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpb-modal-empty-state,
.wpb-modal-state {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 18px;
  border: 1px dashed rgba(233, 226, 216, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  text-align: center;
}

.wpb-modal-empty-state p,
.wpb-modal-state p {
  margin: 0;
  max-width: 420px;
  color: var(--wpbridge-muted);
  line-height: 1.6;
}

.wpb-modal-empty-state-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--wpbridge-primary-soft);
  color: var(--wpbridge-primary-dark);
  font-size: 24px;
}

.wpb-modal-state--error p {
  color: #b42318;
}

.wpbridge-header-product-search .wpbridge-product-grid {
  display: grid;
  grid-template-columns: 33% 33% 33%;
  gap: 10px;
}

.wpbridge-header-product-search .wpbridge-product-card__body {
  padding: 14px;
}

.wpbridge-header-product-search .wpbridge-product-card__title {
  font-size: 1.1rem;
  line-height: 1.05;
}

.wpbridge-header-product-search .wpbridge-product-card__sku {
  font-size: 11px;
}

.wpbridge-header-product-search .wpbridge-product-card__atc {
  width: 40px;
  min-width: 40px;
  height: 40px;
}

.wpbridge-header-product-search .wpbridge-product-card__media {
  aspect-ratio: 4 / 3;
}

body.wpb-modal-open {
  overflow: hidden;
}

.wpb-product-search-menu-item {
  list-style: none;
  display: inline-flex;
  align-items: center;
}

.wpb-floating-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(199, 144, 61, 0.35);
  border-radius: 999px;
  background: #fff;
  color: var(--wpbridge-primary);
  box-shadow: 0 16px 32px rgba(31, 41, 51, 0.14);
  cursor: pointer;
  z-index: 9997;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.wpb-floating-button svg {
  width: 28px;
  height: 28px;
}

.wpb-floating-button:hover,
.wpb-floating-button:focus-visible {
  border-color: var(--wpbridge-primary);
  background: var(--wpbridge-primary);
  color: #fff;
  box-shadow: 0 20px 38px rgba(31, 41, 51, 0.18);
  transform: translateY(-2px);
  outline: 0;
}

.wpb-floating-button--fallback {
  display: none;
}

body.wpb-show-floating-fallback .wpb-floating-button--fallback {
  display: inline-flex;
}

@media (max-width: 1024px) {
  .wpb-modal-overlay {
    padding: 18px;
  }

  .wpb-modal-container {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .wpb-modal-overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .wpb-modal-container {
    height: 92vh;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
  }

  .wpb-modal-header {
    padding: 18px 18px 16px;
  }

  .wpb-modal-search-field {
    padding: 0 18px 18px;
  }

  .wpbridge-header-product-search .wpb-product-search-results-theme {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    padding: 0 18px 18px;
  }

  .wpb-modal-results {
    flex: 1 1 auto;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding-bottom: 8px;
  }

  .wpb-modal-search-input {
    min-height: 52px;
    font-size: 14px;
  }

  .wpbridge-header-product-search .wpbridge-product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .wpb-product-search-button,
  .wpb-product-search-button--menu {
    min-height: 42px;
    padding: 0 15px;
    font-size: 13px;
  }

  .wpb-floating-button {
    right: 18px;
    bottom: 18px;
    width: 52px;
    height: 52px;
  }
}
