/* ============================================
   URBot Smart Search — Dark Theme
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #0a0a1a;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Header ---- */
.search-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(15, 15, 35, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 200;
}

.search-logo {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.05em;
}

.search-title {
  font-size: 16px;
  font-weight: 600;
  color: #94a3b8;
  flex: 1;
}

.search-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.search-nav-link:hover {
  color: #e2e8f0;
}

.header-login-btn {
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  transition: color 0.2s, border-color 0.2s;
}

.header-login-btn:hover {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Main ---- */
.search-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ---- Search bar ---- */
.search-bar-wrap {
  position: relative;
  max-width: 600px;
  margin: 0 auto 28px;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  font-size: 18px;
  font-family: inherit;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  border-bottom-color: #22d3ee;
  border-radius: 12px;
  outline: none;
  transition: background 0.2s, border-color 0.3s, box-shadow 0.3s;
}

.search-input::placeholder {
  color: #64748b;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  pointer-events: none;
  opacity: 0.5;
}

/* ---- Controls row ---- */
.search-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

/* ---- Category filter chips ---- */
.search-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.search-filters::-webkit-scrollbar {
  height: 4px;
}

.search-filters::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.search-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  user-select: none;
}

.search-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.search-chip.active {
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.4);
}

/* ---- Sort controls ---- */
.search-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-sort-label {
  font-size: 13px;
  color: #64748b;
}

.search-sort {
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  outline: none;
}

.search-sort:focus {
  border-color: #22d3ee;
}

/* ---- Result count ---- */
.search-result-count {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
  min-height: 20px;
}

/* ---- Loading state ---- */
.search-loading {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
  font-size: 16px;
  animation: searchPulse 1.2s ease-in-out infinite;
}

@keyframes searchPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---- Results grid ---- */
.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---- Result card ---- */
.search-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.search-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.search-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.search-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  object-fit: contain;
  flex-shrink: 0;
}

.search-card-info {
  flex: 1;
  min-width: 0;
}

.search-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-card-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  margin-top: 4px;
}

.search-card-tagline {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Relevance bar ---- */
.search-card-relevance {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.search-card-relevance-label {
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
  width: 28px;
  text-align: right;
}

.search-card-relevance-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.search-card-relevance-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #22d3ee, #6366f1);
  transition: width 0.3s ease;
}

/* ---- Match highlight ---- */
.search-card-match {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.4;
}

.search-card-match mark {
  background: rgba(34, 211, 238, 0.2);
  color: #22d3ee;
  border-radius: 2px;
  padding: 0 2px;
}

/* ---- Add to cart button ---- */
.search-card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.search-card-add {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.search-card-add:hover {
  background: rgba(34, 211, 238, 0.2);
  color: #fff;
}

.search-card-visit {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #94a3b8;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
}

.search-card-visit:hover {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ---- Empty state ---- */
.search-empty {
  text-align: center;
  padding: 60px 20px;
}

.search-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.search-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.search-empty-hint {
  font-size: 14px;
  color: #64748b;
}

/* ---- Footer ---- */
.search-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
  color: #475569;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.search-footer a {
  color: #64748b;
  text-decoration: none;
}

.search-footer a:hover {
  color: #22d3ee;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .search-main {
    padding: 24px 12px 48px;
  }

  .search-input {
    font-size: 16px;
    padding: 14px 16px 14px 42px;
  }

  .search-icon {
    left: 14px;
    font-size: 18px;
  }

  .search-controls {
    flex-direction: column;
    gap: 10px;
  }

  .search-sort-wrap {
    align-self: flex-end;
  }

  .search-results {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .search-header {
    padding: 10px 12px;
    gap: 10px;
  }

  .search-title {
    font-size: 14px;
  }

  .search-nav-link {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .search-card-actions {
    flex-direction: column;
  }
}
