/* 🔍 全局搜索页面样式 - 现代化设计 */

/* CSS变量定义 - 与其他页面保持一致 */
page {
  --primary-color: #007AFF;
  --primary-light: #5AC8FA;
  --primary-dark: #0051D5;
  --background-color: #F2F2F7;
  --surface-color: #FFFFFF;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --border-color: #E5E5EA;
  --shadow-light: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  --radius-small: 8rpx;
  --radius-medium: 12rpx;
  --radius-large: 20rpx;
}

/* 🌙 深色模式支持 */
@media (prefers-color-scheme: dark) {
  page {
    --primary-color: #0A84FF;
    --primary-light: #64D2FF;
    --primary-dark: #0056CC;
    --background-color: #000000;
    --surface-color: #1C1C1E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --text-tertiary: #48484A;
    --border-color: #38383A;
    --shadow-light: 0 1rpx 3rpx rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4rpx 12rpx rgba(0, 0, 0, 0.4);
  }
}

.search-container {
  height: 100vh;
  background: var(--background-color);
  display: flex;
  flex-direction: column;
}

/* 🎨 现代化搜索头部 */
.search-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  box-shadow: var(--shadow-medium);
  z-index: 1000;
}

.header-content {
  height: 88rpx;
  display: flex;
  align-items: center;
  padding: 0 24rpx;
  gap: 16rpx;
}

.back-btn {
  width: 72rpx;
  height: 72rpx;
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.back-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.back-icon {
  font-size: 36rpx;
  color: white;
  font-weight: 600;
}

/* 🎨 现代化搜索输入框 */
.search-input-container {
  flex: 1;
}

.search-input-wrapper {
  height: 72rpx;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-large);
  display: flex;
  align-items: center;
  padding: 0 24rpx;
  gap: 16rpx;
  backdrop-filter: blur(10rpx);
  border: 1rpx solid rgba(255, 255, 255, 0.3);
}

.search-icon {
  font-size: 32rpx;
  color: var(--text-secondary);
}

.search-input {
  flex: 1;
  font-size: 32rpx;
  color: var(--text-primary);
  background: transparent;
  line-height: 1.4;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.clear-btn {
  width: 48rpx;
  height: 48rpx;
  border-radius: 50%;
  background: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.clear-btn:active {
  background: var(--text-secondary);
  transform: scale(0.9);
}

.clear-icon {
  font-size: 24rpx;
  color: white;
  font-weight: 600;
}

.search-btn {
  padding: 20rpx 32rpx;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-medium);
  transition: all 0.3s ease;
}

.search-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.search-btn-text {
  font-size: 28rpx;
  color: white;
  font-weight: 600;
}

/* 🎨 搜索内容区域 */
.search-content {
  flex: 1;
  background: var(--background-color);
  overflow: hidden;
}

/* 🎨 搜索建议和历史 */
.search-suggestions {
  padding: 32rpx;
}

.suggestion-section {
  margin-bottom: 40rpx;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: 600;
  color: var(--text-primary);
}

.clear-history-btn {
  padding: 12rpx 24rpx;
  background: var(--background-color);
  border-radius: var(--radius-small);
  border: 1rpx solid var(--border-color);
  transition: all 0.2s ease;
}

.clear-history-btn:active {
  background: var(--border-color);
}

.clear-text {
  font-size: 26rpx;
  color: var(--text-secondary);
}

/* 🎨 搜索历史列表 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16rpx;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 24rpx;
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  border: 1rpx solid var(--border-color);
  transition: all 0.2s ease;
}

.history-item:active {
  background: var(--background-color);
  transform: scale(0.98);
}

.history-icon {
  font-size: 32rpx;
  color: var(--text-secondary);
  margin-right: 24rpx;
}

.history-text {
  flex: 1;
  font-size: 30rpx;
  color: var(--text-primary);
  line-height: 1.4;
}

.remove-history-btn {
  width: 48rpx;
  height: 48rpx;
  border-radius: 50%;
  background: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-history-btn:active {
  background: var(--border-color);
  transform: scale(0.9);
}

.remove-icon {
  font-size: 24rpx;
  color: var(--text-secondary);
}

/* 🎨 热门搜索 */
.hot-search-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16rpx;
}

.hot-search-item {
  padding: 16rpx 24rpx;
  background: var(--surface-color);
  border-radius: var(--radius-large);
  border: 1rpx solid var(--border-color);
  transition: all 0.2s ease;
}

.hot-search-item:active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.hot-search-item:active .hot-search-text {
  color: white;
}

.hot-search-text {
  font-size: 28rpx;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

/* 🎨 搜索提示 */
.search-tips {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120rpx 32rpx;
  text-align: center;
}

.tips-icon {
  font-size: 120rpx;
  margin-bottom: 32rpx;
  opacity: 0.4;
}

.tips-title {
  font-size: 36rpx;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16rpx;
}

.tips-description {
  font-size: 28rpx;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 🎨 搜索结果区域 */
.search-results {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.search-status-bar {
  padding: 24rpx 32rpx;
  background: var(--surface-color);
  border-bottom: 1rpx solid var(--border-color);
}

.search-status-text {
  font-size: 28rpx;
  color: var(--text-secondary);
  margin-bottom: 16rpx;
  display: block;
}

/* 🎨 搜索类型筛选 */
.search-type-filter {
  display: flex;
  gap: 16rpx;
}

.filter-item {
  padding: 12rpx 24rpx;
  background: var(--background-color);
  border-radius: var(--radius-large);
  border: 1rpx solid var(--border-color);
  transition: all 0.2s ease;
}

.filter-item.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.filter-item:active {
  transform: scale(0.95);
}

.filter-text {
  font-size: 26rpx;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.filter-item.active .filter-text {
  color: white;
}

/* 🎨 搜索结果滚动区域 */
.results-scroll {
  flex: 1;
  background: var(--background-color);
}

.result-section {
  padding: 16rpx 32rpx;
}

/* 🎨 搜索结果项 */
.result-item {
  display: flex;
  align-items: flex-start;
  padding: 28rpx;
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  border: 1rpx solid var(--border-color);
  margin-bottom: 16rpx;
  transition: all 0.2s ease;
}

.result-item:active {
  background: var(--background-color);
  transform: scale(0.98);
}

.result-avatar {
  margin-right: 24rpx;
}

.avatar-image {
  width: 88rpx;
  height: 88rpx;
  border-radius: 44rpx;
  border: 2rpx solid var(--border-color);
}

.avatar-placeholder {
  width: 88rpx;
  height: 88rpx;
  border-radius: 44rpx;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2rpx solid var(--border-color);
}

.avatar-text {
  font-size: 32rpx;
  font-weight: 600;
  color: white;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12rpx;
}

.sender-name {
  font-size: 30rpx;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 16rpx;
}

.message-time {
  font-size: 24rpx;
  color: var(--text-secondary);
  white-space: nowrap;
}

.result-body {
  margin-bottom: 12rpx;
}

.message-text {
  font-size: 28rpx;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.message-media {
  display: flex;
  align-items: center;
  gap: 12rpx;
}

.media-icon {
  font-size: 28rpx;
}

.media-text {
  font-size: 28rpx;
  color: var(--text-secondary);
}

.conversation-info {
  margin-top: 8rpx;
}

.conversation-name {
  font-size: 24rpx;
  color: var(--text-tertiary);
}

.result-actions {
  margin-left: 16rpx;
}

.action-btn {
  width: 64rpx;
  height: 64rpx;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.action-btn:active {
  background: var(--primary-dark);
  transform: scale(0.9);
}

.action-icon {
  font-size: 28rpx;
  color: white;
  font-weight: 600;
}

/* 🎨 搜索高亮样式 */
.search-highlight {
  background: linear-gradient(135deg, rgba(255, 235, 59, 0.3) 0%, rgba(255, 193, 7, 0.3) 100%);
  border-radius: 4rpx;
  padding: 0 4rpx;
  font-weight: 600;
}

/* 🎨 加载更多 */
.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40rpx;
  gap: 16rpx;
}

.load-more-text {
  font-size: 28rpx;
  color: var(--text-secondary);
}

/* 🎨 无结果提示 */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120rpx 32rpx;
  text-align: center;
}

.no-results-icon {
  font-size: 120rpx;
  margin-bottom: 32rpx;
  opacity: 0.4;
}

.no-results-title {
  font-size: 36rpx;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16rpx;
}

.no-results-description {
  font-size: 28rpx;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 🎨 加载状态 */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120rpx 32rpx;
  gap: 32rpx;
}

.loading-spinner {
  width: 60rpx;
  height: 60rpx;
  border: 4rpx solid var(--border-color);
  border-top: 4rpx solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 28rpx;
  color: var(--text-secondary);
}

/* 📱 响应式设计 - 适配不同屏幕尺寸 */
@media screen and (max-width: 375px) {
  .header-content {
    height: 80rpx;
    padding: 0 20rpx;
  }
  
  .search-input-wrapper {
    height: 64rpx;
  }
  
  .search-input {
    font-size: 28rpx;
  }
  
  .search-suggestions {
    padding: 24rpx;
  }
  
  .suggestion-item {
    padding: 20rpx;
  }
  
  .suggestion-text {
    font-size: 28rpx;
  }
  
  .result-item {
    padding: 24rpx;
  }
  
  .avatar-image, .avatar-placeholder {
    width: 72rpx;
    height: 72rpx;
    border-radius: 36rpx;
  }
  
  .sender-name {
    font-size: 28rpx;
  }
  
  .message-text {
    font-size: 26rpx;
  }
}

@media screen and (min-width: 414px) {
  .header-content {
    height: 96rpx;
    padding: 0 32rpx;
  }
  
  .search-input-wrapper {
    height: 80rpx;
  }
  
  .search-input {
    font-size: 36rpx;
  }
  
  .search-suggestions {
    padding: 40rpx;
  }
  
  .suggestion-item {
    padding: 28rpx;
  }
  
  .suggestion-text {
    font-size: 32rpx;
  }
  
  .result-item {
    padding: 32rpx;
  }
  
  .avatar-image, .avatar-placeholder {
    width: 96rpx;
    height: 96rpx;
    border-radius: 48rpx;
  }
  
  .sender-name {
    font-size: 32rpx;
  }
  
  .message-text {
    font-size: 30rpx;
  }
}

@media screen and (max-height: 667px) {
  .search-suggestions {
    padding: 24rpx;
  }
  
  .no-results {
    padding: 80rpx 32rpx;
  }
  
  .loading-state {
    padding: 80rpx 32rpx;
  }
}

@media screen and (min-height: 812px) {
  .search-suggestions {
    padding: 40rpx;
  }
  
  .no-results {
    padding: 160rpx 32rpx;
  }
  
  .loading-state {
    padding: 160rpx 32rpx;
  }
}
