/* 搜索框独立样式 */
.search-container {
  padding: 8px;
  margin: 8px;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

form[name="f"] {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 500px !important;
  width: 100%;
  margin: 0 auto !important;
}

.search-input {
  flex: 1;
  height: 40px;
  padding: 0 8px;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  min-width: 0;
}

.search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-engine-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  outline: none;
  position: relative;
}

.search-engine-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-engine-icon {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 50%;
  border: none;
  outline: none;
}

.search-engine-icon.google,
.search-engine-icon.bing {
  width: 28px;
  height: 28px;
}

.search-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.search-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-button:active {
  transform: scale(0.95);
}

.search-engine-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 8px;
  flex-direction: row;
  gap: 8px;
  z-index: 1000;
  animation: slideDown 0.2s ease;
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.search-engine-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 26px;
  height: 26px;
  outline: none;
  flex-shrink: 0;
  overflow: hidden;
}

.search-engine-option:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: scale(1.05);
}

.search-engine-option.active {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.search-engine-option-icon {
  width: 24px;
  height: 24px;
  display: block;
  border: none;
  background: transparent;
}

.search-engine-option:nth-child(2) .search-engine-option-icon,
.search-engine-option:nth-child(3) .search-engine-option-icon {
  width: 28px;
  height: 28px;
}

.search-engine-option span {
  display: none;
}

/* 手机端下拉菜单竖向排列 */
@media (max-width: 480px) {
  .header h1 {
    font-size: 16px;
  }

  .search-container {
    margin: 8px 5px;
    border-radius: 5px;
  }

  .search-engine-dropdown {
    border-radius: 5px;
  }

  .search-engine-option {
    border-radius: 50%;
  }

  .search-input {
    border-radius: 5px;
  }

  .search-engine-btn {
    border-radius: 50%;
  }

  .search-button {
    border-radius: 50%;
  }

  .search-engine-dropdown {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
    gap: 8px;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    min-width: auto;
    width: auto;
    max-width: 50px;
  }
}
