/* ========== Luna Modern UI v4 ========== */
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --accent: #06b6d4;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-primary: 0 4px 14px rgba(37,99,235,0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background */
.background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    min-width: 1000px; z-index: -10;
    background: linear-gradient(180deg, #e8eef6 0%, var(--bg) 100%);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Utility */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }
.noML { margin-left: initial !important; }
.hide { display: none; }
.notSelection { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }

/* LayUI overrides */
.layui-row { margin: 0 10px; }
.layui-tab-title .layui-this:after { border-radius: 4px 4px 0 0; background: var(--primary); height: 3px; bottom: 0; }
.layui-tab-title .layui-this { color: var(--primary); font-weight: 600; }
.layui-tab-title li { color: var(--text-secondary); transition: var(--transition); }
.layui-tab-title li:hover { color: var(--text); }
.layui-form-select dl dd.layui-this { background-color: var(--primary); }
.geetest_holder.geetest_wind { display: inline-block; vertical-align: middle; }

/* ========== Header ========== */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: relative; z-index: 10;
}

.header .header-box {
    padding: 14px 0;
    display: flex; align-items: center; justify-content: space-between;
}

.header .header-box a { display: inline-flex; align-items: center; text-decoration: none; }
.header .header-box img { max-width: 140px; max-height: 42px; }
.header .header-box .info {
    font-size: 16px; font-weight: 700; color: var(--text);
    display: inline-block; margin-left: 10px; vertical-align: middle;
}

.header .header-box .query { display: inline-block; float: right; }
.header .header-box .query a {
    color: #fff; display: inline-flex; align-items: center; gap: 6px;
    padding: 0 20px; line-height: 38px; border-radius: var(--radius-full);
    background: var(--primary); box-shadow: var(--shadow-primary);
    transition: var(--transition); font-weight: 500; font-size: 14px;
}
.header .header-box .query a:hover {
    background: var(--primary-dark); transform: translateY(-1px);
}
.header .header-box .query a svg { margin: 0; vertical-align: middle; }

/* Notice in header (PC) */
.header .header-box .notice {
    margin-top: 16px; padding: 12px 16px; background: var(--bg);
    border-radius: var(--radius); width: 100%;
}
.header .header-box .notice .tit { color: var(--text); font-size: 14px; font-weight: 600; }
.header .header-box .notice .tips { margin-top: 4px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }

/* ========== Announcement Bar ========== */
.announcement-bar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0;
    overflow: hidden;
}
.announce-inner {
    display: flex;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 8px 16px;
    gap: 8px;
}
.announce-icon {
    flex-shrink: 0;
    color: var(--primary);
    opacity: 0.7;
}
.announce-track {
    flex: 1;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.announce-scroll {
    display: inline-block;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.2px;
    animation: announceScroll 24s linear infinite;
}
@keyframes announceScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.announce-scroll:hover {
    animation-play-state: paused;
}

/* ========== Main Content ========== */
.main .main-box {
    margin-top: 20px; background: var(--card);
    box-shadow: var(--shadow); border-radius: var(--radius-lg);
    padding: 20px 0; border: 1px solid var(--border);
}
.main-box:after { content: ""; display: block; height: 0; clear: both; visibility: hidden; }

.main .title, .main .cate, .main .goods { margin: 0 20px; }
.main .title {
    font-size: 17px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.main .title svg, .main .title img { vertical-align: middle; }

/* ========== Notice Card (公告) ========== */
.main-box .title .tit { font-size: 16px; font-weight: 600; color: var(--text); }
.main-box .goods .tips {
    font-size: 13px; line-height: 1.8; color: var(--text-secondary); padding: 8px 0;
}
.main-box .goods .tips p { margin-bottom: 4px; }

/* ========== Categories ========== */
.main .cate { padding-top: 16px; margin: 0 12px; font-size: 0; }
.main .cate .cate-box {
    overflow: hidden; display: inline-block; vertical-align: middle;
    min-width: 130px; background: var(--bg); border-radius: var(--radius);
    height: 67px; padding: 0 20px; margin: 0 8px; margin-bottom: 10px;
    cursor: pointer; user-select: none; position: relative;
    border: 2px solid transparent; transition: var(--transition);
}
.main .cate .cate-box:hover { border-color: var(--primary); background: #eff6ff; }
.main .cate .cate-box-select {
    background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-primary);
}
.main .cate .cate-box-select:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.main .cate .cate-box-select img { position: absolute; right: -6px; bottom: -19px; }
.main .cate .cate-box p { font-weight: 500; font-size: 13px; color: var(--text); margin-top: 12px; }
.main .cate .cate-box-select p { color: #fff; }
.main .cate .cate-box div { opacity: .76; color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.main .cate .cate-box-select div { color: rgba(255,255,255,0.85); }

/* ========== Goods List (双列网格) ========== */
.main .goods {
    margin-top: 12px; border-top: 1px solid var(--border-light); padding-top: 12px;
}
.main .goods .goods-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.main .title-2 {
    margin-bottom: 8px; color: var(--text); font-weight: 600;
}
.main .title-2 svg, .main .title-2 span { vertical-align: middle; }

.main .goods .goods-box {
    background: var(--card); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); border-radius: var(--radius);
    cursor: pointer; user-select: none; position: relative;
    display: flex; flex-direction: column;
    transition: var(--transition); text-decoration: none;
    overflow: hidden;
    margin: 0;
    min-width: 0; min-height: 0;
    padding: 0;
}
.main .goods .goods-box:hover {
    border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-3px);
}

.main .goods .picture {
    display: block; width: 100%; height: 0;
    padding-bottom: 65%; position: relative;
    background: var(--bg); overflow: hidden;
    margin: 0;
}
.main .goods .picture img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain; border-radius: 0;
    transition: transform 0.3s ease;
}
.main .goods .goods-box:hover .picture img { transform: scale(1.05); }

.main .goods .msg {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px; flex: 1;
}
.main .goods .msg .goods-name {
    color: var(--text); font-size: 13px; font-weight: 600;
    margin: 0; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
}
.main .goods .msg .goods-price {
    color: var(--danger); font-size: 18px; font-weight: 700;
    margin-top: auto;
}
.main .goods .msg .goods-price span { font-size: 12px; vertical-align: baseline; }
.main .goods .msg .goods-price div {
    display: inline-block; background: #fef2f2; color: var(--danger);
    padding: 1px 6px; border-radius: 4px; font-size: 10px; margin-right: 2px; font-weight: 500;
    vertical-align: middle;
}
.main .goods .msg .goods-num { margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.main .goods .msg .goods-num div {
    display: inline-block; width: 40px; height: 4px;
    background: var(--border); position: relative; border-radius: 2px; flex-shrink: 0;
}
.main .goods .msg .goods-num div p {
    display: inline-block; position: absolute; width: 40%; height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399); border-radius: 2px;
}
.main .goods .msg .goods-num span {
    color: var(--success); font-size: 11px; font-weight: 500;
    margin: 0; white-space: nowrap;
}

/* ========== Floating Action Dock (Mobile) ========== */
.fab-dock {
    position: fixed;
    bottom: 24px;
    right: 16px;
    z-index: 9998;
    display: none;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.fab-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    color: #fff; font-size: 13px; font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.fab-btn:active { transform: scale(0.95); }

.fab-order {
    background: var(--primary);
    box-shadow: var(--shadow-primary);
}

/* 隐藏原来独立的查单浮动按钮 */
.query-m { display: none !important; }

/* 扫码下单按钮(PC) */
.order-m {
    cursor: pointer; position: fixed; width: 64px; height: 64px;
    background: var(--primary); border-radius: 50%;
    right: 100px; bottom: 20%;
    box-shadow: var(--shadow-primary); z-index: 100; transition: var(--transition);
}
.order-m:hover { transform: translateY(-2px); }
.order-m a { width: 64px; height: 64px; display: inline-block; }
.order-m svg { margin-left: 14.5px; margin-top: 6px; }
.order-m span { color: #fff; display: block; text-align: center; margin-top: -4px; font-weight: 600; font-size: 12px; }

/* ========== Buy Page ========== */
.buy { text-align: center; margin-top: 12px; }
.buy button {
    border: none; color: #fff; display: inline-block; width: 180px;
    font-size: 16px; font-weight: 600; line-height: 48px;
    border-radius: var(--radius-full); cursor: pointer;
    background: var(--primary); box-shadow: var(--shadow-primary); transition: var(--transition);
}
.buy button:hover { background: var(--primary-dark); transform: translateY(-1px); }

.main-box .goods-img {
    margin-left: 20px; margin-right: 10px; margin-top: 12px;
    width: calc(100% - 30px); height: 0; position: relative;
    padding-bottom: calc(100% - 40px);
}
.main-box .goods-img img {
    width: calc(100% - 10px); box-shadow: var(--shadow); border-radius: var(--radius);
    margin-top: 5px; height: 100%; position: absolute; object-fit: contain; background: var(--bg);
}
.main-box .goods-msg { margin-right: 20px; margin-left: 10px; margin-top: 20px; }
.main-box .goods-msg .goods-name {
    font-weight: 700; font-size: 18px; color: var(--text);
    border-bottom: 1px solid var(--border-light); padding-bottom: 8px;
}

/* Tips badges */
.small-tips { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; margin-left: 4px; line-height: 1.4; font-weight: 500; }
.tips-cyan { background: #f0f9ff; color: #0369a1; }
.tips-pink { background: #fef2f2; color: #dc2626; }
.tips-green { background: #f0fdf4; color: #16a34a; }
.tips-yellow { background: #fefce8; color: #ca8a04; }
.tips-blue { background: #eff6ff; color: #2563eb; }
.tips-red { background: #fef2f2; color: #dc2626; }
.tips-black { background: var(--text); color: #ffffff; }

/* Price */
.price { margin-top: 8px; }
.price .price-sign { color: var(--danger); font-size: 16px; }
.price .price-num { color: var(--danger); font-size: 24px; font-weight: 700; }
.price .price-c { margin-left: 6px; color: var(--text-muted); font-size: 13px; }
.sale { margin-top: 8px; margin-left: -4px; }
.sale .small-tips { margin-bottom: 4px; }

/* Form */
.entry { margin-top: 16px; }
.l-msg { color: var(--text-secondary); width: 85px; display: inline-block; vertical-align: middle; font-size: 14px; }
.pay-num { width: 50px !important; text-align: center; font-size: 18px !important; font-weight: 600; }
.sub svg, .add svg { vertical-align: middle; margin-top: -7px; cursor: pointer; opacity: 0.6; transition: var(--transition); }
.sub svg:hover, .add svg:hover { opacity: 1; }

.input input {
    display: inline-block; padding: 0 12px; height: 40px; width: 300px;
    font-weight: 400; font-size: 14px; color: var(--text);
    background: var(--card); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); border-radius: 8px; transition: var(--transition);
}
.input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.input input::placeholder { color: var(--text-muted); }

.code img { height: 40px; border-radius: 8px; border: 1px solid var(--border); vertical-align: middle; margin-top: -3px; cursor: pointer; }
.code input { width: 178px !important; }
#wait-geetest-captcha { color: var(--text-muted); }

/* Payment */
.pay { margin-top: 20px; border-top: 1px solid var(--border-light); padding-top: 12px; }
.pay-type {
    display: inline-block; text-align: center; background: var(--bg);
    border: 2px solid var(--border); border-radius: 8px; position: relative;
    padding: 8px 14px; margin-right: 10px; margin-bottom: 10px;
    cursor: pointer; transition: var(--transition);
}
.pay-type:hover { border-color: #93c5fd; background: #f0f7ff; }
.pay-type svg { vertical-align: middle; }
.pay-select { border-color: var(--primary); background: #eff6ff; color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* Description */
.intro { padding: 16px 20px; color: var(--text); font-size: 14px; line-height: 2; letter-spacing: .3px; }

/* Error */
.err_title { color: var(--text); font-size: 20px; font-weight: 700; margin-top: 20px; }
.err_content { margin-top: 24px; margin-bottom: 24px; color: var(--text-secondary); }
.err_but { padding-bottom: 80px; }

/* Buttons */
.btn a, .btn button {
    border: none; text-align: center; font-size: 16px; font-weight: 600; color: #fff;
    display: inline-block; width: 160px; line-height: 48px; margin-top: 15px;
    border-radius: var(--radius-full); cursor: pointer;
    background: var(--primary); box-shadow: var(--shadow-primary);
    transition: var(--transition); text-decoration: none;
}
.btn a:hover, .btn button:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* Order page */
.pay-title { color: var(--text); font-weight: 700; font-size: 20px; margin: 0 20px; }
.order-list { margin-top: 12px; border-bottom: 1px solid var(--border-light); padding-bottom: 8px; }
.info-ui { color: var(--text-secondary); }
.info-ui strong { width: 30%; margin-bottom: 4px; text-align: right; display: inline-block; color: var(--text); font-weight: 600; }
.order-info {
    width: calc(100% - 12px); height: 80px; overflow-wrap: break-word; padding: 10px; overflow: auto;
    resize: none !important; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    border-radius: 8px; font-size: 13px; color: var(--text); background: var(--bg);
}

/* QR */
.qr { text-align: center; position: relative; }
.qr svg { display: block; margin: 0 auto; }
.qr img { height: 300px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* Footer */
.footer { margin-top: 48px; margin-bottom: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.footer a { color: var(--text-secondary); text-decoration: none; transition: var(--transition); }
.footer a:hover { color: var(--primary); }
.footer p { margin-top: 6px; }

/* Layer / Modal */
.home-tips { border-radius: var(--radius-lg) !important; overflow: hidden; }
.home-tips .layui-layer-title {
    background: var(--primary); color: #fff !important; height: 44px; line-height: 44px;
    border-radius: 0; background-color: initial; border-bottom: initial;
    font-size: 15px; font-weight: 600; text-align: center; padding: initial;
}
.home-tips .layui-layer-setwin { color: #fff; position: absolute; top: initial; bottom: -50px; left: 50%; transform: translate(-50%, 0); width: 30px; height: 30px; }
.home-tips .layui-layer-setwin a { position: initial; }
.home-tips .layui-layer-content { padding: 16px 20px; color: var(--text); font-size: 14px; line-height: 2; word-wrap: break-word; }

/* Select fix */
.layui-form-select { width: 300px; display: inline-block; }
.layui-form-pane .layui-input { border-radius: 8px; height: 40px; width: 312px; border-color: var(--border); }
.layui-form-pane .layui-input:focus { border-color: var(--primary) !important; }
.layui-form-select .layui-edge { right: 0; }

/* ========== Mobile ========== */
@media (max-width: 768px) {
    body { background: var(--bg); }
    .background { min-width: 100%; }

    /* Header */
    .header {
        background: var(--primary);
        border-bottom: none;
        box-shadow: 0 2px 8px rgba(37,99,235,0.15);
    }

    .header .header-box { padding: 12px 0; }
    .header .header-box .info { color: #fff !important; }
    .header .header-box .query { display: none; }

    .announcement-bar { border-bottom-color: var(--border-light); }
    .announce-inner { padding: 6px 12px; }
    .announce-scroll { font-size: 12px; }

    /* 移动端公告卡片 */
    .layui-show-xs .main-box,
    .layui-show-xs-inline-block .main-box {
        margin-top: 12px;
    }

    .layui-show-xs .main-box .goods .tips {
        overflow-y: visible;
        font-size: 12px;
        line-height: 1.6;
    }

    /* 内容卡片 */
    .main .main-box { margin-top: 12px; border-radius: var(--radius); }
    .main .title, .main .cate, .main .goods { margin: 0 12px; }

    /* 双列网格移动端优化 */
    .main .goods .goods-list { gap: 8px; grid-template-columns: repeat(2, 1fr); }
    .main .goods .msg { padding: 8px 10px; }
    .main .goods .msg .goods-name { font-size: 12px; }
    .main .goods .msg .goods-price { font-size: 16px; }
    .main .goods .msg .goods-price div { font-size: 9px; padding: 1px 4px; }

    /* 浮动按钮dock显示 */
    .fab-dock { display: flex !important; }

    /* 扫码下单隐藏 */
    .order-m { display: none; }

    /* AI客服按钮上移，给查单按钮让位 */
    #ai-chat-bubble { bottom: 86px !important; right: 16px !important; }

    /* 买单页图片区域优化 */
    .main-box .goods-img {
        padding-bottom: 60%;
        margin-left: 16px; margin-right: 16px;
        width: calc(100% - 32px);
    }

    .main-box .goods-msg {
        margin-left: 16px; margin-right: 16px;
    }

    /* 表单标签宽度 */
    .l-msg { width: 80px; font-size: 13px; }

    /* 表单适配 */
    .input input { width: calc(100% - 95px); }
    .code input { width: calc(100% - 219px) !important; }
    .main .goods .goods-price div { margin-bottom: 5px; }
    .geetest_holder.geetest_wind { margin-top: 10px; }
    .order-info { margin-top: 10px; }

    .layui-form-select { width: calc(100% - 83px); }
    .layui-form-pane .layui-input { width: 100%; }
    .layui-form-select .layui-edge { right: 10px; }

    /* 底部留出空间给浮动按钮 */
    .footer { margin-bottom: 80px; }
}

@media (max-width: 425px) {
    .main .cate .cate-box { min-width: calc(50% - 60px); }
}

/* Table */
.layui-table td, .layui-table th { padding: 9px 5px; }
