/**
 * WP Search Popup Stylesheet - Janela Ampliada e Tipografia Nítida
 * Desenvolvido por Kidum ltda
 */

:root {
  --wpsp-accent: #0284c7;
  --wpsp-accent-hover: #0369a1;
  --wpsp-radius: 16px;
  --wpsp-transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tema Dark Slate */
.wpsp-theme-dark {
  --wpsp-bg: #0f172a;
  --wpsp-header-bg: #1e293b;
  --wpsp-text: #ffffff;
  --wpsp-muted: #94a3b8;
  --wpsp-border: #334155;
  --wpsp-hover: #1e293b;
  --wpsp-active: #334155;
  --wpsp-kbd-bg: #1e293b;
}

/* Tema Clean Light */
.wpsp-theme-light {
  --wpsp-bg: #ffffff;
  --wpsp-header-bg: #f8fafc;
  --wpsp-text: #0f172a;
  --wpsp-muted: #475569;
  --wpsp-border: #cbd5e1;
  --wpsp-hover: #f1f5f9;
  --wpsp-active: #e2e8f0;
  --wpsp-kbd-bg: #f1f5f9;
}

/* Tema Grafite */
.wpsp-theme-slate {
  --wpsp-bg: #18181b;
  --wpsp-header-bg: #27272a;
  --wpsp-text: #fafafa;
  --wpsp-muted: #a1a1aa;
  --wpsp-border: #3f3f46;
  --wpsp-hover: #27272a;
  --wpsp-active: #3f3f46;
  --wpsp-kbd-bg: #27272a;
}

/* Overlay & Fundo */
.wpsp-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 24px 30px;
  box-sizing: border-box;
}

.wpsp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: wpspFadeIn 150ms ease-out;
}

/* JANELA AMPLIADA (max-width: 860px) */
.wpsp-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  max-height: 86vh;
  background: var(--wpsp-bg);
  border: 1px solid var(--wpsp-border);
  border-radius: var(--wpsp-radius);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wpspScaleIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Variante Tela Cheia */
.wpsp-style-fullscreen {
  padding: 0;
  align-items: stretch;
}
.wpsp-style-fullscreen .wpsp-container {
  max-width: 100%;
  max-height: 100vh;
  border-radius: 0;
  border: none;
}

/* Cabeçalho de Busca Ampliado */
.wpsp-search-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 26px;
  background: var(--wpsp-header-bg);
  border-bottom: 1px solid var(--wpsp-border);
}

.wpsp-icon-search {
  color: var(--wpsp-accent);
  display: flex;
  align-items: center;
}

/* Campo de Texto com Fonte Maior e Nítida (19px) */
.wpsp-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 19px;
  font-weight: 500;
  color: var(--wpsp-text);
  font-family: inherit;
  line-height: 1.4;
}
.wpsp-input::placeholder {
  color: var(--wpsp-muted);
  opacity: 0.85;
}

.wpsp-search-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wpsp-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--wpsp-muted);
  padding: 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  transition: all var(--wpsp-transition);
}
.wpsp-action-btn:hover {
  color: var(--wpsp-text);
  background: var(--wpsp-hover);
}

.wpsp-kbd-esc {
  font-size: 12px;
  font-family: monospace;
  font-weight: 600;
  background: var(--wpsp-kbd-bg);
  border: 1px solid var(--wpsp-border);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--wpsp-muted);
}

/* Barra de Filtros */
.wpsp-filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--wpsp-border);
  background: var(--wpsp-bg);
}

.wpsp-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--wpsp-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--wpsp-transition);
}
.wpsp-tab:hover {
  color: var(--wpsp-text);
  background: var(--wpsp-hover);
}
.wpsp-tab.active {
  background: var(--wpsp-accent);
  color: #ffffff;
  font-weight: 700;
}

/* Área de Conteúdo e Resultados Ampliada */
.wpsp-initial-state, .wpsp-results-area {
  padding: 20px 26px;
  overflow-y: auto;
  max-height: 520px;
}

.wpsp-section {
  margin-bottom: 22px;
}
.wpsp-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.wpsp-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wpsp-muted);
}
.wpsp-link-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--wpsp-muted);
  cursor: pointer;
  text-decoration: underline;
}

.wpsp-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wpsp-recent-chip, .wpsp-suggestion-chip {
  background: var(--wpsp-header-bg);
  border: 1px solid var(--wpsp-border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--wpsp-text);
  cursor: pointer;
  transition: all var(--wpsp-transition);
}
.wpsp-recent-chip:hover, .wpsp-suggestion-chip:hover {
  border-color: var(--wpsp-accent);
  color: var(--wpsp-accent);
}

/* Lista de Resultados */
.wpsp-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wpsp-result-item {
  margin-bottom: 8px;
  border-radius: 12px;
  transition: background var(--wpsp-transition);
}
.wpsp-result-item.is-active, .wpsp-result-item:hover {
  background: var(--wpsp-hover);
}

.wpsp-item-link {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
}

/* Miniatura Maior (58px) */
.wpsp-item-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wpsp-item-thumb-placeholder {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--wpsp-header-bg);
  border: 1px solid var(--wpsp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wpsp-badge-type {
  font-size: 11px;
  font-weight: 700;
  color: var(--wpsp-muted);
}

.wpsp-item-details {
  flex: 1;
  min-width: 0;
}

.wpsp-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Título Mais Nítido e Maior (16.5px) */
.wpsp-item-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--wpsp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.wpsp-item-pill {
  font-size: 12px;
  color: var(--wpsp-muted);
  font-weight: 600;
}

/* Resumo com Mais Clareza e Leitura Agradável */
.wpsp-item-excerpt {
  font-size: 13.5px;
  color: var(--wpsp-muted);
  margin: 3px 0 0;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wpsp-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--wpsp-muted);
  margin-top: 5px;
}

.wpsp-item-price {
  font-weight: 700;
  font-size: 14px;
  color: #10b981;
}

.wpsp-sale-badge {
  font-size: 10px;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.wpsp-stock-in {
  color: #10b981;
  font-weight: 600;
}
.wpsp-stock-out {
  color: #ef4444;
  font-weight: 600;
}

.wpsp-sku {
  font-family: monospace;
  background: var(--wpsp-header-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.wpsp-item-arrow {
  color: var(--wpsp-muted);
  font-size: 16px;
  opacity: 0.4;
  transform: translateX(-4px);
  transition: all var(--wpsp-transition);
}
.wpsp-result-item.is-active .wpsp-item-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--wpsp-accent);
}

.wpsp-highlight {
  background: transparent;
  color: var(--wpsp-accent);
  font-weight: 800;
  text-decoration: underline;
}

/* Linha de Ver Todos os Resultados */
.wpsp-view-all-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--wpsp-border);
}
.wpsp-view-all-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--wpsp-header-bg);
  color: var(--wpsp-accent);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  transition: background var(--wpsp-transition);
}
.wpsp-view-all-link:hover {
  background: var(--wpsp-hover);
}

/* RODAPÉ DO POPUP: Exclusivamente 'search engine by Kidum ltda' */
.wpsp-footer-branding {
  padding: 14px 24px;
  background: var(--wpsp-header-bg);
  border-top: 1px solid var(--wpsp-border);
  text-align: center;
  font-size: 12.5px;
  color: var(--wpsp-muted);
  letter-spacing: 0.02em;
}
.wpsp-footer-branding strong {
  color: var(--wpsp-text);
  font-weight: 700;
}

/* Botão Flutuante */
.wpsp-floating-btn {
  position: fixed;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--wpsp-accent);
  color: #ffffff;
  border: none;
  border-radius: 40px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: transform 150ms ease;
}
.wpsp-floating-btn:hover {
  transform: translateY(-2px);
}
.wpsp-pos-bottom-right {
  bottom: 28px;
  right: 28px;
}
.wpsp-pos-bottom-left {
  bottom: 28px;
  left: 28px;
}
.wpsp-pos-top-right {
  top: 28px;
  right: 28px;
}

.wpsp-float-kbd {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
}

/* Spinner */
.wpsp-spinner {
  display: flex;
  justify-content: center;
  padding: 36px 0;
}
.wpsp-loader-dot {
  width: 28px;
  height: 28px;
  border: 3px solid var(--wpsp-border);
  border-top-color: var(--wpsp-accent);
  border-radius: 50%;
  animation: wpspSpin 0.6s linear infinite;
}

@keyframes wpspFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wpspScaleIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wpspSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .wpsp-overlay {
    padding: 16px 10px;
  }
  .wpsp-search-header {
    padding: 14px 16px;
  }
  .wpsp-input {
    font-size: 16px;
  }
}
