/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    background: white;
}

/* 移动端顶部标题 */
.mobile-header {
    display: none;
    padding: 12px 15px;
    background: #2c3e50;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 主内容区 */
.main-content {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* 左侧分类 */
.sidebar-container {
    width: 100px;
    background: #2d3748;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar {
    padding: 15px 0;
}

.sidebar-header {
    padding: 0 15px 10px;
    font-size: 14px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #4a5568;
    margin-bottom: 10px;
}

.category-list {
    list-style: none;
}

.category-item {
    padding: 12px 15px;
    color: #cbd5e0;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 1px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-item:hover, 
.category-item.active {
    background: #4a5568;
    border-left-color: #4299e1;
    color: white;
}

/* 右侧产品区 */
.products-container {
    flex: 1;
    padding: 15px;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.current-category {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-count {
    font-size: 14px;
    color: #6c757d;
}

/* 产品网格 */
.product-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 15px;
}

/* 手机端：一行一个产品 */
@media (max-width: 767px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .product-card {
        margin-bottom: 1px;
    }
}

/* 电脑端：自适应列数 */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.product-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-img-container {
    width: 100%;
    height: 160px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
}

.product-img.loading {
    opacity: 0;
}

.product-img.loaded {
    opacity: 1;
}

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
}

.product-price {
    color: #e74c3c;
    font-weight: bold;
    font-size: 14px;
}

/* 加载提示 */
.scroll-load-hint {
    text-align: center;
    padding: 15px;
    color: #6c757d;
    display: none;
}

.scroll-load-hint.show {
    display: block;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    display: none;
}

.loading-spinner.show {
    display: block;
}

/* 移动端底部导航 */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: #7f8c8d;
    font-size: 10px;
    padding: 5px;
    cursor: pointer;
}

.mobile-nav-btn i {
    font-size: 18px;
    margin-bottom: 3px;
}

.mobile-nav-btn.active {
    color: #3498db;
}

/* ===== 电脑端专属优化 ===== */

/* 开屏页覆盖层样式 */
.splash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity .2s ease;
}
.splash-overlay.hide { opacity: 0; }
.splash-content {
  position: relative;
  max-width: 960px;
  width: 92vw;
  max-height: 80vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}
.splash-image, .splash-video {
  display: block;
  width: 100%;
  height: auto;
}
.splash-video { max-height: 80vh; }
.splash-link { position: absolute; inset: 0; }

/* 进入图册按钮：宽度80%，高度60px，底部距100px */
.splash-enter-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100px;
  width: 80vw;
  max-width: 600px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  background: #4285F4;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(66,133,244,0.4);
  cursor: pointer;
  transition: opacity .15s ease;
}
.splash-enter-btn:active { opacity: 0.7; }

@media (max-width: 767px) {
  .splash-content { width: 96vw; max-height: 70vh; }
  .splash-video { max-height: 70vh; }
  .splash-enter-btn { bottom: 80px; }
}
@media (min-width: 768px) {
    /* 容器宽度自适应 */
    .app-container {
        width: 95%;
        max-width: 2600px;
        margin: 20px auto;
    }

    /* 产品网格布局优化 */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }

    /* 卡片内容自适应 */
    .product-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .product-img-container {
        height: 180px;
        flex-shrink: 0;
    }

    .product-info {
        flex-grow: 1;
        padding: 15px;
    }

    /* 侧边栏优化 */
    .sidebar-container {
        width: 220px;
    }

    .category-item {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ===== 超大屏优化（>1440px） ===== */
@media (min-width: 1440px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .product-img-container {
        height: 200px;
    }
}

/* 商品详情页样式 */
.product-detail-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    overflow-y: auto;
    display: none;
    padding: 20px;
}

.detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.back-button {
    background: #3498db;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.back-button:hover {
    background: #2980b9;
}

.detail-title {
    font-size: 20px;
    color: #2c3e50;
}

.detail-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.detail-image {
    width: 100%;
    min-height: 220px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}

.detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-info {
    padding: 0 4px;
}

.detail-name {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.detail-price {
    font-size: 24px;
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 15px;
}

.detail-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

/* 价格与描述之间的分割线（响应式，宽度与内容区域一致） */
.detail-description::before {
    content: "";
    display: block;
    border-top: 1px solid #e0e0e0; /* 与整体风格协调的灰色 */
    margin: 8px 0; /* 上下各 8px 间距，视觉舒适 */
    width: 100%;
}

/* 富文本内容统一样式 */
.detail-description.rich-content {
    --text-color: #333;
    --muted-color: #6c757d;
    --border-color: #e9ecef;
    --accent-color: #e74c3c;
    color: var(--text-color);
}
.detail-description.rich-content p { margin: 8px 0 12px; }
.detail-description.rich-content h1,
.detail-description.rich-content h2,
.detail-description.rich-content h3 {
    margin: 8px 0;
    color: #2c3e50;
}
.detail-description.rich-content ul,
.detail-description.rich-content ol { margin: 8px 0 12px 20px; }
.detail-description.rich-content li { margin: 4px 0; }
.detail-description.rich-content a { color: #3498db; text-decoration: none; }
.detail-description.rich-content a:hover { text-decoration: underline; }
.detail-description.rich-content img { display: block; max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; }
.detail-description.rich-content blockquote { border-left: 3px solid var(--border-color); padding-left: 12px; color: var(--muted-color); margin: 8px 0; }
.detail-description.rich-content code { background: #f4f4f4; padding: 2px 6px; border-radius: 4px; }
.detail-description.rich-content pre { background: #f8f9fa; padding: 10px; border-radius: 6px; overflow: auto; }
.detail-description.rich-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.detail-description.rich-content th,
.detail-description.rich-content td { border: 1px solid var(--border-color); padding: 6px 8px; }

/* 桌面端详情布局：单栏 */
@media (min-width: 768px) {
    .detail-content {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .detail-image { height: 260px; }
    .detail-title { font-size: 22px; }
    .detail-name { font-size: 22px; }
    .detail-price { font-size: 26px; }
}

/* 移动端适配 */
@media (max-width: 767px) {
    .product-detail-container {
        padding: 15px;
    }
    
    .detail-image {
        height: 200px;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .back-button {
        align-self: flex-start;
    }
}
