/* SearchWP Modal Search Form Custom Styles */
.searchwp-modal-form-trigger-icon svg {
  width: 20px;
  height: 20px;
}

/* Modal Container */
.searchwp-modal-form {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.searchwp-modal-form.is-open {
  display: block;
  opacity: 1;
}

/* Overlay */
.searchwp-modal-form__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 0.3s ease;
}

/* Modal Container */
.searchwp-modal-form__container {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 90%;
  max-width: 800px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.3s ease-in-out;
}

.searchwp-modal-form.is-open .searchwp-modal-form__container {
  transform: translateX(-50%) scale(1);
}

/* Modal Content */
.searchwp-modal-form__content {
  padding: 1.5rem;
  position: relative;
  max-height: 75vh;
  overflow-y: auto;
}

/* Search Form */
.searchwp-form {
  margin: 0 0 1.5rem 0;
}

/* Form Layout */
.swp-flex--col {
  display: flex;
  flex-direction: column;
}

.swp-flex--row {
  display: flex;
  flex-direction: row;
}

.swp-flex--wrap {
  flex-wrap: wrap;
}

.swp-flex--gap-md {
  gap: 0.75rem;
}

.swp-items-stretch {
  align-items: stretch;
}

/* Input Container */
.searchwp-form-input-container {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Search Input */
.swp-input--search {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #f9fafb;
  color: #374151;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.swp-input--search:focus {
  background: #ffffff;
}

.swp-input--search::placeholder {
  color: #9ca3af;
}

/* Search Button */
.search-submit {
  padding: 0.875rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
  background: #3b82f6;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 100px;
}

.search-submit:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.search-submit:active {
  transform: translateY(0);
}

.search-submit:focus {
  outline: none;
}

/* Modal Footer */
.searchwp-modal-form__footer {
  display: none;
  padding: 0;
  background: transparent;
  text-align: center;
}

/* Search Results Styling */
.searchwp-live-search-results {
  margin-top: 1rem;
  max-height: 75vh !important;
  position: fixed;
}

.searchwp-live-search-results .searchwp-live-search-result {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.searchwp-live-search-results .searchwp-live-search-result:hover {
  background-color: #f9fafb;
}

.searchwp-live-search-results .searchwp-live-search-result:last-child {
  border-bottom: none;
}

/* Product Image */
.searchwp-live-search-results .searchwp-live-search-result--img .wp-post-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  margin-right: 1rem;
  flex-shrink: 0;
}

/* Product Info */
.searchwp-live-search-result--title {
  font-family: inherit;
  font-size: 1rem !important;
  font-weight: normal !important;
  color: #374151 !important;
  margin: 0 0 0.25rem 0 !important;
  line-height: 1.4 !important;
}

.searchwp-live-search-results .product-info {
  flex: 1;
  min-width: 0;
}

.searchwp-live-search-results .product-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin: 0 0 0.25rem 0;
  line-height: 1.4;
}

.searchwp-highlight {
  background-color: transparent !important;
  font-weight: 700 !important;
}

.searchwp-live-search-results .product-price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.searchwp-live-search-results .current-price {
  color: #059669;
  font-weight: 600;
}

.searchwp-live-search-results .original-price {
  color: #6b7280;
  text-decoration: line-through;
  font-size: 0.75rem;
}

/* No Results */
.searchwp-live-search-results .no-results {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  font-style: italic;
}

/* Loading State */
.searchwp-form.loading .search-submit {
  position: relative;
  color: transparent;
}

/* Responsive Design */
@media (max-width: 768px) {
  .searchwp-modal-form__container {
    width: 95%;
  }

  .searchwp-modal-form__content {
    padding: 1rem;
    max-height: 80vh;
  }

  .swp-flex--row {
    flex-direction: column;
  }

  .search-submit {
    width: 100%;
    margin-top: 0.5rem;
  }

  .swp-input--search {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .search-submit {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .searchwp-live-search-results .searchwp-live-search-result {
    padding: 0.75rem;
  }

  .searchwp-live-search-result--img .wp-post-image {
    width: 50px;
    height: 50px;
    margin-right: 0.75rem;
  }
}

@media (max-width: 480px) {
  .searchwp-modal-form__content {
    padding: 0.75rem;
  }

  .searchwp-modal-form__footer {
    padding: 0.75rem;
  }

  .swp-input--search {
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  .search-submit {
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  .searchwp-live-search-results .searchwp-live-search-result--title a {
    font-size: 0.8rem !important;
  }

  .searchwp-live-search-results .product-price {
    font-size: 0.8rem;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .searchwp-modal-form,
  .searchwp-modal-form__container,
  .searchwp-modal-form__overlay,
  .swp-input--search,
  .search-submit,
  .searchwp-modal-form__close,
  .searchwp-live-search-results li {
    transition: none;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .searchwp-modal-form__overlay {
    background: rgba(0, 0, 0, 0.8);
  }

  .swp-input--search {
    border-color: #000000;
    background: #ffffff;
  }

  .search-submit {
    background: #000000;
    color: #ffffff;
  }

  .searchwp-live-search-results li {
    border-bottom-color: #000000;
  }
}

/* Focus Visible for Better Accessibility */
.swp-input--search:focus-visible,
.search-submit:focus-visible,
.searchwp-modal-form__close:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
