/* ========================================
   t18 模板 - 主样式表
   现代简洁风格，响应式设计
   ======================================== */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   顶部导航栏
   ======================================== */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-main {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 0 30px;
    height: 70px;
}

.logo {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.logo:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-menu a {
    color: rgba(255,255,255,0.95);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-2px);
}

.search-box {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.search-box form {
    display: flex;
    background: rgba(255,255,255,0.15);
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.search-box form:hover,
.search-box form:focus-within {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: scale(1.02);
}

.search-box input {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    width: 200px;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-box button {
    padding: 10px 25px;
    background: #fff;
    color: #667eea;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.user-menu {
    display: flex;
    gap: 10px;
    list-style: none;
}

.user-menu li a {
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background: rgba(255,255,255,0.15);
    transition: all 0.3s ease;
}

.user-menu li a:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* ========================================
   主内容区布局
   ======================================== */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    padding: 15px 12px;
    width: 100%;
    box-sizing: border-box;
}

/* 左侧边栏 */
.sidebar {
    width: 240px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

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

.category-item {
    margin-bottom: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* 一级分类样式：无边框 */
.category-item a {
    display: block;
    padding: 10px 15px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 4px;
    background: transparent;
}

/* 选中/悬停效果：仅背景色和文字颜色变化 */
.category-item:hover a,
.category-item.active a {
    background: #f8f9fa;
    color: #667eea;
}

/* 子分类 */
.sub-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: transparent;
}

.sub-category-list.show {
    display: block;
}

.sub-category-list li a {
    padding-left: 35px;
    font-size: 13px;
    color: #777;
    font-weight: normal;
    background: transparent;
}

.sub-category-list li a:hover {
    color: #667eea;
    background: transparent;
}

/* 右侧内容区 */
.content {
    flex: 1;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 0;
    min-height: 0;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.page-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.page-title span {
    color: #999;
    font-size: 14px;
}

/* 排序栏 */
.sort-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.sort-option {
    padding: 8px 18px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.sort-option:hover,
.sort-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

/* ========================================
   商品网格
   ======================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 30px;
    min-height: 300px;
}

.product-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.product-link {
    display: block;
    color: inherit;
}

.product-image {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    background: #f5f6fa;
    position: relative;
    overflow: hidden;
    display: block;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    display: block;
    margin: 0;
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    z-index: 10;
}

.badge-hot {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 10px rgba(245,87,108,0.4);
}

.badge-new {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 2px 10px rgba(79,172,254,0.4);
}

.product-info {
    padding: 20px;
}

.product-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.5;
    min-height: 45px; /* 固定两行高度，确保底部价格对齐 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    transition: color 0.3s ease;
}

.product-card:hover .product-title {
    color: #667eea;
}

.product-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.price {
    font-size: 22px;
    font-weight: 700;
    color: #ff4757;
}

.sold {
    font-size: 13px;
    color: #999;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 12px;
}

/* ========================================
   商品详情页
   ======================================== */
.product-detail-page {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 30px;
}

.product-detail {
    display: flex;
    gap: 50px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin-bottom: 30px;
}

.product-images {
    flex: 1;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
}

.product-images img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.product-info-detail {
    flex: 1;
}

.product-info-detail .product-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    height: auto;
    line-height: 1.4;
}

.product-meta {
    margin-bottom: 30px;
}

.product-meta .price {
    font-size: 36px;
    margin-right: 15px;
}

.product-meta .original-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
}

.product-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-buy,
.btn-cart {
    flex: 1;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-buy {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-buy:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102,126,234,0.5);
}

.btn-cart {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-cart:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-3px);
}

.product-description {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin-top: 30px;
}

.product-description h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.description-content {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
}

.description-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 8px;
}

/* ========================================
   搜索页面
   ======================================== */
.search-results-page {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 30px;
}

.search-header {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
}

.search-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-header p {
    color: #999;
    font-size: 16px;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.no-results {
    grid-column: 1/-1;
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 16px;
    font-size: 18px;
    color: #999;
}

/* ========================================
   新闻详情页
   ======================================== */
.news-detail-page {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 30px;
}

.news-header {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
}

.news-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

.news-meta {
    color: #999;
    font-size: 14px;
}

.news-content {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

.news-content p {
    margin-bottom: 20px;
}

.news-footer {
    margin-top: 30px;
    text-align: center;
}

.btn-back {
    display: inline-block;
    padding: 12px 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102,126,234,0.4);
}

/* ========================================
   分页
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.pagination a {
    padding: 10px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination a:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102,126,234,0.4);
}

.pagination span {
    color: #999;
    font-size: 14px;
}

/* ========================================
   页脚 — 由模板内联样式控制
   ======================================== */
/* 旧版页脚样式已移除，请参见各 .tpl 文件中的内联 <style> */

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    .product-detail {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .navbar-main {
        flex-wrap: wrap;
        height: auto;
        padding: 15px 20px;
        gap: 15px;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .search-box {
        margin-left: 0;
        order: 2;
    }

    .user-menu {
        order: 4;
        width: 100%;
        justify-content: center;
    }

    .product-grid {
    }

    .product-image {
        height: 150px;
        padding-bottom: 0;
    }
}

@media (max-width: 480px) {
    .page-title {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ========================================
   动画效果
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content {
    animation: fadeIn 0.6s ease-out;
}

.product-card {
    animation: fadeIn 0.4s ease-out;
}
