/**
 * 商城样式文件
 * 星球软件商用网站管理系统
 */

/* 商城页面布局 */
.shop-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 分类筛选区域 */
.category-filter {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filter-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.filter-btn.active {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

.filter-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-option {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.filter-option:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.filter-option.active {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

/* 商品网格布局 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new {
    background: #28a745;
    color: white;
}

.badge-hot {
    background: #dc3545;
    color: white;
}

.badge-sale {
    background: #ffc107;
    color: #212529;
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.product-info {
    padding: 20px;
}

.product-category {
    color: #666;
    font-size: 12px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    height: 44px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-name a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-name a:hover {
    color: var(--primary-color, #007bff);
}

.product-spec {
    color: #666;
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.current-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color, #007bff);
}

.original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.product-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.product-sales,
.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cart-btn {
    background: var(--primary-color, #007bff);
    color: white;
}

.cart-btn:hover {
    background: var(--primary-dark, #0056b3);
}

.favorite-btn {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
}

.favorite-btn:hover {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.favorite-btn.favorited {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination-btn {
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-number:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.page-number.active {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* 排序栏 */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sort-options {
    display: flex;
    gap: 15px;
}

.sort-option {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sort-option:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.sort-option.active {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.view-btn:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.view-btn.active {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

/* 侧边栏布局 */
.shop-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

.sidebar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-section {
    margin-bottom: 25px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin-bottom: 8px;
}

.sidebar-link {
    display: block;
    padding: 8px 12px;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.sidebar-link:hover {
    background: #f8f9fa;
    color: var(--primary-color, #007bff);
}

.sidebar-link.active {
    background: var(--primary-color, #007bff);
    color: white;
}

/* 价格范围滑块 */
.price-range {
    padding: 0 10px;
}

.range-slider {
    margin-bottom: 15px;
}

.range-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.range-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.range-separator {
    color: #666;
}

/* 购物车样式 */
.cart-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.cart-items {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.cart-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 80px;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: #333;
}

.cart-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 80px;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-product {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-product-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-product-info {
    flex: 1;
}

.cart-product-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.cart-product-spec {
    color: #666;
    font-size: 13px;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
}

.quantity-input {
    width: 50px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.cart-price {
    font-weight: 600;
    color: var(--primary-color, #007bff);
    font-size: 16px;
}

.cart-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s ease;
}

.cart-remove:hover {
    color: #c82333;
}

.cart-summary {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-row:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 18px;
    color: var(--primary-color, #007bff);
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 20px;
}

.checkout-btn:hover {
    background: var(--primary-dark, #0056b3);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        margin-bottom: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .shop-container {
        padding: 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .filter-content {
        grid-template-columns: 1fr;
    }
    
    .sort-bar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .cart-header {
        display: none;
    }
    
    .cart-item {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .cart-product {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-options {
        justify-content: center;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .sort-options {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color, #007bff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 浮动购物车按钮 */
.floating-cart {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-color, #007bff);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-cart:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* 快速查看模态框 */
.quickview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.quickview-modal.show {
    display: flex;
}

.quickview-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.quickview-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 1;
}

.quickview-close:hover {
    color: #333;
}

/* 工具类 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.p-20 {
    padding: 20px;
}

.hidden {
    display: none;
}

/* 主题颜色变量 */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .shop-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .product-card,
    .category-filter,
    .sidebar,
    .cart-items,
    .cart-summary {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .product-name a,
    .sidebar-title,
    .filter-title {
        color: #e0e0e0;
    }
    
    .product-category,
    .product-spec,
    .sidebar-link {
        color: #b0b0b0;
    }
    
    .filter-btn,
    .sort-option,
    .view-btn,
    .quantity-btn {
        background: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .cart-header {
        background: #3d3d3d;
        color: #e0e0e0;
    }
}