/* ==========================================================
   产品选购页 (product-page.css) - 完美修复版
   ========================================================== */

/* ==================== 0. 基础全屏布局 ==================== */
.product-page-wrap {
    width: 100% !important;
    margin: 0 auto;
    padding: 20px 24px;
    background: #f5f7fa;
    min-height: calc(100vh - 60px);
    box-sizing: border-box;
}

/* ==================== 1. 顶部面包屑 ==================== */
.product-breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
    flex-wrap: wrap;
}
.product-breadcrumb .back-link {
    color: #999;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color .2s;
}
.product-breadcrumb .back-link:hover { color: #0060ff; }
.product-breadcrumb .breadcrumb-title { color: #333; font-weight: 600; }
.product-breadcrumb .breadcrumb-desc { color: #999; font-size: 13px; }

.breadcrumb-tag {
    display: inline-block;
    font-size: 11px;
    line-height: 18px;
    padding: 0 8px;
    background: linear-gradient(90deg, #ff7a45, #f5474e);
    color: #fff;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 4px;
}

/* ==================== 2. 主体两栏布局 ==================== */
.product-page-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ==================== 3. 左侧分类树 (PC) ==================== */
.product-sidebar {
    width: 240px;
    flex: none;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    position: sticky;
    top: 20px;
    z-index: 10; 
    max-height: calc(100vh - 40px);
    overflow-y: auto; /* 恢复 auto，防止内部内容溢出 */
}

.sidebar-search { position: relative; margin-bottom: 16px; }
.sidebar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #999; font-size: 13px; }
.sidebar-search input {
    width: 100%; height: 36px; padding: 0 12px 0 34px;
    border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; outline: none;
}
.sidebar-search input:focus { border-color: #0060ff; }

/* 树状菜单 */
.tree-first { margin-bottom: 4px; }
.tree-first-title {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; font-size: 14px; font-weight: 600; color: #333;
    cursor: pointer; border-radius: 6px; user-select: none;
}
.tree-first-title:hover { background: #f5f7fa; }
.tree-first-title i { font-size: 12px; color: #999; transition: transform .3s; }
.tree-first.open .tree-first-title { color: #0060ff; }
.tree-first.open .tree-first-title i { transform: rotate(180deg); color: #0060ff; }

.tree-second-list { display: none; list-style: none; padding: 0; margin: 4px 0; }
.tree-first.open .tree-second-list { display: block; }

.tree-second-item a {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 12px 9px 16px; font-size: 13px; color: #666;
    text-decoration: none; border-radius: 6px; transition: all .2s; position: relative;
}
.tree-second-item a:hover { background: #f5f7fa; color: #0060ff; }
.tree-second-item.active a { background: #e8f1ff; color: #0060ff; font-weight: 600; }
.tree-second-item.active a::before {
    content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: #0060ff; border-radius: 2px;
}

/* PC端国旗尺寸 */
.tree-flag { width: 14px; height: 10px; object-fit: cover; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.tree-flag-placeholder { width: 14px; height: 10px; flex: none; display: inline-block; }
.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-tag { font-size: 10px; padding: 1px 6px; background: #ff4d4f; color: #fff; border-radius: 3px; flex: none; }

/* ==================== 4. 右侧产品内容 ==================== */
.product-content { flex: 1; min-width: 0; }

.login-tip {
    background: #e8f1ff; border: 1px solid #bcd2ff; color: #0060ff;
    padding: 12px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.login-tip a { color: #0060ff; font-weight: 600; }

.group-headline {
    display: flex; align-items: center; gap: 8px; padding: 12px 18px;
    background: #f6ffed; border: 1px solid #b7eb8f; border-radius: 6px; color: #52c41a;
    font-size: 13px; line-height: 1.6; margin-bottom: 16px;
}
.group-headline i { color: #52c41a; font-size: 16px; flex: none; }
.group-headline span { color: #389e0d; }

/* ==================== 5. 产品网格 ==================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 默认3列 */
    gap: 16px;
}
@media (min-width: 1600px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1200px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .product-grid { grid-template-columns: 1fr; } }

/* ==================== 6. 产品卡片 ==================== */
.product-card {
    background: #fff; border-radius: 8px; padding: 24px;
    position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: all .25s; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(6,96,255,.12); }

/* 库存标签 */
.product-stock {
    position: absolute; top: 16px; right: 16px; font-size: 12px; line-height: 22px;
    padding: 0 8px; background: linear-gradient(90deg,#f9faff 0,#ebf0fc 100%);
    border-radius: 4px; font-weight: 700; color: #3860f4;
}

.product-title {
    font-size: 16px; font-weight: 700; color: #222; line-height: 1.5;
    margin-bottom: 18px; padding-right: 60px;
}

/* 规格列表 */
.product-specs { list-style: none; padding: 0; margin: 0 0 15px; }
.product-specs li,
.product-specs tr {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; line-height: 28px; color: #333;
}
.product-specs .spec-label { color: #999; flex: none; }
.product-specs .spec-value { color: #333; text-align: right; }
.product-specs td { padding: 3px 0; border: none !important; }
.product-specs table { width: 100%; border-collapse: collapse; }

.product-notice { font-size: 12px; color: #999; margin-bottom: 15px; line-height: 1.6; }

/* ==================== 7. ⭐ 高亮价格样式 ⭐ ==================== */
.product-price-box {
    margin-top: auto; padding-top: 15px;
    border-top: 1px dashed #f0f2f6; margin-bottom: 15px;
}
.sk-card-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; }
.sk-p-symbol { color: #ff0000; font-size: 18px; font-weight: bold; }
.sk-p-num { color: #ff0000; font-size: 30px; font-weight: 800; line-height: 1; margin-right: 4px; }
.sk-p-unit { color: #999; font-size: 13px; margin-right: 12px; font-weight: normal; }
.sk-p-day { color: #999; font-size: 13px; font-weight: normal; }
.sk-p-day em { color: #ff0000; font-style: normal; font-weight: bold; font-size: 16px; }

/* ==================== 8. 购买按钮 ==================== */
.product-btn {
    display: block; width: 100%; height: 44px; line-height: 44px;
    text-align: center; background: #2b5cff !important; color: #fff !important;
    border-radius: 6px; font-size: 15px; font-weight: 600;
    text-decoration: none; transition: all .2s; border: none;
}
.product-btn:hover { background: #1e46d9 !important; box-shadow: 0 6px 16px rgba(43, 92, 255, 0.3); color: #fff !important; }
.product-btn.disabled { background: #c9ced8 !important; cursor: not-allowed; pointer-events: none; }

/* ==================== 9. 底部警告与空状态 ==================== */
.product-empty { grid-column: 1 / -1; text-align: center; padding: 80px 20px; background: #fff; border-radius: 8px; }
.product-empty img { max-width: 160px; margin-bottom: 16px; opacity: .6; }
.product-empty p { color: #999; font-size: 14px; }

.product-warning {
    background: #fff1f0; border: 1px solid #ffccc7; border-radius: 6px;
    padding: 18px 22px; margin-top: 24px; font-size: 13px; line-height: 2; color: #555;
}
.product-warning .warning-title { color: #cf1322; font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.product-warning .warning-title i { font-size: 16px; color: #cf1322; }
.product-warning p { margin: 8px 0; color: #555; }
.product-warning a { color: #cf1322; text-decoration: none; border-bottom: 1px dashed #cf1322; }
.product-warning a:hover { color: #a8071a; }

/* ==================== 10. 手机端抽屉与卡片适配 ==================== */
@media (max-width: 768px) {
    .product-page-wrap { padding: 12px; }
    .product-page-body { flex-direction: column; }
    
    /* 隐藏左侧树 */
    .product-sidebar { display: none !important; } 
    
    .product-warning { padding: 14px 16px; font-size: 12px; line-height: 1.8; }
    .sk-p-num { font-size: 26px; }
    .sk-p-day { display: block; margin-top: 4px; margin-left: 0; }
    
    /* ======= 修复手机端弹出抽屉的巨大国旗 ======= */
    .mobile-picker img,
    .mobile-picker .mobile-group-flag {
        width: 16px !important;
        height: 12px !important;
        max-width: 16px !important;
        max-height: 12px !important;
        object-fit: cover !important;
        display: inline-block !important;
        flex-shrink: 0 !important;
        border-radius: 2px !important;
        margin-right: 6px !important;
        box-shadow: 0 0 0 1px rgba(0,0,0,.06) !important;
    }

    /* 修复手机端分类名称换行对齐 */
    .mobile-picker .mobile-group-name {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        height: 100% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .mobile-picker .mobile-group-text {
        font-size: 13px !important;
        line-height: 1.4 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}