/* ==================== TRAKITA SEARCH MODULE ==================== */
/* Styles for search overlay, dropdown, and results — isolated module */
/* Does NOT modify any existing CSS classes */

/* ===== SEARCH OVERLAY (Homepage Global Search) ===== */
.trakita-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.trakita-search-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== SEARCH DROPDOWN PANEL ===== */
.trakita-search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #ffffff;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.trakita-search-panel.active {
  transform: translateY(0);
}

/* ===== SEARCH PANEL HEADER ===== */
.trakita-search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.trakita-search-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.trakita-search-back:hover { background: #e2e8f0; }
.trakita-search-back:active { transform: scale(0.94); }
.trakita-search-back svg { width: 18px; height: 18px; color: #475569; }

.trakita-search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 0 14px;
  height: 42px;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.trakita-search-field:focus-within {
  border-color: #22c55e;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}
.trakita-search-field svg { width: 18px; height: 18px; color: #94a3b8; flex-shrink: 0; }
.trakita-search-field input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: #1e293b;
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
}
.trakita-search-field input::placeholder { color: #94a3b8; }
.trakita-search-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.trakita-search-clear.visible { display: flex; }
.trakita-search-clear:hover { background: #cbd5e1; }
.trakita-search-clear svg { width: 14px; height: 14px; color: #64748b; }

/* ===== SEARCH RESULTS CONTAINER ===== */
.trakita-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ===== SEARCH SECTION ===== */
.trakita-search-section {
  padding: 0 16px;
}
.trakita-search-section + .trakita-search-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}
.trakita-search-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  padding: 8px 0 6px;
}

/* ===== SEARCH RESULT ITEM ===== */
.trakita-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.trakita-search-item:hover { background: #f8fafc; }
.trakita-search-item:active { background: #f1f5f9; transform: scale(0.99); }

.trakita-search-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.trakita-search-item-icon.icon-green { background: #f0fdf4; }
.trakita-search-item-icon.icon-orange { background: #fff7ed; }
.trakita-search-item-icon.icon-blue { background: #eff6ff; }
.trakita-search-item-icon.icon-red { background: #fef2f2; }
.trakita-search-item-icon.icon-purple { background: #faf5ff; }
.trakita-search-item-icon.icon-teal { background: #f0fdfa; }
.trakita-search-item-icon.icon-amber { background: #fffbeb; }
.trakita-search-item-icon.icon-indigo { background: #eef2ff; }
.trakita-search-item-icon.icon-gray { background: #f8fafc; }

.trakita-search-item-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.trakita-search-item-icon svg {
  width: 20px;
  height: 20px;
}

.trakita-search-item-info {
  flex: 1;
  min-width: 0;
}
.trakita-search-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.trakita-search-item-name mark {
  background: #bbf7d0;
  color: #166534;
  padding: 0 1px;
  border-radius: 2px;
}
.trakita-search-item-desc {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}
.trakita-search-item-desc mark {
  background: #fef08a;
  color: #854d0e;
  padding: 0 1px;
  border-radius: 2px;
}
.trakita-search-item-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== SEARCH EMPTY STATE ===== */
.trakita-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.trakita-search-empty svg { width: 56px; height: 56px; color: #d1d5db; margin-bottom: 12px; }
.trakita-search-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}
.trakita-search-empty-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
}

/* ===== SEARCH QUICK TAGS (Homepage) ===== */
.trakita-search-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.trakita-search-quick-label {
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 0;
  width: 100%;
  font-weight: 600;
}
.trakita-search-quick-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #f1f5f9;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: 'Inter', -apple-system, sans-serif;
}
.trakita-search-quick-tag:hover { background: #e2e8f0; }
.trakita-search-quick-tag:active { transform: scale(0.96); }
.trakita-search-quick-tag svg { width: 14px; height: 14px; }

/* ===== SEARCH LOADING STATE ===== */
.trakita-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 8px;
  color: #94a3b8;
  font-size: 13px;
}
.trakita-search-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: trakita-search-spin 0.7s linear infinite;
}
@keyframes trakita-search-spin {
  to { transform: rotate(360deg); }
}

/* ===== MARKETPLACE INLINE SEARCH RESULTS ===== */
.mp-search-results {
  padding: 0 16px;
  margin-top: -8px;
  margin-bottom: 8px;
}
.mp-search-results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 12px;
  color: #64748b;
}
.mp-search-results-info strong {
  color: #1e293b;
}
.mp-search-clear-btn {
  font-size: 12px;
  color: #3b82f6;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.mp-search-clear-btn:hover { background: #eff6ff; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .trakita-search-panel { border-radius: 0 0 16px 16px; }
  .trakita-search-header { padding: 10px 12px; }
  .trakita-search-field { height: 38px; padding: 0 10px; }
  .trakita-search-field input { font-size: 13px; }
  .trakita-search-item { padding: 8px 10px; gap: 10px; }
  .trakita-search-item-icon { width: 36px; height: 36px; border-radius: 10px; }
  .trakita-search-item-icon img { width: 20px; height: 20px; }
  .trakita-search-item-icon svg { width: 18px; height: 18px; }
  .trakita-search-item-name { font-size: 13px; }
  .trakita-search-item-desc { font-size: 11px; }
  .trakita-search-quick { padding: 10px 12px 14px; }
  .trakita-search-quick-tag { padding: 5px 10px; font-size: 11px; }
}
