/* 容器样式 */
.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    /*background: linear-gradient(45deg, #ff6b6b, #4ecdc4);*/
}
/* 搜索框主体 */
.search-box {
    position: relative;
    background: #fff;
    height: 50px;
    border-radius: 40px;
    /*padding: 10px;*/
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: all 0.5s ease-in-out;
}
/* 悬停效果 */
.search-box:hover {
    /*!*transform: translateY(-2px);*!能让Y轴移动的代码*/
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}
/* 输入框样式 */
.search-input {
    border: none;
    outline: none;
    background: none;
    padding: 0 1.25rem; /* 20px → 相对单位 */
    font-size: 1rem; /* 18px → 16px，小屏幕更友好 */
    line-height: 50px;
    width: 18.75rem; /* 300px → 相对单位 */
    transition: all 0.5s ease;
    color: #333;
    box-sizing: border-box; /* 新增：确保padding不增加总宽度 */
}
/* 搜索按钮 */
.search-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 40px;
    height: 40px;
    /*background: linear-gradient(45deg, #4ecdc4, #45b7af);这个颜色蛮好看,先留着*/
    background: #e28b01;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.5s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}
/* 按钮交互效果 */
.search-btn:hover {
    transform: rotate(15deg) scale(1.3);
    background: #e28b01;
    transition: all 0.5s ease;
}

.search-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* 输入框聚焦时的动画：根据屏幕动态调整最大宽度 */
.search-input:focus {
    width: 100%; /* 改为100%，避免固定宽度溢出 */
    max-width: 28.125rem; /* 450px → 相对单位，桌面端最大宽度 */
}

/* 占位符动画 */
.search-input::placeholder {
    color: #999;
    transition: all 0.3s ease;
}

.search-input:focus::placeholder {
    opacity: 0;
}

/* 加载动画 */
@keyframes loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.searching .search-btn {
    animation: loading 1s linear infinite;
}
.no-results {
    font-size: 30px;
    position: absolute;
    width: 100%;
    justify-content: center;


}
/* 平板端：缩小整体尺寸 */
@media screen and (max-width: 1024px) and (min-width: 768px) {
    .search-box {
        height: 45px; /* 原50px → 45px，略窄 */
    }
    .search-input {
        line-height: 45px; /* 与搜索框高度匹配 */
        width: 15rem; /* 300px → 240px */
        font-size: 0.9375rem; /* 15px */
    }
    .search-input:focus {
        max-width: 21.875rem; /* 450px → 350px */
    }
    .search-btn {
        width: 35px; /* 原40px → 35px */
        height: 35px;
    }
    .search-btn svg {
        width: 18px; /* 原20px → 18px */
        height: 18px;
    }
}
/* 手机端：进一步压缩尺寸，确保不溢出 */
@media screen and (max-width: 768px) {
    .search-container {
        min-height: 60px; /* 原80px → 60px，减少垂直占比 */
        padding: 0 10px; /* 新增左右内边距，避免贴边 */
    }
    .search-box {
        height: 40px; /* 原50px → 40px */
        width: 100%; /* 新增：占满屏幕宽度 */
        max-width: 300px; /* 限制最大宽度 */
    }
    .search-input {
        line-height: 40px; /* 与搜索框高度匹配 */
        width: calc(100% - 50px); /* 动态计算宽度，避开按钮 */
        font-size: 0.875rem; /* 14px */
        padding: 0 0.9375rem; /* 15px */
    }
    .search-input:focus {
        max-width: none; /* 取消最大宽度限制，充分利用屏幕 */
    }
    .search-btn {
        width: 30px; /* 原40px → 30px */
        height: 30px;
        right: 5px;
        top: 5px;
    }
    .search-btn svg {
        width: 16px; /* 原20px → 16px */
        height: 16px;
    }
    /* 手机端优化按钮动画，避免过度放大 */
    .search-btn:hover {
        transform: rotate(15deg) scale(1.1); /* 原scale(1.3) → 1.1 */
    }
}
/* 超小手机（如iPhone SE）：极致压缩 */
@media screen and (max-width: 480px) {
    .search-box {
        max-width: 250px;
    }
    .search-input {
        font-size: 0.8125rem; /* 13px */
    }
    /* 隐藏无结果提示的绝对定位，避免遮挡 */
    .no-results {
        position: static;
        font-size: 1.25rem; /* 20px，原30px过大 */
        margin: 20px auto;
    }
}
