/* ========== 全局基础重置 & 全局变量 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --main: #3A7D70; /* 梅子青主?*/
    --fenqing: #8ad6cb;
    --meizi: #56ab91;
    --binglie: #e0e5e5;
    --mihuang: #f0e6c8;
    --yuebai: #d4e4ed;
    --bg: #f8f8f5; /* 页面米白?*/
    --white: #ffffff;
    --text-dark: #223330;
    --text-gray: #556663;
    --text-light: #778885;
    --danger: #e74c3c;
    --success: #52C41A;
    --warning: #FAAD14;
    
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 24px rgba(0,0,0,0.10);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s ease;
}
body {
    background-color: var(--bg);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    padding-top: 72px; /* 固定导航高度预留 */
}
h1,h2,h3,h4,h5,h6 {
    font-family: "Noto Serif SC", serif;
    font-weight: 600;
}
a {
    text-decoration: none;
    color: inherit;
}
button, input, select, textarea {
    font-family: inherit;
    border: none;
    outline: none;
}
img {
    max-width: 100%;
    object-fit: cover;
}
ul,ol {
    list-style: none;
}

/* ========== 顶部全局导航栏（所有页面共用） ========== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: var(--white);
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.top-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 600;
    color: var(--main);
}
.top-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--main);
    border-radius: var(--radius-sm);
    color: #fff;
    display: grid;
    place-items: center;
}
.top-slogan {
    font-size: 16px;
    color: var(--text-gray);
    font-weight: 400;
}
.top-nav {
    display: flex;
    gap: 24px;
    margin-left: 40px;
}
.top-nav a {
    font-size: 15px;
    color: var(--text-gray);
    transition: var(--transition);
}
.top-nav a.active {
    color: var(--main);
}
.top-nav a:hover {
    color: var(--main);
}
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
.top-time {
    font-size: 14px;
    color: var(--text-light);
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 20px;
}
.top-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.top-user:hover {
    background: #f0f3f2;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--main);
    color: #fff;
    display: grid;
    place-items: center;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
.cart-icon {
    position: relative;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.cart-icon:hover {
    background: #f0f3f2;
}
.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    font-size: 12px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transform: scale(0);
    transition: transform 0.2s;
}
.cart-count.show {
    transform: scale(1);
}

/* ========== 通用容器、板块、卡?========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}
.section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}
.section-title {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-dark);
}
.section-sub {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.grid-product {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ========== 按钮通用样式 ========== */
.btn-main {
    background: var(--main);
    color: #fff;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-main:hover {
    background: #2d665b;
}
.btn-outline {
    border: 1px solid var(--main);
    background: transparent;
    color: var(--main);
    padding: 11px 27px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-outline:hover {
    background: var(--main);
    color: #fff;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ========== 购物车侧边栏 全局通用 ========== */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1998;
    display: none;
}
.cart-overlay.show {
    display: block;
}
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 20px rgba(0,0,0,0.1);
    z-index: 1999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cart-sidebar.show {
    right: 0;
}
.cart-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f3f2;
    cursor: pointer;
}
.cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.cart-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}
.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}
.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
}
.cart-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}
.cart-total span:last-child {
    color: var(--danger);
    font-size: 22px;
}
.cart-quantity-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}
.cart-delete-btn {
    color: var(--danger);
    background: transparent;
    font-size: 12px;
}

/* ========== 弹窗通用 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show {
    display: flex;
}
.modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f3f2;
    cursor: pointer;
    z-index: 10;
}

/* ========== 底部统一页脚 ========== */
.footer {
    background: var(--text-dark);
    color: #fff;
    padding: 50px 0;
    margin-top: 60px;
}
.footer .container {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 40px;
}
.footer-slogan {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--fenqing);
}
.footer-nav h4 {
    margin-bottom: 16px;
    color: var(--fenqing);
}
.footer-nav a {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
}
.footer-bottom {
    text-align: center;
    padding-top: 30px;
    margin-top: 40px;
    border-top: #444 solid 1px;
    color: #aaa;
    font-size: 14px;
}

/* ========== 筛选标签通用 ========== */
.filter-bar {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}
.filter-label {
    font-weight: 500;
    color: var(--text-dark);
}
.filter-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}
.filter-btn.active {
    background: var(--main);
    color: #fff;
    border-color: var(--main);
}

/* ========== 首页工艺图标样式（替换emoji图片?========== */
.adv-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== ai-custom.html 专用全套样式（含fixed右侧预览?========== */
/* 页面窄幅Banner */
.page-banner {
    width: 100%;
    height: 280px;
    border-radius: var(--radius-lg);
    background: linear-gradient(rgba(248, 248, 245, 0.92), rgba(212, 228, 237, 0.88)), url("https://img0.baidu.com/it/u=1864223,411&fm=253&fmt=auto&w=1600&h=420") center/cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 40px;
}
.banner-page-title {
    font-size: 36px;
    letter-spacing: 4px;
    margin-bottom: 10px;
}
.banner-page-sub {
    font-size: 18px;
    color: var(--text-gray);
}
/* 左侧选项容器 */
.custom-main {
    width: 50%;
}
/* 定制选项板块 */
.option-section {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}
.option-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.option-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}
.option-item:hover {
    background: var(--bg);
}
.option-item.selected {
    border-color: var(--main);
    background: #f0f3f2;
}
.option-img {
    width: 100%;
    height: 140px;
    border-radius: 6px;
    object-fit: cover;
    background: #f0f3f2;
}
.option-name {
    font-size: 13px;
    color: var(--text-gray);
    text-align: center;
}
/* 右侧固定悬浮预览区（核心修复代码?*/
.preview-area {
    position: fixed;
    top: 90px;
    right: calc((100% - 1400px) / 2 + 20px);
    width: calc(50% - 60px);
    max-width: 560px;
    height: fit-content;
    z-index: 90;
    pointer-events: auto;
}
.preview-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    text-align: center;
}
.preview-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f3f2;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    position: relative;
}
.preview-img {
    max-width: 82%;
    max-height: 82%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}
.preview-img.loading {
    opacity: 0.3;
}
.preview-tip {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--main);
}
.select-info {
    background: var(--bg);
    padding: 18px;
    border-radius: var(--radius-md);
    text-align: left;
    margin-bottom: 24px;
}
.select-info p {
    line-height: 1.8;
    margin: 6px 0;
    font-size: 15px;
    color: var(--text-gray);
}
.price-text {
    font-size: 22px;
    color: var(--danger);
    font-weight: bold;
    margin: 16px 0;
}
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
/* 纹样翻页按钮 */
.pattern-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
/* 提交定制弹窗 */
.submit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.submit-modal.show {
    display: flex;
}
.submit-box {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 620px;
    padding: 36px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.submit-box-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f0f3f2;
    cursor: pointer;
    font-size: 18px;
}
.form-item {
    margin-bottom: 20px;
}
.form-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}
.form-item input, .form-item select, .form-item textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d9d7;
    border-radius: var(--radius-sm);
    font-size: 15px;
}
.master-desc {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

/* ========== 响应式适配（含预览区自适应逻辑?========== */
@media (max-width: 1200px) {
    .preview-area {
        right: 20px;
        width: 45%;
    }
}
@media (max-width: 992px) {
    .grid-2, .grid-4, .grid-product {
        grid-template-columns: repeat(2,1fr);
    }
    .footer .container {
        grid-template-columns: 1fr;
    }
    .top-slogan, .top-time {
        display: none;
    }
    .top-nav {
        margin-left: 20px;
        gap: 16px;
    }
    /* 平板以下预览取消固定，流式上下排?*/
    .preview-area {
        position: static;
        width: 100%;
        right: unset;
        top: unset;
        margin-top: 40px;
    }
    .custom-main {
        width: 100%;
    }
    .option-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .page-banner {
        height: 220px;
    }
    .banner-page-title {
        font-size: 28px;
    }
}
@media (max-width: 576px) {
    body {
        padding-top: 62px;
    }
    .top-nav {
        display: none;
    }
    .grid-2, .grid-4, .grid-product {
        grid-template-columns: 1fr;
    }
    .section {
        padding: 24px 20px;
    }
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    .option-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}