/* ─── AI Shop Search Widget Styles ─────────────────────────────────────── */

/* Search Badge */
.ai-search-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 10;
}

/* Loading Spinner */
.ai-search-spinner {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: ai-spin 0.6s linear infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes ai-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ─── Dropdown ───────────────────────────────────────────────────────────── */
#ai-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 99999;
  overflow: hidden;
  animation: ai-fadein 0.15s ease;
  min-width: 320px;
}

@keyframes ai-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-dropdown-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
}

.ai-dropdown-header-icon { font-size: 14px; }

.ai-dropdown-header-text {
  flex: 1;
  color: #334155;
}

.ai-dropdown-header-count {
  font-size: 11px;
  color: #94a3b8;
  background: #e2e8f0;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ─── Dropdown Rows ──────────────────────────────────────────────────────── */
.ai-dropdown-list {
  max-height: 360px;
  overflow-y: auto;
}

.ai-dropdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
  cursor: pointer;
}

.ai-dropdown-row:last-child {
  border-bottom: none;
}

.ai-dropdown-row:hover,
.ai-dropdown-row.active {
  background: #f1f5ff;
  text-decoration: none;
  color: inherit;
}

.ai-dropdown-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.ai-dropdown-no-img {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #cbd5e1;
}

.ai-dropdown-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ai-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-dropdown-sub {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-dropdown-cat {
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}

.ai-dropdown-price {
  font-size: 13px;
  font-weight: 700;
  color: #6366f1;
}

.ai-dropdown-arrow {
  color: #cbd5e1;
  font-size: 14px;
  transition: color 0.15s, transform 0.15s;
}

.ai-dropdown-row:hover .ai-dropdown-arrow,
.ai-dropdown-row.active .ai-dropdown-arrow {
  color: #6366f1;
  transform: translateX(3px);
}

/* ─── Dropdown Footer ────────────────────────────────────────────────────── */
.ai-dropdown-footer {
  display: block;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  color: #6366f1;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.ai-dropdown-footer:hover {
  background: #ede9fe;
  text-decoration: none;
  color: #4f46e5;
}

/* ─── Recommendations Section ────────────────────────────────────────────── */
.ai-recommendations {
  margin: 40px 0;
}

.ai-rec-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}

.ai-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* ─── Product Card ───────────────────────────────────────────────────────── */
.ai-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
  background: #fff;
}

.ai-card:hover {
  box-shadow: 0 4px 20px rgba(99,102,241,0.15);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.ai-card-img {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f8fafc;
}

.ai-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.ai-card:hover .ai-card-img img {
  transform: scale(1.05);
}

.ai-card-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #cbd5e1;
}

.ai-card-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
}

.ai-card-price {
  font-size: 13px;
  font-weight: 700;
  color: #6366f1;
}

.ai-card-cat {
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #ai-search-dropdown {
    left: 0;
    right: 0;
    min-width: unset;
    border-radius: 8px;
  }

  .ai-rec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}