/* ==================== 搜索頁面樣式 ==================== */

/* 搜索頭部 */
.search-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
}

.search-input {
  width: 100%;
  padding: 12px 48px 12px 48px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-primary);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.search-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* 搜索區塊 */
.search-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

body[data-page="search"] .section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.clear-history-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-history-btn:hover {
  background: var(--bg-hover);
  color: var(--danger);
}

/* 搜索歷史 */
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-item {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-color);
}

.history-item i {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* 搜索標籤 */
.search-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  overflow-x: auto;
}

.search-type-tab {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-type-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.search-type-tab.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 搜索結果 */
.search-results {
  padding: 20px;
}

.result-section {
  margin-bottom: 32px;
}

.result-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-section-title i {
  color: var(--primary-color);
}

/* 用戶結果 */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.user-card {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-card .user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.user-card .user-info {
  flex: 1;
  min-width: 0;
}

.user-card .user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-card .user-username {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.user-card .user-bio {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.user-card .user-stats {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
}

.user-card .user-stats i {
  margin-right: 4px;
}

/* 投資觀點結果 */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-card {
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.insight-card:hover {
  background: var(--bg-tertiary);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.insight-card .insight-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.insight-card .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.insight-card .author-info {
  flex: 1;
}

.insight-card .author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.insight-card .publish-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.insight-card .insight-content {
  margin-bottom: 12px;
}

.insight-card .insight-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.insight-card .insight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.insight-card .insight-symbol {
  padding: 4px 8px;
  background: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.insight-card .insight-direction {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.insight-card .insight-direction.long {
  background: #10b981;
  color: white;
}

.insight-card .insight-direction.short {
  background: #ef4444;
  color: white;
}

.insight-card .insight-direction.neutral {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.insight-card .insight-topic {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 12px;
}

.insight-card .insight-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.insight-card .insight-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.insight-card .insight-stats i {
  margin-right: 4px;
}

/* 交易記錄結果 */
.trades-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.trade-card {
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.trade-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.trade-card .trade-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.trade-card .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.trade-card .author-info {
  flex: 1;
}

.trade-card .author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.trade-card .trade-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.trade-card .trade-content {
  text-align: center;
}

.trade-card .trade-symbol {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.trade-card .trade-info {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.trade-card .trade-type {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.trade-card .trade-direction {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.trade-card .trade-direction.long {
  background: #10b981;
  color: white;
}

.trade-card .trade-direction.short {
  background: #ef4444;
  color: white;
}

.trade-card .trade-profit {
  font-size: 20px;
  font-weight: 700;
}

.trade-card .profit-positive {
  color: #10b981;
}

.trade-card .profit-negative {
  color: #ef4444;
}

/* 創作者徽章 */
.creator-badge {
  color: #f59e0b;
  font-size: 14px;
}

/* 付費徽章 */
.premium-badge {
  padding: 4px 8px;
  background: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 無結果 */
.no-results {
  text-align: center;
  padding: 60px 20px;
}

.no-results i {
  font-size: 48px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.no-results p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.no-results-hint {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* 搜索歷史 */
.search-section {
  padding: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

body[data-page="search"] .section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.clear-history-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.clear-history-btn:hover {
  background: var(--bg-secondary);
  color: var(--error-color);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: all 0.2s;
}

.history-item:hover {
  background: var(--bg-tertiary);
}

.history-query {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

.remove-history-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-history-btn:hover {
  background: var(--bg-tertiary);
  color: var(--error-color);
}

.no-history {
  text-align: center;
  color: var(--text-tertiary);
  padding: 20px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-section {
  margin-bottom: 32px;
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 用戶搜索結果 */
.user-result {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.user-result:hover {
  border-color: var(--primary-color);
  background: var(--bg-tertiary);
}

.user-result-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.user-result-info {
  flex: 1;
  min-width: 0;
}

.user-result-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.user-result-bio {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-result-stats {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.user-result-action {
  flex-shrink: 0;
}

/* 空狀態 */
.empty-results {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-results i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-results h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-results p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 搜索提示 */
.search-tips {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.search-tips p {
  margin-bottom: 8px;
}

.search-tips ul {
  margin: 8px 0;
  padding-left: 20px;
}

.search-tips li {
  margin-bottom: 4px;
}

.search-tips kbd {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 12px;
  font-family: monospace;
}

/* 熱門搜索 */
.hot-searches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hot-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.hot-search-item:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
}

.hot-search-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.hot-search-item:nth-child(1) .hot-search-rank {
  background: #ef4444;
  color: white;
}

.hot-search-item:nth-child(2) .hot-search-rank {
  background: #f59e0b;
  color: white;
}

.hot-search-item:nth-child(3) .hot-search-rank {
  background: #10b981;
  color: white;
}

.hot-search-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 高亮 */
.highlight {
  background: var(--primary-color);
  color: white;
  padding: 2px 4px;
  border-radius: 2px;
}

/* 加載狀態 */
.loading-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-state i {
  font-size: 48px;
  color: var(--primary-color);
  margin-bottom: 16px;
}

.loading-state p {
  color: var(--text-secondary);
  font-size: 16px;
}

.error-state i {
  font-size: 48px;
  color: var(--error-color);
  margin-bottom: 16px;
}

.error-state p {
  color: var(--text-secondary);
  font-size: 16px;
}

/* 搜索建議 */
#searchSuggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestion-item:hover {
  background: var(--bg-secondary);
}

.suggestion-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.suggestion-info {
  flex: 1;
}

.suggestion-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-username {
  font-size: 13px;
  color: var(--text-secondary);
}

.suggestion-symbol {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-type-icon {
  color: var(--text-tertiary);
  font-size: 16px;
}

/* 熱門搜索新樣式 */
.hot-section {
  margin-bottom: 24px;
}

.hot-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hot-tag {
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.hot-tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.hot-creators {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hot-creator {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.hot-creator:hover {
  background: var(--bg-tertiary);
  transform: translateX(4px);
}

.hot-creator img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.hot-creator-info {
  flex: 1;
}

.hot-creator-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.hot-creator-followers {
  font-size: 13px;
  color: var(--text-secondary);
}

.no-hot-searches {
  text-align: center;
  color: var(--text-tertiary);
  padding: 20px;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .search-box {
    max-width: 100%;
  }
  
  .search-tabs {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }
  
  .user-result {
    flex-direction: column;
    text-align: center;
  }
  
  .user-result-bio {
    white-space: normal;
  }
}

