/**
 * 移动端 Header 自定义布局样式
 * 元素顺序：菜单(汉堡) → Logo → 搜索 → 购物车
 */

/* ===== 移动端深色主题（仅 #qodef-page-mobile-header，PC 端不到 1200px 不显示，不受影响） ===== */

/* Header 底色改为页脚色 */
#qodef-page-mobile-header {
    background-color: var(--qode-main-color) !important;
}

/* 汉堡菜单图标变白 */
#qodef-page-mobile-header .qodef-mobile-header-opener {
    color: #fff !important;
}

/* 搜索图标变白 */
#qodef-page-mobile-header .qodef-mobile-header-search-icon {
    color: #fff !important;
}

/* 购物车图标变白 */
#qodef-page-mobile-header .qodef-mobile-header-cart-icon {
    color: #fff !important;
}

/* Logo 图片变白（CSS 反转深色图片） */
#qodef-page-mobile-header .qodef-mobile-header-logo-link img {
    filter: brightness(0) invert(1) !important;
}

/* ===== 布局 ===== */

/* 覆盖默认的 space-between，改为 flex-start */
#qodef-page-mobile-header-inner {
    justify-content: flex-start;
}

/* 汉堡菜单去掉默认的左边距，贴紧左边 */
#qodef-page-mobile-header .qodef-mobile-header-opener {
    margin-left: 0;
}

/* Logo 绝对居中 */
#qodef-page-mobile-header .qodef-mobile-header-logo-link {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%);
}

/* 搜索图标按钮 */
#qodef-page-mobile-header .qodef-mobile-header-search-icon {
    margin-left: auto;
    display: flex;
    align-items: center;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

#qodef-page-mobile-header .qodef-mobile-header-search-icon svg {
    width: 20px;
    height: 20px;
}

/* 购物车图标 */
#qodef-page-mobile-header .qodef-mobile-header-cart-icon {
    margin-left: 14px;
    display: flex;
    align-items: center;
    position: relative;
    color: inherit;
    text-decoration: none;
}

#qodef-page-mobile-header .qodef-mobile-header-cart-icon svg {
    width: 22px;
    height: 22px;
}

/* 购物车数量角标 */
#qodef-page-mobile-header .qodef-mobile-header-cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #d33;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
}

/* 下拉搜索表单，默认隐藏 */
#qodef-page-mobile-header .qodef-mobile-header-search-form {
    display: none;
    padding: 10px 20px 14px;
    background: #fff;
}

#qodef-page-mobile-header .qodef-mobile-header-search-form.active {
    display: block;
}

#qodef-page-mobile-header .qodef-mobile-header-search-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

#qodef-page-mobile-header .qodef-mobile-header-search-input:focus {
    border-color: var(--qode-main-color, #333);
}

/* 搜索结果面板 */
#qodef-page-mobile-header .qodef-mobile-header-search-panel {
    display: none;
    margin-top: 6px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    overflow: hidden;
}

#qodef-page-mobile-header .qodef-mobile-header-search-panel.active {
    display: block;
}

/* 每个搜索结果条目 */
.qodef-mobile-search-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

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

.qodef-mobile-search-item:hover {
    background: #f8f8f8;
}

/* 产品缩略图 */
.qodef-mobile-search-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 12px;
    background: #f5f5f5;
}

/* 产品信息 */
.qodef-mobile-search-item-info {
    flex: 1;
    min-width: 0;
}

.qodef-mobile-search-item-title {
    display: block;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.qodef-mobile-search-item-price {
    display: block;
    font-size: 12px;
    color: var(--qode-main-color, #666);
}

.qodef-mobile-search-item-price del {
    color: #999;
    margin-right: 4px;
}

.qodef-mobile-search-item-price ins {
    text-decoration: none;
}

/* 查看全部按钮 */
.qodef-mobile-search-view-all {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: var(--qode-main-color, #333);
    text-decoration: none;
    transition: opacity 0.15s;
}

.qodef-mobile-search-view-all:hover {
    opacity: 0.85;
}

/* 无结果提示 */
.qodef-mobile-search-no-results {
    padding: 16px 14px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* ===== 产品详情页移动端：减少页面顶部多余空间 ===== */
@media only screen and (max-width: 1200px) {
    #qodef-page-inner {
        padding-top: 0;
    }

    /* 减少产品图片与摘要之间的间距 */
    #qodef-woo-page.qodef--single .qodef-woo-single-inner {
        gap: 0;
    }

    #qodef-woo-page.qodef--single .entry-summary {
        margin-top: 15px;
    }

    /* 产品标题字号缩小 */
    #qodef-woo-page.qodef--single .qodef-woo-product-title {
        font-size: 24px !important;
    }

    /* 数量选择器独占一行，加购和定制按钮并排 */
    #qodef-woo-page.qodef--single form.cart {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    /* 数量占满整行但不拉伸 */
    #qodef-woo-page.qodef--single form.cart .quantity {
        grid-column: 1 / -1 !important;
        justify-self: start !important;
        margin: 0 !important;
    }

    #qodef-woo-page.qodef--single form.cart .single_add_to_cart_button {
        margin: 0 !important;
        float: none !important;
        height: 46px !important;
        line-height: 46px !important;
        padding: 0 8px !important;
        display: block !important;
        text-align: center !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        font-family: inherit !important;
        letter-spacing: 0 !important;
        text-transform: uppercase !important;
        border-radius: 4px !important;
        width: auto !important;
    }

    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap {
        margin: 0 !important;
        float: none !important;
        clear: none !important;
        display: block !important;
    }

    /* Customize 按钮：白底黑字，覆盖所有主题样式 */
    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap .qcd-single-btn,
    #qodef-woo-page.qodef--single form.cart .qcd-quick-design-btn.qcd-single-btn {
        width: auto !important;
        height: 46px !important;
        line-height: 46px !important;
        padding: 0 8px !important;
        display: block !important;
        text-align: center !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        font-family: inherit !important;
        letter-spacing: 0 !important;
        text-transform: uppercase !important;
        border-radius: 4px !important;
        margin: 0 !important;
        float: none !important;
        box-sizing: border-box !important;
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #ddd !important;
        white-space: nowrap !important;
        text-decoration: none !important;
        outline: none !important;
        box-shadow: none !important;
        background-image: none !important;
        cursor: pointer !important;
    }

    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap .qcd-single-btn:hover,
    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap .qcd-single-btn:focus,
    #qodef-woo-page.qodef--single form.cart .qcd-quick-design-btn.qcd-single-btn:hover,
    #qodef-woo-page.qodef--single form.cart .qcd-quick-design-btn.qcd-single-btn:focus {
        background: #f0f0f0 !important;
        color: #333 !important;
        border-color: #bbb !important;
        text-decoration: none !important;
        outline: none !important;
        box-shadow: none !important;
    }

    /* 隐藏所有伪元素 */
    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap .qcd-single-btn::before,
    #qodef-woo-page.qodef--single form.cart .qcd-single-btn-wrap .qcd-single-btn::after {
        display: none !important;
        content: none !important;
    }
}
