﻿.search-container {
  text-align: center;
  margin: 24px auto 0;
  max-width: 600px;
}

.search-box {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 42px;
  /* 关键修改：去掉 border，改用 box-shadow 模拟边框 */
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.2);
  overflow: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid transparent; /* 预留位防止抖动 */
}

/* 聚焦状态：模拟谷歌搜索框聚焦的发光感 */
.search-box:focus-within {
  box-shadow: 0 1px 8px rgba(66, 133, 244, 0.3), 0 0 0 1px rgba(66, 133, 244, 0.1);
}

/* Logo 保持不变 */
.search-box .icon {
  width: 40px;
  height: 100%;
  flex-shrink: 0;
  background-color: #fff;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 10px 0 0 10px;
}

/* 输入框保持不变 */
.search-box input[type='text'] {
  flex: 1;
  height: 100%;
  padding: 0 15px;
  border: none;
  outline: none;
  background-color: #fff;
  color: #333;
  font-size: 14px;
}

.search-box input[type='text']::placeholder {
  color: #999;
}

/* 下拉选择器保持不变 */
.search-box .select-wrapper {
  position: relative;
  display: inline-block;
  height: 100%;
  width: 80px;
  flex-shrink: 0;
}

.search-box select {
  height: 100%;
  padding: 0 20px 0 0;
  border: none;
  border-left: 1.5px solid #e0e0e0;
  border-right: 1.5px solid #e0e0e0;
  outline: none;
  background-color: #fff;
  cursor: pointer;
  color: #555;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 80px;
  text-align: center;
  text-align-last: center;
  box-sizing: border-box;
}

.search-box .select-wrapper::after {
  content: '▼';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #555;
  pointer-events: none;
}

/* 按钮主体：确保 360度 全包围流光 */
.search-box button {
  height: 100%;
  padding: 0 28px;
  border: none;
  outline: none;
  background-color: transparent; /* 背景色由 after 提供 */
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border-radius: 0 10px 10px 0;
}

/* 按钮底层：360度旋转的4色流光 */
.search-box button::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 0 10px 10px 0;
  background: conic-gradient(
    #4285f4, #ea4335, #fbbc05, #34a853, #4285f4
  );
  z-index: -2;
  animation: google-spin-fallback 4s linear infinite;
  filter: blur(0.3px);
}

/* 按钮中层：蓝色遮罩，决定流光条的厚度 (3px) */
.search-box button::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #0073e6;
  border-radius: 0 10px 10px 0;
  z-index: -1;
  transition: background-color 0.2s;
}

/* 支持现代浏览器的 @property 版本 */
@supports (--angle: 0deg) {
  @property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
  }

  .search-box button::before {
    background: conic-gradient(
      from var(--angle, 0deg),
      #4285f4, #ea4335, #fbbc05, #34a853, #4285f4
    );
    animation: google-spin 4s linear infinite;
  }
}

@keyframes google-spin {
  to { --angle: 360deg; }
}

@keyframes google-spin-fallback {
  to { transform: rotate(360deg); }
}

.search-box button:hover::after {
  background-color: #0066d6;
}

.search-box button:hover::before {
  animation-duration: 0.5s;
  filter: blur(0.3px);
}

/* 错误状态：红色晕染阴影 */
.search-box.error {
  border-color: rgba(234, 67, 53, 0.4);
  box-shadow: 0 1px 8px rgba(234, 67, 53, 0.25), 0 0 0 1px rgba(234, 67, 53, 0.1);
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
