/* ===== 悬浮搜索功能设计 ===== */

/* 悬浮搜索容器 */
#floating-search-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 900; /* 降低z-index，在购物车(1100)和食材选择(1200)之下 */
    transition: all 0.3s ease;
    overflow: visible !important; /* 确保子元素不被裁剪 */
}

/* 悬浮搜索图标按钮 */
.floating-search-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    position: relative;
    z-index: 901; /* 稍高于容器，但仍低于弹窗 */
}

.floating-search-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.5);
}

.floating-search-icon:active {
    transform: scale(0.95);
}

.floating-search-icon .search-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* 展开的搜索框 */
.floating-search-expanded {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 350px;
    background: white;
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: visible !important; /* 确保搜索结果不被裁剪 */
    transform: scale(0) translateX(-50%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom left;
}

.floating-search-expanded.show {
    transform: scale(1) translateX(0);
    opacity: 1;
}

.floating-search-expanded.hidden {
    display: none;
}

/* 搜索输入框容器 */
.floating-search-expanded .search-input-container {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 28px;
    position: relative;
}

/* 搜索图标 */
.floating-search-expanded .search-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.floating-search-expanded .search-input-container:focus-within .search-icon {
    opacity: 1;
}

/* 搜索输入框 */
.floating-search-expanded #search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #191919;
    background: transparent;
    font-weight: 500;
    padding: 0;
    margin: 0 0 0 10px;
}

.floating-search-expanded #search-input::placeholder {
    color: #999;
    font-weight: 400;
}

/* 清除按钮 */
.floating-search-expanded #clear-search {
    display: none;
    background: rgba(255, 107, 107, 0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: #ff6b6b;
    font-size: 16px;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.floating-search-expanded #clear-search:hover {
    background: rgba(255, 107, 107, 0.2);
    transform: scale(1.1);
}

/* 关闭搜索按钮 */
.close-search-btn {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #666;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.close-search-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
    transform: scale(1.1);
}

/* 搜索结果下拉框 */
.floating-search-expanded #search-results {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999 !important; /* 大幅提高z-index，确保在所有元素之上 */
    margin-bottom: 8px;
    display: none; /* 默认隐藏 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* 当搜索结果显示时 */
.floating-search-expanded #search-results.show {
    display: flex;
    flex-direction: column-reverse; /* 从下往上排列 */
}

/* 搜索结果项 */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 12px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 107, 107, 0.05);
    transform: translateX(4px);
}

.search-result-item.active {
    background: rgba(255, 107, 107, 0.1);
}

/* 搜索结果缩略图 */
.search-result-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 搜索结果信息 */
.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-name {
    font-size: 15px;
    font-weight: 600;
    color: #191919;
    line-height: 1.3;
}

.search-result-category {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* 搜索结果价格 */
.search-result-price {
    font-size: 15px;
    font-weight: 700;
    color: #ff6b6b;
    margin-right: 8px;
    white-space: nowrap;
}

/* 搜索结果ADD按钮 */
.search-result-add-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ff6b6b;
    border-radius: 50%;
    background: white;
    color: #ff6b6b;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.search-result-add-btn:hover {
    background: #ff6b6b;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* 关键词高亮 */
.search-highlight {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 3px;
}

/* 无结果状态 */
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
    gap: 12px;
}

.search-no-results svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* 添加到购物车反馈 */
.add-to-cart-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    z-index: 1300; /* 确保反馈信息在所有元素之上 */
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.add-to-cart-feedback.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    #floating-search-container {
        bottom: 20px;
        left: 20px;
    }
    
    .floating-search-icon {
        width: 50px;
        height: 50px;
    }
    
    .floating-search-icon .search-icon {
        width: 20px;
        height: 20px;
    }
    
    .floating-search-expanded {
        width: 300px;
    }
    
    .floating-search-expanded .search-input-container {
        padding: 14px 16px;
    }
    
    .floating-search-expanded #search-input {
        font-size: 15px;
    }
    
    .search-result-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .search-result-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    .search-result-name {
        font-size: 14px;
    }
    
    .search-result-category {
        font-size: 12px;
    }
    
    .search-result-price {
        font-size: 14px;
    }
    
    .search-result-add-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

@media screen and (max-width: 480px) {
    #floating-search-container {
        bottom: 15px;
        left: 15px;
    }
    
    .floating-search-icon {
        width: 46px;
        height: 46px;
    }
    
    .floating-search-expanded {
        width: 280px;
    }
    
    .floating-search-expanded .search-input-container {
        padding: 12px 14px;
    }
    
    .floating-search-expanded #search-input {
        font-size: 14px;
    }
    
    .search-result-item {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .search-result-thumbnail {
        width: 36px;
        height: 36px;
    }
    
    .search-result-add-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* 隐藏旧的搜索栏相关样式 */
#search-bar-container {
    display: none !important;
}

/* 移除菜单导航的底部margin，因为不再需要为搜索栏留空间 */
#menu-navigation-sticky {
    margin-bottom: 0 !important;
}

/* 调整菜单容器的padding */
#menu-container {
    padding-top: 20px !important;
}

/* 菜品高亮效果 */
.menu-item.highlighted {
    transform: scale(1.02) !important;
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.3) !important;
    border: 2px solid rgba(255, 107, 107, 0.5) !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    position: relative !important;
}

/* ===== 返回顶部按钮 ===== */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
    z-index: 900; /* 与搜索按钮保持相同层级 */
    opacity: 1;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    transform: scale(1.1) translateY(0);
    box-shadow: 0 12px 35px rgba(76, 175, 80, 0.5);
}

.back-to-top-btn:active {
    transform: scale(0.95) translateY(0);
}

.back-to-top-btn.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.back-to-top-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* 响应式设计 - 返回顶部按钮 */
@media screen and (max-width: 768px) {
    .back-to-top-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .back-to-top-icon {
        width: 20px;
        height: 20px;
    }
}

@media screen and (max-width: 480px) {
    .back-to-top-btn {
        bottom: 15px;
        right: 15px;
        width: 46px;
        height: 46px;
    }
    
    .back-to-top-icon {
        width: 18px;
        height: 18px;
    }
} 