/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    color: #333;
    line-height: 1.6;
}

a.read-more {
    color: orange;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: normal;
}

a.read-more:hover {
    font-weight: bold;
}

a {
    color: #1D4C76;
    text-decoration: none;
}

a:hover {
    color: #FF7F00;
}

/* ===== Layout ===== */
body, html {
    overflow-x: hidden;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.search-container {
    width: 260px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
}

.content-container {
    flex: 1;
    min-width: 0;
}

/* ===== Search Form & Categories ===== */
.search-form input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.search-form input[type="submit"] {
    width: 100%;
    padding: 10px;
    background: #1D4C76;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: bold;
}

.search-form input[type="submit"]:hover {
    background: #2A6A9F;
}

.category-container {
    margin-top: 20px;
}

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

.category-list li {
    margin-bottom: 10px;
}

.category-list a {
    display: block;
    padding: 6px 0;
    border-bottom: 1px dashed #ccc;
}

/* ===== Blocks ===== */
.block {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 30px;
}

.block h2 {
    margin-bottom: 15px;
    color: #1D4C76;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    font-size: 20px;
}

/* ===== News Module ===== */
.block p, .block ul {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 15px;
}

.block ul {
    padding-left: 20px;
    margin-top: 10px;
}

.block ul li {
    margin-bottom: 10px;
}

.block strong {
    font-weight: bold;
    color: #333;
}

/* ===== Products ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
}

.product-image-container {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.product-image-container img {
    max-width: 480px;
    width: auto;
    height: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    display: block;
    margin: 0 auto 20px;
}

@media (max-width: 768px) {
    .product-image-container img {
        max-width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

.product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    min-width: 0;
    transition: all 0s ease;
}

.product-card:hover {
    border: 2px solid #f2b26c;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.product-thumbnail-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #f0f0f0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-thumbnail {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.no-image-placeholder {
    color: #aaa;
    font-size: 14px;
}

.product-title {
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0 5px;
}

/* ===== Pagination ===== */
.pagination {
    margin-top: 20px;
    text-align: center;
    padding: 10px 0;
}

.pagination a, 
.pagination span.current {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    background: #fff;
}

.pagination a:hover {
    background: #1D4C76;
    color: #fff;
    border-color: #1D4C76;
}

.pagination span.current {
    background: #1D4C76;
    color: #fff;
    border-color: #1D4C76;
    font-weight: bold;
}

.view-button {
    display: inline-block;
    margin: 5px 0;
    padding: 6px 12px;
    background: #1D4C76;
    color: white;
    border-radius: 4px;
    font-size: 12px;
}

.view-button:hover {
    background: #2A6A9F;
}

.view-all {
    text-align: right;
    margin-top: 15px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .product-grid {
        gap: 10px;
    }

    .product-title {
        font-size: 13px;
    }
}

@media (max-width: 992px) {
        .search-container {
        display: none !important;
    }
    .product-grid {
        gap: 8px;
    }

    .product-card {
        padding: 8px;
    }
}

@media (max-width: 768px) {
    /* 默认情况下，所有页面的搜索区块隐藏 */
    .search-container {
        display: none !important;
    }

    /* 仅在 products.php 页面显示搜索区块 */
    body.products-page .search-container {
        display: block !important;
    }

    .main-container {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .content-container {
        overflow-y: auto;
    }

    .search-container {
        display: block !important;
        width: 100vw;
        margin-left: -20px;
        padding: 15px 20px;
        background: #f8f8f8;
        border-bottom: 1px solid #eee;
    }

    .search-form {
        width: 100%;
    }

    .search-form input[type="text"] {
        width: calc(100% - 22px);
    }

    .search-results-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .search-result-item {
        padding: 8px;
        border-radius: 10px;
    }

    .search-result-title {
        font-size: 14px;
    }

    .content-container {
        margin-top: 20px;
    }

    .main-container {
        overflow-x: hidden;
        overflow-y: visible;
    }
}

@media (max-width: 576px) {
    .search-container {
        display: none !important;
    }

    /* 仅在 products.php 页面显示搜索区块 */
    body.products-page .search-container {
        display: block !important;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(90px, 1fr));
    }

    .product-title {
        font-size: 11px;
    }

    .block h2 {
        font-size: 16px;
    }
}

/* Footer */
.footer-container {
    background-color: #1D4C76;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    margin-top: 40px;
}

.footer-content .copyright-text {
    font-size: 14px;
    font-weight: normal;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

/* 页面预加载容器 */
#preload-container {
    display: none;
    position: absolute;
    top: -9999px;
    left: -9999px;
}
