/**
 * Elasticart Search Widget Styles V2
 *
 * @author    Elasticart Team
 * @copyright 2024 Elasticart
 * @license   MIT License
 */

/* ==========================================================================
   Elasticart Search Widget Container
   ========================================================================== */

.elasticart-search-widget-v2 {
  position: relative;
}

.elasticart-mobile-search-slot {
  width: 100%;
  margin-top: 0px;
  padding: 0px 5px 10px 5px;
}

/* ==========================================================================
   Search Form
   ========================================================================== */

#search_widget {
  margin-top: 2px;
}

#search_widget form input {
  height: 44px;
  border-radius: 3px;
  background: #fff;
  padding: 10px;
  overflow: hidden;
}

.elasticart-search-form {
  display: flex;
  align-items: center;
}

.elasticart-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.elasticart-search-input {
  width: 100%;
  padding: 10px 45px 10px 15px;
  border: 1px solid #ced4da;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
}

.elasticart-search-input:focus {
  border: 2px solid #da0180;
  box-shadow: 0 0 0 2px #fff;
}
.elasticart-search-input:hover {
  border: 2px solid #da0180;
  box-shadow: 0 0 0 2px #fff;
}

.elasticart-search-input::placeholder {
  color: #6c757d;
}

.elasticart-search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  transition: color 0.2s ease;
}

.elasticart-search-btn:hover {
  color: #2fb5d2;
}

.elasticart-search-icon {
  padding: 0px;
  width: 43px;
  height: 43px;
  line-height: 43px !important;
  color: #000;
  text-align: center;
  margin-top: 44px;
}

/* ==========================================================================
   Search Results Dropdown
   ========================================================================== */

.elasticart-search-results {
  position: absolute;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 1px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  min-width: 300px;
}

/* Desktop: No scroll, full height */
@media (min-width: 768px) {
  .elasticart-search-results {
    max-height: none;
    overflow-y: visible;
  }
}

/* ==========================================================================
   Results Container - Minimalista
   ========================================================================== */

.elasticart-results-container {
  padding: 8px 0;
}

/* ==========================================================================
   Suggestion Items - Solo texto, sin iconos ni badges
   ========================================================================== */

.elasticart-suggestion {
  display: flex;
  align-items: center;
  padding: 5px 15px;
  font-size: 16px;
  line-height: 1.4;
  color: #111;
  cursor: pointer;
  transition: background-color 0.1s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.elasticart-suggestion:hover {
  background-color: #f3f3f3;
}

.elasticart-suggestion-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: #666;
  flex-shrink: 0;
}

.elasticart-suggestion-text {
  flex-grow: 1;
}

.elasticart-suggestion-text strong {
  font-weight: 700;
  color: #000;
}

/* removed old term styles and borders */

/* ==========================================================================
   Loading State
   ========================================================================== */

.elasticart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  color: #666;
}

.elasticart-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e5e5;
  border-top-color: #da0180;
  border-radius: 50%;
  animation: elasticart-spin 0.8s linear infinite;
  margin-bottom: 10px;
}

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

/* ==========================================================================
   No Results State
   ========================================================================== */

.elasticart-no-results {
  padding: 25px;
  text-align: center;
  color: #666;
}

.elasticart-no-results p {
  margin: 0;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 767px) {
  .elasticart-search-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .elasticart-search-results {
    position: absolute;
    left: 0;
    right: 0;
    max-height: calc(100vh - 150px);
  }
}
