/**
 * Search Suggestions Dropdown Styles
 *
 * @package Kidymart_Settings
 */

.kidymart-search-wrapper {
  position: relative;
  width: 100%;
  display: block;
}

/* Shortcode search form container */
.kidymart-search-form {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Search form element */
.kidymart-search-form-element {
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Shortcode search wrapper */
.kidymart-search-form .kidymart-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Shortcode search input */
.kidymart-search-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.kidymart-search-input:focus {
  border-color: #666666;
}

/* Optional search button (if button_text provided) */
.kidymart-search-button {
  margin-left: 8px;
  padding: 12px 24px;
  background-color: #333333;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.kidymart-search-button:hover {
  background-color: #000000;
}

/* Mobile responsive for shortcode */
@media screen and (max-width: 768px) {
  .kidymart-search-form {
    max-width: 100%;
  }

  .kidymart-search-input {
    padding: 10px 14px;
    font-size: 14px;
  }

  .kidymart-search-button {
    padding: 10px 16px;
    font-size: 14px;
  }
}

.kidymart-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #f9f6f2;
  border: 1px solid #bfb9b9;
  border-top: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: -1px;
  display: none;
}

.kidymart-search-suggestions.active {
  display: block;
}

.kidymart-search-suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kidymart-search-suggestion-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.kidymart-search-suggestion-item:last-child {
  border-bottom: none;
}

.kidymart-search-suggestion-item:hover,
.kidymart-search-suggestion-item.selected {
  background-color: #f5f5f5;
}

.kidymart-search-suggestion-item:active {
  background-color: #ebebeb;
}

.kidymart-suggestion-thumbnail {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background-color: #f0f0f0;
}

.kidymart-suggestion-thumbnail.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999999;
  font-size: 12px;
}

.kidymart-suggestion-details {
  flex: 1;
  min-width: 0;
}

.kidymart-suggestion-title {
  font-size: 14px;
  font-weight: 500;
  color: #333333;
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kidymart-suggestion-sku {
  font-size: 12px;
  color: #999999;
  margin: 2px 0 4px 0;
  font-weight: 400;
}

.kidymart-suggestion-price {
  font-size: 13px;
  color: #666666;
  margin: 0;
}

.kidymart-suggestion-price .woocommerce-Price-amount {
  font-weight: 600;
  color: #1a1a1a;
}

/* Loading indicator */
.kidymart-search-loading {
  padding: 16px;
  text-align: center;
  color: #666666;
  font-size: 14px;
}

.kidymart-search-loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-top-color: #666666;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* No results message */
.kidymart-search-no-results {
  padding: 16px;
  text-align: center;
  color: #666666;
  font-size: 14px;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
  .kidymart-search-suggestions {
    max-height: 300px;
    border-radius: 0 0 8px 8px;
  }

  .kidymart-search-suggestion-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .kidymart-suggestion-thumbnail {
    width: 40px;
    height: 40px;
  }

  .kidymart-suggestion-title {
    font-size: 13px;
  }

  .kidymart-suggestion-price {
    font-size: 12px;
  }
}

/* Touch device optimization */
@media (hover: none) {
  .kidymart-search-suggestion-item {
    min-height: 44px; /* Minimum touch target size */
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .kidymart-search-suggestions {
    background-color: #f9f6f2;
    border-color: #bfb9b9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
  }

  .kidymart-search-suggestion-item {
    border-bottom-color: #bfb9b9;
  }

  .kidymart-search-suggestion-item:hover,
  .kidymart-search-suggestion-item.selected {
    background-color: #ed9a1a;
  }

  .kidymart-search-suggestion-item:active {
    background-color: #ed9a1a;
  }

  .kidymart-search-suggestion-item:active .kidymart-suggestion-title,
  .kidymart-search-suggestion-item:hover .kidymart-suggestion-title,
  .kidymart-search-suggestion-item.selected .kidymart-suggestion-title {
    color: #ffffff;
  }

  .kidymart-search-suggestion-item:hover .kidymart-suggestion-price,
  .kidymart-search-suggestion-item.selected .kidymart-suggestion-price {
    color: #fff;
  }

  .kidymart-suggestion-title {
    color: #222222;
  }

  .kidymart-suggestion-sku {
    color: #666666;
  }

  .kidymart-suggestion-price {
    color: #ed9a1a;
  }

  .kidymart-suggestion-price .woocommerce-Price-amount {
    color: #ed9a1a;
  }

  .kidymart-search-suggestion-item:hover .woocommerce-Price-amount,
  .kidymart-search-suggestion-item.selected .woocommerce-Price-amount {
    color: #fff;
  }

  .kidymart-suggestion-thumbnail.no-image {
    background-color: #2a2a2a;
    color: #666666;
  }

  .kidymart-search-loading,
  .kidymart-search-no-results {
    color: #999999;
  }
}

/* Scrollbar styling */
.kidymart-search-suggestions::-webkit-scrollbar {
  width: 8px;
}

.kidymart-search-suggestions::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.kidymart-search-suggestions::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 4px;
}

.kidymart-search-suggestions::-webkit-scrollbar-thumb:hover {
  background: #999999;
}

/* Dark mode scrollbar */
@media (prefers-color-scheme: dark) {
  .kidymart-search-suggestions::-webkit-scrollbar-track {
    background: #2a2a2a;
  }

  .kidymart-search-suggestions::-webkit-scrollbar-thumb {
    background: #444444;
  }

  .kidymart-search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #555555;
  }
}
