/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 导航栏样式 */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #3498db;
}

.nav-links a.active {
    color: #3498db;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.25rem;
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 2rem 2rem; /* 添加顶部padding，避免被悬浮搜索框遮挡 */
}

/* 通用区块样式 */
.section {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

/* 仪表盘样式 */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #3498db;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* 图表容器样式 */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chart-section {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-section h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* 响应式图表设计 */
@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .chart-wrapper {
        height: 200px;
    }
}

/* 悬浮搜索框样式 */
.floating-search {
    position: fixed;
    top: 80px; /* 位于导航栏下方 */
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 999;
    padding: 1rem 0;
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #e0e0e0;
}

.floating-search .search-input-group {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.floating-search input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    transition: all 0.3s ease;
}

.floating-search input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.floating-search select,
.floating-search button {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    background-color: white;
    transition: all 0.3s ease;
}

.floating-search select:hover,
.floating-search button:hover {
    border-color: #3498db;
}

.floating-search button {
    background-color: #3498db;
    color: white;
    border: none;
}

.floating-search button:hover {
    background-color: #2980b9;
}

/* 搜索区域样式 */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-input-group input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-input-group select,
.search-input-group button {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.search-input-group button {
    background-color: #3498db;
    color: white;
    border: none;
    transition: background-color 0.3s ease;
}

.search-input-group button:hover {
    background-color: #2980b9;
}

.region-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.region-selector select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 过滤器样式 */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: #f0f0f0;
}

.filter-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 高级筛选样式 */
.advanced-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* 价格范围筛选样式 */
.price-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.price-range input {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.price-range button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.price-range button:hover {
    background-color: #f0f0f0;
}

/* 品牌筛选样式 */
.brand-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.brand-filter select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.brand-filter button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.brand-filter button:hover {
    background-color: #f0f0f0;
}

/* 排序选项样式 */
.sort-options select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
}

.sort-options select:hover {
    border-color: #3498db;
}

/* 导出按钮样式 */
.export-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: flex-end;
}

.export-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    background-color: #27ae60;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.export-btn:hover {
    background-color: #219653;
}

.export-btn:active {
    background-color: #1e8449;
}

/* 产品网格样式 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

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

.product-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card .asin {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.product-card .brand {
    font-size: 0.9rem;
    color: #3498db;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.product-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 0.5rem;
}

.product-card .price::after {
    content: '';
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.7;
}

.product-card .status {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.product-card .status.available {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.product-card .status.unavailable {
    background-color: #ffebee;
    color: #c62828;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 1rem;
    top: 0.5rem;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#productDetails h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.5rem;
}

#productDetails .detail-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

#productDetails .detail-row {
    display: flex;
    margin-bottom: 0.5rem;
}

#productDetails .detail-label {
    width: 150px;
    font-weight: 600;
    color: #666;
}

#productDetails .detail-value {
    flex: 1;
    color: #333;
}

/* 产品图片样式 */
#productDetails .product-images {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

#productDetails .product-image {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: white;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease;
}

#productDetails .product-image:hover {
    transform: scale(1.05);
}

/* 产品描述样式 */
#productDetails .product-description {
    margin-top: 1rem;
    line-height: 1.8;
    color: #333;
    background-color: white;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    white-space: pre-wrap;
}

/* 产品特点样式 */
#productDetails .product-features {
    margin-top: 1rem;
    margin-left: 1.5rem;
    color: #333;
}

#productDetails .product-features li {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    list-style-type: disc;
}

#productDetails .product-features li:before {
    color: #3498db;
}

/* 页脚样式 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* 畅销榜单样式 */
.bestsellers-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.bestsellers-sidebar {
    flex: 0 0 250px;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.bestsellers-content {
    flex: 1;
    min-width: 300px;
}

#bestsellersCategories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    padding: 0.75rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-item:hover {
    background-color: #e8f4fd;
    border-color: #3498db;
}

.category-item.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 分类数据样式 */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.category-selector select {
    flex: 1;
    min-width: 300px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.category-selector button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.category-selector button:hover {
    background-color: #2980b9;
}

#categoryDetails {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.category-info {
    margin-bottom: 1.5rem;
}

.category-info h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.category-detail-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.category-detail-label {
    width: 150px;
    font-weight: 600;
    color: #666;
}

.category-detail-value {
    flex: 1;
    color: #333;
}

/* 定时任务设置样式 */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.setting-group {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.setting-group h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

/* 开关按钮样式 */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3498db;
}

input:focus + .slider {
    box-shadow: 0 0 1px #3498db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 滑块圆形样式 */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 间隔选择器样式 */
.interval-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.interval-selector select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    min-width: 200px;
}

/* 上次刷新时间样式 */
#lastRefreshTime {
    color: #666;
    font-style: italic;
}

/* 设置组样式 */
.setting-group:last-child {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 子分类列表样式 */
.subcategories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.subcategory-item {
    padding: 0.75rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .section {
        padding: 1.5rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-input-group input {
        min-width: auto;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 15% auto;
    }
}