/* 关键：确保 sticky 定位能正常工作 */
body, .wrapper, .content-page {
    overflow: visible;
}

/* ===== 公告栏 ===== */
.notice-bar {
    width: 100%;
    background: #fff;
    border-radius: 4px;
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}
.notice-label {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #3688fc !important;
    margin-right: 8px;
}

/* ===== 列表表头（5列）===== */
.list-header {
    width: 100%;
    height: 40px;
    background: #fafbfc;
    border: 1px solid #e8e8e8;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    font-size: 16px;
    color: #555;
    font-weight: 700;
}
.lh-col { display: inline-block; }
.lh-col-name { flex: 1; min-width: 0; padding-left: 10px; text-align: left; }
.lh-col-type { width: 56px; text-align: center; flex-shrink: 0; }
.lh-col-stock { width: 56px; text-align: center; flex-shrink: 0; margin-left: 12px; margin-right: 8px; }
.lh-col-price { width: 80px; text-align: right; flex-shrink: 0; padding-right: 16px; margin-right: 4px; }
.lh-col-action { width: 56px; text-align: center; flex-shrink: 0; }

/* ===== 分类标题 ===== */
.category { width: 100%; margin-bottom: 0; }
.category-header {
    width: 100%;
    height: 35px;
    background: #f0f2f5;
    border-left: 3px solid #3688fc;
    border-right: 1px solid #e8e8e8;
    border-top: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
}
.category-header .badge { font-size: 18px; font-weight: 700; }

/* ===== 商品列表容器 ===== */
.product-list { width: 100%; }

/* ===== 商品行 ===== */
.product-list-row {
    width: 100%;
    height: 80px;
    background: #fff;
    border-left: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    transition: background .15s;
}
.product-list-row:hover { background: #f0f7ff; }
.product-list-row:last-child { border-radius: 0 0 4px 4px; }

/* ===== 行内内容 ===== */
.product-list-row-inner {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    position: relative;
    padding: 0 10px 0 0;
    box-sizing: border-box;
}
.product-list-row-soldout { opacity: 0.55; cursor: default; }

/* ===== 商品名 + 图片 ===== */
.plist-name-wrap {
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding-left: 10px;
}
.plist-img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 8px;
    background: #eee;
}

/* ===== 图片懒加载：加载前显示浅灰背景 + 微脉冲动画 ===== */
.lazy-img {
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(135deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
    background-size: 200% 200%;
    animation: lazy-shimmer 1.5s ease-in-out infinite;
}
@keyframes lazy-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== 图片懒加载：加载完成后淡入 ===== */
.lazy-loaded {
    opacity: 1;
    animation: lazy-fadein 0.35s ease forwards;
}
@keyframes lazy-fadein {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
.plist-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ===== 类型列：人工=红字+红框 / 自动=蓝字+蓝框 ===== */
.plist-type {
    width: 56px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    padding: 2px 6px;
    white-space: nowrap;
    border-radius: 2px;
    border: 1px solid transparent;
}
.plist-type-manual {
    color: #ea5455;
    border-color: #ea5455;
}
.plist-type-auto {
    color: #3688fc;
    border-color: #3688fc;
}

/* ===== 库存列：充足=绿色+绿框 / 不足=红色+红框 ===== */
.plist-stock {
    width: 56px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    border-radius: 2px;
    padding: 2px 6px;
    margin-left: 12px;
    white-space: nowrap;
}
.plist-stock-ok {
    color: #28a745;
    border: 1px solid #28a745;
}
.plist-stock-low {
    color: #ea5455;
    border: 1px solid #ea5455;
}

/* ===== 价格列 ===== */
.plist-price {
    width: 80px;
    text-align: right;
    font-size: 16px;
    font-weight: 700;
    color: #ea5455;
    white-space: nowrap;
    padding-right: 16px;
}

/* 桌面端自动发货价格绿色，手动发货价格红色 */
.product-list-row:has(.plist-type-auto) .plist-price {
    color: #28a745;
}
.product-list-row:has(.plist-type-manual) .plist-price {
    color: #ea5455;
}

/* 桌面端点击人工发货商品时红色呼吸灯效果 */
.product-list-row:has(.plist-type-manual):active {
    animation: breathe-red 1.5s ease-in-out infinite;
}
@keyframes breathe-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 84, 85, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(234, 84, 85, 0); }
}

/* 桌面端回到顶部按钮位置调整 */
body .back-to-top,
html .back-to-top,
.wrapper .back-to-top {
    right: 200px !important;
    bottom: 80px !important;
}

/* ===== 操作列：购买=蓝框 / 缺货=灰框 ===== */
.plist-action {
    width: 56px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    border: 1px solid #3688fc;
    border-radius: 2px;
    padding: 2px 6px;
    color: #3688fc;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}
.plist-action:hover {
    background-color: #3688fc;
    color: #fff;
}
.product-list-row-soldout .plist-action {
    color: #999;
    border-color: #ccc;
    cursor: default;
}
.product-list-row-soldout .plist-action:hover {
    background-color: transparent;
    color: #999;
}

/* ===== 折扣标签 ===== */
.plist-discount {
    flex-shrink: 0;
    font-size: 10px;
    color: #e6a23c;
    border: 1px solid #e6a23c;
    border-radius: 2px;
    padding: 0 4px;
    margin-left: 4px;
}

/* ===== 左侧导航布局样式 (Sidebar Layout) v20260811-v4 - 按需求定制响应式 ===== */

/* 关键：确保父级不限制定位 */
body, .wrapper, .content-page, .container {
    overflow: visible;
    position: relative;
}

/* 主布局容器 */
.home-layout {
    display: flex;
    gap: 30px; /* 导航栏与商品列表间距30px */
    position: relative;
    min-height: calc(100vh - 180px);
    overflow: visible; /* 允许负margin溢出 */
}

/* 移动端遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 汉堡菜单按钮 */
.sidebar-toggle {
    position: fixed;
    top: 80px;
    left: 16px;
    z-index: 9999; /* 提高层级确保始终在最上层 */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3688fc; /* 蓝色背景 */
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 20px;
    color: #fff; /* 白色图标 */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* 确保按钮始终可见 */
    opacity: 1;
    visibility: visible;
    transform: none;
}
.sidebar-toggle:hover {
    background: #2a75e6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.sidebar-toggle i {
    color: #fff; /* 确保图标白色 */
}

/* 左侧导航栏 - sticky定位方案（v20260811-v1 - 纯CSS，跟随滚动+固定高度）*/
aside.sidebar-nav,
.home-layout aside.sidebar-nav,
body aside.sidebar-nav {
    position: sticky !important;        /* 粘性定位：跟随滚动 */
    top: 90px !important;                /* 距离顶部90px */
    left: auto !important;
    width: 240px !important;             /* 固定宽度240px */
    height: calc(100vh - 110px) !important; /* 关键！固定高度，防止无限延伸 */
    max-height: calc(100vh - 110px) !important; /* 双重保险：最大高度限制 */
    overflow-y: auto !important;      /* 内容超出时内部滚动 */
    overflow-x: hidden !important;     /* 防止水平溢出 */
    margin-left: -270px !important;      /* 负margin：240px宽度 + 30px间距 */
    flex-shrink: 0 !important;           /* 防止flex压缩 */
    background: #fff;
    border-radius: 8px;
    border: 2px solid #3688fc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px 0;
    z-index: 100;
    /* 全局隐藏滚动条（所有模式）*/
    scrollbar-width: none !important;           /* Firefox */
    -ms-overflow-style: none !important;       /* IE/Edge */
}
.sidebar-nav::-webkit-scrollbar {
    display: none !important;  /* Chrome/Safari/Opera: 完全隐藏 */
    width: 0 !important;
}

/* 移动端：完全隐藏导航栏滚动条 */
@media screen and (max-width: 991px) {
    .sidebar-nav::-webkit-scrollbar {
        display: none !important;  /* Chrome/Safari/Opera */
        width: 0 !important;
    }
}

/* 分类导航列表 */
.category-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px;
}

/* 分类项 */
.category-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin: 0 6px;
}
.category-item:hover {
    background: #f8f9fa;
    color: #3688fc;
    border-color: #d0e0fd;
}
.category-item.active {
    background: linear-gradient(135deg, #3369ff 0%, #3798f7 100%);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(51, 105, 255, 0.3);
}
.category-item i {
    font-size: 18px;
    opacity: 0.7;
}
.category-item:hover i,
.category-item.active i {
    opacity: 1;
}
.category-item .mdi-chevron-right {
    font-size: 16px;
    opacity: 0 !important;
    transition: all 0.2s ease;
    transform: translateX(-4px);
}
.category-item:hover .mdi-chevron-right,
.category-item.active .mdi-chevron-right {
    opacity: 0.6 !important;
    transform: translateX(0);
}
.category-item.active .mdi-chevron-right {
    opacity: 1 !important;
    color: #fff;
}

/* 关闭按钮（移动端） */
.sidebar-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f8f9fa;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.sidebar-close:hover {
    background: #e9ecef;
    color: #495057;
}

/* 右侧主内容区 - 保持100%宽度（1200px），与分割线同宽 */
.main-content {
    flex: 1;
    min-width: 0;
    width: 100% !important;            /* 占满剩余空间 */
    margin-left: 0 !important;          /* 不需要左边距 */
}

/* 内容工具栏 */
.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px; /* 增加顶部间距，避免被导航栏遮挡 */
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== 响应式适配 v20260811-v4 ===== */

/* 
 * 【规则1】<1500px：隐藏导航栏，显示汉堡菜单
 * 点击汉堡菜单后导航栏弹出（可覆盖顶部区域）
 */
@media screen and (max-width: 1499.98px) {
    /* 默认隐藏导航栏 */
    aside.sidebar-nav,
    .home-layout aside.sidebar-nav,
    body aside.sidebar-nav {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        bottom: auto !important;
        width: 280px !important;
        max-height: 80vh !important;
        height: auto !important;
        margin-left: 0 !important;
        margin-top: 0 !important;
        transform: translate(-50%, -50%) scale(0.95) !important; /* 居中+缩小 */
        border-radius: 12px !important;
        border: 2px solid #3688fc !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.25) !important;
        z-index: 1050 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        background: #fff !important;
        padding: 20px 0 !important;
        pointer-events: none !important; /* 禁止点击 */
    }
    
    /* 手机模式(<576px)：真正的居中弹窗 */
    @media screen and (max-width: 575.98px) {
        aside.sidebar-nav,
        .home-layout aside.sidebar-nav,
        body aside.sidebar-nav {
            width: 90vw !important;
            max-width: 320px !important;
            max-height: 70vh !important;
            top: 50% !important;
            left: 50% !important;
        }
    }
    
    /* 平板模式(576px-1499px)：从顶部滑下，可覆盖标题区域 */
    @media screen and (min-width: 576px) and (max-width: 1499.98px) {
        aside.sidebar-nav,
        .home-layout aside.sidebar-nav,
        body aside.sidebar-nav {
            top: 80px !important;      /* 距离顶部80px（在header下方）*/
            left: 20px !important;     /* 靠左对齐 */
            transform: translateY(-20px) !important; /* 向上隐藏 */
            border-radius: 8px !important;
            max-height: calc(100vh - 120px) !important;
        }
    }
    
    /* 导航栏打开状态 */
    aside.sidebar-open,
    .home-layout aside.sidebar-open,
    body aside.sidebar-open {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important; /* 恢复点击 */
        transform: translate(-50%, -50%) scale(1) !important; /* 手机：居中+正常大小 */
    }
    
    @media screen and (min-width: 576px) and (max-width: 1499.98px) {
        aside.sidebar-open,
        .home-layout aside.sidebar-open,
        body aside.sidebar-open {
            transform: translateY(0) !important; /* 平板：滑到正常位置 */
        }
    }
    
    /* 显示汉堡菜单按钮 */
    .sidebar-toggle {
        display: flex !important;
    }
    
    /* 主内容区占满宽度 */
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    /* 布局容器不需要间距 */
    .home-layout {
        gap: 0 !important;
    }
}

/* 手机端特殊调整 */
@media screen and (max-width: 576px) {
    aside.sidebar-nav,
    .home-layout aside.sidebar-nav,
    body aside.sidebar-nav {
        width: 90vw !important;
        max-width: 320px !important;
    }
    /* 手机端：标题和搜索框居中对齐 */
    .content-toolbar {
        flex-direction: column !important;      /* 垂直排列 */
        align-items: center !important;         /* 水平居中 */
        justify-content: center !important;     /* 垂直居中 */
        text-align: center !important;          /* 文字居中 */
        gap: 12px !important;                   /* 标题和搜索框间距 */
        padding: 0 16px !important;             /* 左右留边距 */
    }

    /* 页面标题居中 */
    .content-toolbar .page-title {
        text-align: center !important;
        width: 100% !important;
    }

    /* 搜索框容器居中并占满宽度 */
    .toolbar-right {
        width: 100% !important;
        justify-content: center !important;     /* 搜索框居中 */
    }

    /* 搜索框本身占满容器宽度 */
    .app-search {
        width: 100% !important;
        max-width: 400px !important;           /* 限制最大宽度 */
    }

    .app-search .position-relative {
        width: 100% !important;
    }

    .app-search .form-control {
        width: 100% !important;
    }
    
    .notice-bar { font-size: 12px; padding: 6px 10px; }
    .list-header { display: none; }
    .category-header { height: 35px; }
    .category-header .badge { font-size: 13px; }
    .product-list-row { height: 60px; }
    .product-list-row-inner { height: 60px; }
    .plist-img { width: 44px; height: 44px; margin-right: 8px; }
    .plist-name {
        font-size: 13px !important;
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        line-height: 1.5 !important;
        max-height: 3em !important;
        text-overflow: clip !important;
    }
    .plist-type { width: 44px; text-align: center; font-size: 13px; }
    .plist-stock { width: 44px; text-align: center; font-size: 13px; margin-left: 8px; }
    .plist-price { width: 64px; text-align: right; font-size: 14px; padding-right: 10px; }
    .plist-action { width: 46px; text-align: center; font-size: 13px; }
    .plist-discount { display: none; }
    
    /* 手机端汉堡按钮强制显示 */
    .sidebar-toggle {
        display: flex !important;
        position: fixed !important;
        top: 80px !important;
        left: 16px !important;
        z-index: 9999 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* 手机端顶栏只显示图标 */
    .nav-text { display: none; }
    
    /* 手机端隐藏自动/充足文字，保留价格和购买按钮 */
    .plist-type { display: none; }
    .plist-stock { display: none; }
    
    /* 人工发货商品行红色边框 */
    .product-list-row:has(.plist-type-manual) {
        border-left: 3px solid #ea5455;
    }
    
    /* 手机端自动发货价格绿色，手动发货价格红色 */
    .product-list-row:has(.plist-type-auto) .plist-price {
        color: #28a745 !important;
    }
    .product-list-row:has(.plist-type-manual) .plist-price {
        color: #ea5455 !important;
    }
    
    /* 手机端点击人工发货商品时红色呼吸灯效果 */
    .product-list-row:has(.plist-type-manual):active {
        animation: breathe-red 1.5s ease-in-out infinite;
    }
    @keyframes breathe-red {
        0%, 100% { box-shadow: 0 0 0 0 rgba(234, 84, 85, 0.4); }
        50% { box-shadow: 0 0 0 8px rgba(234, 84, 85, 0); }
    }
    
    /* 手机端回到顶部按钮位置调整 */
    .back-to-top {
        right: 50% !important;
        transform: translateX(50%) !important;
        bottom: 80px !important;
    }
}
