/**
 * 搜索弹窗样式
 * Search Modal Styles for Desktop
 */

/* 确保搜索图标按钮可见可点击 */
#open-search-modal {
    cursor: pointer !important;
    display: block !important;
    width: 26px !important;
    height: 26px !important;
    margin-left: 15px !important;
}

/* 搜索弹窗容器 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 1;
}

/* 遮罩层 */
.search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

/* 弹窗内容 */
.search-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    margin-top: 100px;
    background: #ffffff;
    border-radius: 0; /* 去掉圆角 */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: slideDown 0.4s ease;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 关闭按钮 */
.search-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    font-size: 36px;
    line-height: 40px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    padding: 0;
}

.search-modal-close:hover {
    color: #333;
    transform: rotate(90deg);
}

/* 弹窗标题 */
.search-modal-header {
    padding: 30px 30px 20px 30px;
    border-bottom: 1px solid #f0f0f0;
}

.search-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    font-family: 'Bodoni Moda SC', serif;
}

/* 弹窗主体 */
.search-modal-body {
    padding: 30px;
    overflow-y: visible; /* 去掉滚动条 */
    overflow-x: hidden; /* 隐藏横向滚动 */
    flex: 1;
}

/* 搜索表单 */
.search-modal-form {
    margin-bottom: 20px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f8f8;
    border: 2px solid #e0e0e0;
    border-radius: 0; /* 去掉圆角 */
    padding: 5px 5px 5px 25px;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #849075;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(132, 144, 117, 0.15);
}

.search-modal-input {
    flex: 1;
    border: none;
    background: none;
    padding: 15px 10px;
    font-size: 16px;
    color: #333;
    outline: none;
}

.search-modal-input::placeholder {
    color: #999;
}

.search-modal-submit {
    width: 50px;
    height: 50px;
    background: #849075;
    border: none;
    border-radius: 0; /* 去掉圆角 */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-modal-submit:hover {
    background: #6d7861;
    transform: scale(1.05);
}

.icon-search-submit {
    display: block;
    width: 20px;
    height: 20px;
    background: url(../img/icon-search.png) no-repeat center center;
    background-size: 20px 20px;
    filter: brightness(0) invert(1);
}

/* 搜索建议容器 */
.search-modal-suggestions {
    margin-top: 10px;
    max-height: none; /* 去掉最大高度限制 */
    overflow-y: visible; /* 去掉滚动条 */
    overflow-x: hidden; /* 隐藏横向滚动 */
}

/* 建议区块 */
.modal-suggestions-section {
    margin-bottom: 25px;
}

.modal-suggestions-section:last-child {
    margin-bottom: 0;
}

/* 区块标题 */
.modal-suggestions-title {
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

/* 建议项 */
.modal-suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 0; /* 去掉圆角 */
    margin-bottom: 8px;
}

.modal-suggestion-item:hover,
.modal-suggestion-item.selected {
    background-color: #f8f8f8;
    transform: translateX(5px);
}

/* 产品建议 */
.modal-suggestion-product {
    padding: 15px 12px;
}

.modal-suggestion-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 15px;
    border-radius: 0; /* 去掉圆角 */
    overflow: hidden;
    background-color: transparent; /* 透明背景 */
    border: none; /* 去掉边框 */
}

.modal-suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-suggestion-details {
    flex: 1;
    min-width: 0;
}

.modal-suggestion-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-suggestion-price {
    font-size: 14px;
    color: #849075;
    font-weight: 600;
}

.modal-suggestion-stock {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 分类建议 */
.modal-suggestion-category {
    gap: 10px;
}

.modal-suggestion-category .icon-category {
    width: 24px;
    height: 24px;
    color: #849075;
    flex-shrink: 0;
}

.modal-suggestion-category .icon-category::before {
    content: "📁";
    font-size: 20px;
}

.modal-suggestion-count {
    margin-left: auto;
    font-size: 13px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 12px;
}

/* 高亮搜索词 */
.modal-suggestion-item mark {
    background-color: #fff3cd;
    color: #333;
    font-weight: 600;
    padding: 0 3px;
    border-radius: 2px;
}

/* 状态提示 */
.modal-search-loading,
.modal-search-no-results,
.modal-search-error {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 15px;
}

.modal-search-error {
    color: #d4a574;
}

/* 底部操作 */
.modal-suggestions-footer {
    padding: 20px 0 10px 0;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    margin-top: 20px;
}

.modal-view-all-results {
    display: inline-block;
    padding: 12px 30px;
    background: #849075;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0; /* 去掉圆角 */
    transition: all 0.3s ease;
}

.modal-view-all-results:hover {
    background: #6d7861;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(132, 144, 117, 0.3);
}

/* 滚动条样式 - 完全隐藏 */
.search-modal-suggestions::-webkit-scrollbar,
.search-modal-body::-webkit-scrollbar {
    display: none; /* 隐藏滚动条 */
}

.search-modal-suggestions,
.search-modal-body {
    -ms-overflow-style: none;  /* IE和Edge */
    scrollbar-width: none;  /* Firefox */
}

/* 禁止body滚动 */
body.search-modal-open {
    overflow: hidden;
}

/* 平板和小屏幕适配 */
@media (max-width: 1024px) {
    .search-modal-content {
        width: 95%;
        margin-top: 60px;
    }
    
    .search-modal-header h2 {
        font-size: 20px;
    }
}

/* 隐藏PC搜索弹窗在移动端 */
@media (max-width: 768px) {
    .search-modal {
        display: none !important;
    }
}

/* 加载动画 */
.modal-search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #849075;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

