/* ===== Assistente de Busca Inteligente ===== */

/* Botão IA sempre ao lado da busca */
.header-search-wrapper {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap !important;
}

/* Botão IA – estilo geral */
.ai-search-assistant-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(135deg, #867aff 0%, #602e40 100%);
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.ai-search-assistant-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(134, 122, 255, 0.4);
}

.ai-search-assistant-btn i {
  font-size: 1.1rem;
}

.ai-btn-text {
  display: inline-block;
  opacity: 1;
  max-width: 300px;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              max-width 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              margin-left 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              padding 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 0.5rem;
}

.ai-btn-text.hidden {
  opacity: 0 !important;
  max-width: 0 !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: 0 !important;
  overflow: hidden;
}

/* Sempre redondinho quando a tela ficar menor */
@media (max-width: 900px) {
  .ai-search-assistant-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    order: unset !important;
  }

  .ai-btn-text {
    display: none !important;
    opacity: 0 !important;
    max-width: 0 !important;
  }
}

/* Ajuste para telas MUITO pequenas */
@media (max-width: 480px) {
  .header-search-wrapper {
    gap: .4rem;
  }
  
  .ai-search-assistant-btn {
    width: 42px !important;
    height: 42px !important;
  }
}

/* Modal */
.ai-search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ai-search-modal[aria-hidden="false"] {
  display: flex;
}

.ai-search-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.ai-search-modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-search-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10;
}

.ai-search-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* Header do Modal */
.ai-search-modal-header {
  text-align: center;
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid #eee;
}

.ai-search-icon {
  font-size: 3rem;
  color: #867aff;
  margin-bottom: 1rem;
  display: block;
}

.ai-search-modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 0.5rem;
  font-family: 'Funnel Sans', sans-serif;
}

.ai-search-modal-subtitle {
  font-size: 1rem;
  color: #666;
  margin: 0;
}

/* Formulário */
.ai-search-form {
  padding: 2rem;
}

.ai-search-input-wrapper {
  margin-bottom: 1.5rem;
}

.ai-search-input-wrapper label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-family: 'DM Sans', sans-serif;
}

.ai-search-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.ai-search-input:focus {
  outline: none;
  border-color: #867aff;
  box-shadow: 0 0 0 3px rgba(134, 122, 255, 0.1);
}

.ai-search-examples {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ai-examples-label {
  font-size: 0.85rem;
  color: #999;
  margin-right: 0.25rem;
}

.ai-example-btn {
  padding: 0.4rem 0.8rem;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-example-btn:hover {
  background: #867aff;
  color: white;
  border-color: #867aff;
}

.ai-search-submit-btn {
  width: 100%;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #867aff 0%, #602e40 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.ai-search-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(134, 122, 255, 0.4);
}

.ai-search-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ai-search-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-search-loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Resultados */
.ai-search-results {
  padding: 2rem;
  border-top: 1px solid #eee;
}

.ai-results-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 1.5rem;
  font-family: 'Funnel Sans', sans-serif;
}

.ai-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.ai-result-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.ai-result-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: #867aff;
}

.ai-result-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.ai-result-image-wrapper {
  width: 100%;
  padding-top: 100%;
  position: relative;
  overflow: hidden;
  background: #f9f9f9;
}

.ai-result-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-result-content {
  padding: 1rem;
}

.ai-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-result-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #867aff;
  margin: 0;
}

.ai-result-description {
  font-size: 0.85rem;
  color: #666;
  margin: 0.5rem 0 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-results-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: #999;
}

.ai-results-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: #ddd;
}

/* Responsivo */
@media (max-width: 768px) {
  .ai-search-modal-content {
    max-width: 100%;
    border-radius: 16px;
  }
  
  .ai-search-modal-header {
    padding: 1.5rem 1.5rem 1rem;
  }
  
  .ai-search-icon {
    font-size: 2.5rem;
  }
  
  .ai-search-modal-title {
    font-size: 1.5rem;
  }
  
  .ai-search-form {
    padding: 1.5rem;
  }
  
  .ai-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .ai-search-results {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .ai-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ai-examples-label {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

