/* ==============================
   搜索框主容器样式
   ============================== */
.search-box {
    position: relative;        /* 相对定位，为内部绝对定位元素提供参考 */
    display: block;           /* 块级显示 */
    width: 100%;              /* 宽度100%适应父容器 */
    margin: 0 auto;           /* 水平居中 */
}

/* ==============================
   搜索输入框样式
   ============================== */
.search-input {
    width: 100%;              /* 宽度100%填满容器 */
    height: 35px;             /* 固定高度35像素 */
    font-size: 16px;          /* 字体大小16像素，适合阅读 */
    padding: 5px;             /* 内边距5像素 */
    padding-right: 50px;      /* 右侧额外内边距，为清除按钮和放大镜留空间 */
    border: 1.5px dashed green; /* 绿色虚线边框，视觉上突出显示 */
    border-radius: 5px;       /* 5像素圆角，柔和边角 */
    color: inherit;           /* 继承父元素文字颜色 */
    background-color: transparent; /* 透明背景，与页面主题融合 */
    transition: background-color 0.3s ease; /* 背景色过渡动画，0.3秒缓动效果 */
}

/* ==============================
   搜索下拉菜单样式
   ============================== */
.search-dropdown {
    position: absolute;       /* 绝对定位，相对于.search-box定位 */
    top: 100%;               /* 定位在搜索框底部 */
    left: 0;                 /* 左侧对齐搜索框 */
    width: 100%;             /* 宽度与搜索框相同 */
    max-height: 200px;       /* 最大高度200像素，避免过长 */
    overflow-y: auto;        /* 内容超出时显示垂直滚动条 */
    background-color: rgba(120, 120, 120, 0.95); /* 半透明灰色背景，95%不透明度 */
    border: 1px solid #ccc;  /* 浅灰色实线边框 */
    border-radius: 0 5px 5px; /* 上边无圆角，下边左右圆角，与搜索框视觉衔接 */
    display: none;           /* 默认隐藏，通过JavaScript控制显示 */
    z-index: 1;              /* 层级为1，确保显示在内容上方 */
    list-style-type: none;   /* 移除列表默认样式（圆点等） */
    margin: 0 auto;          /* 水平居中 */
    text-align: center;      /* 文字居中对齐 */
}

/* ==============================
   下拉菜单列表项样式
   ============================== */
.search-dropdown li {
    box-sizing: border-box;   /* 盒模型计算包含内边距和边框 */
    padding: 0px 10px;        /* 上下1像素，左右10像素内边距 */
    border-bottom: 1px solid #ccc; /* 底部1像素浅灰色边框，分隔线效果 */
    display: inline-block;    /* 行内块显示，实现横向排列 */
    width: auto;              /* 宽度自适应内容 */
    margin-right: 10px;       /* 右侧10像素外边距，项间距 */
    line-height: 1.5;         /* 添加较小的行高 */
}

/* ==============================
   下拉菜单链接样式
   ============================== */
.search-dropdown a {
    text-decoration: none;    /* 移除链接下划线 */
    color: #fff;              /* 白色文字，在灰色背景上清晰可见 */
}

/* 下拉菜单链接悬停效果 */
.search-dropdown a:hover {
    color: red;               /* 鼠标悬停时文字变为红色，提供视觉反馈 */
}

/* 当前选中搜索引擎样式 */
.search-dropdown li.active a {
    color: #00ff00 !important; /* 绿色高亮显示当前选中引擎 */
    font-weight: bold; /* 可选：加粗突出显示 */
}

/* ==============================
   清除按钮样式
   ============================== */
.search-input-clear {
    position: absolute;       /* 绝对定位，相对于.search-box定位 */
    right: 30px;             /* 距离右侧30像素位置 */
    cursor: default;          /* 默认箭头光标，表示不可点击状态 */
    font-size: 20px;          /* 20像素字体大小，清晰可见 */
    color: #FF0000;           /* 红色，警示色表示清除功能 */
    opacity: 0;               /* 默认完全透明，隐藏状态 */
}

/* 当搜索框有内容时清除按钮光标样式 */
.search-input:not(:placeholder-shown) ~ .search-input-clear {
    cursor: pointer;          /* 手型光标，表示可点击状态 */
}

/* 移动端清除按钮位置调整 */
@media only screen and (max-width: 768px) {
    .search-input-clear {
        top: -1px;            /* 在移动端微调垂直位置 */
    }
}

/* 当搜索框有内容时显示清除按钮 */
.search-input:not(:placeholder-shown) + .search-input-clear {
    opacity: 1;               /* 完全不透明，显示清除按钮 */
}

/* ==============================
   放大镜图标样式
   ============================== */
.search-fangdajing {
    position: absolute;       /* 绝对定位，相对于.search-box定位 */
    right: 5px;              /* 距离右侧5像素位置 */
    top: 50%;                /* 垂直居中定位 */
    transform: translateY(-50%); /* 垂直偏移-50%，实现精确垂直居中 */
    width: 20px;             /* 宽度20像素 */
    height: 20px;            /* 高度20像素 */
    background: url('/images/放大镜.svg') no-repeat center/contain; /* SVG图标背景，居中显示并适应容器 */
    cursor: pointer;          /* 手型光标，表示可点击 */
    opacity: 0.8;             /* 80%不透明度，半透明效果 */
    transition: all 0.3s ease; /* 所有属性0.3秒缓动过渡动画 */
    filter: brightness(0.9);  /* 亮度90%，稍微变暗 */
}

/* 放大镜悬停效果 */
.search-fangdajing:hover {
    opacity: 1;               /* 完全不透明，清晰显示 */
    filter: brightness(1.1);  /* 亮度110%，稍微变亮 */
    transform: translateY(-50%) scale(1.05); /* 垂直居中基础上放大1.05倍 */
}

/* ==============================
   移动端响应式样式
   ============================== */
@media only screen and (max-width: 768px) {
    .search-dropdown {
        line-height: 23px;           /* 行高23像素，适合移动端触摸 */
        border-radius: 0 5px 5px 3px; /* 调整圆角，移动端视觉优化 */
        white-space: nowrap;         /* 禁止文字换行 */
        overflow-x: auto;            /* 允许水平滚动，适应小屏幕 */
        justify-content: flex-start; /* 内容左对齐 */
    }
    
    .search-dropdown li {
        display: inline-block;       /* 行内块显示，保持横向排列 */
        margin: 0 5px 5px;           /* 外边距，移动端紧凑布局 */
    }
}
