.product-gallery {
    padding: 20px;
    margin-top: 60px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.product-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-item {
    background: var(--card-background);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 100%;
    transform-origin: center;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--shadow-color);
}

.product-item img {
    width: 100%;
    min-height: calc(100% / 2); /* 最宽 2:1 */
    max-height: calc(100% * 0.88); /* 最窄 0.88:1 */
    height: auto;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.product-item h3 {
    margin: 16px 20px 8px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.product-item p {
    margin: 0 20px 20px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--secondary-text);
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .product-gallery {
        gap: 20px;
    }
    
    .product-column {
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .product-gallery {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
    
    .product-column {
        gap: 16px;
    }
    
    .product-item {
        margin-bottom: 16px;
    }
    
    .product-item img {
        height: 240px;
        min-height: unset;
        max-height: unset;
    }
    
    .product-item h3 {
        font-size: 1.25rem;
        margin: 12px 16px 6px;
    }
    
    .product-item p {
        margin: 0 16px 16px;
        font-size: 0.9rem;
    }
}

/* 底部说明文字样式 */
.caption-section {
    break-inside: avoid;
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    border-radius: 12px;
}

.caption {
    color: var(--secondary-text);
    font-size: 0.9rem;
    line-height: 1.2;
}

/* 产品详情模态框 */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    transition: background-color 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.product-modal.active {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-background);
    border-radius: 16px;
    overflow: hidden;
    max-width: 900px;
    width: 90%;
    position: relative;
    transform-origin: top center;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: auto;
    max-height: calc(100dvh - 40px); /* 减去padding的两倍 */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px var(--shadow-color);
}

.modal-content.active {
    transform: scale(1);
    opacity: 1;
}

/* 移除特殊的封面图样式 */
.modal-content .cover-image,
.modal-content .cover-image:only-of-type::after,
.modal-content .cover-image:only-of-type:hover::after {
    display: none;
}

.content-wrapper {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-content h2 {
    margin: 0 0 16px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.detail-images {
    margin: 24px -12px 0;
    display: grid;
    grid-gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    padding: 0 12px;
}

.detail-images img {
    width: 100%;
    min-height: calc(100% / 2);
    max-height: calc(100% * 0.88);
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.detail-images img:hover {
    transform: scale(1.05);
}

.close-button {
    position: absolute;
    right: 16px;
    top: 16px;
    background: var(--header-background);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow-color);
    z-index: 1;
    transition: background-color 0.2s ease;
}

.close-button:hover {
    background: var(--card-background);
}

.detail-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 16px 0;
}

.detail-date {
    color: var(--secondary-text);
    font-size: 0.9rem;
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .product-modal {
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 0 auto;
        max-height: none;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .detail-images {
        margin: 16px -8px 0;
        grid-gap: 12px;
        padding: 0 8px;
    }
    
    .detail-images img {
        height: 240px;
        min-height: unset;
        max-height: unset;
    }
    
    .modal-content h2 {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }
    
    .detail-description {
        font-size: 1rem;
        margin: 12px 0;
    }
}

/* 图片浏览器样式 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-viewer img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.image-viewer .nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 16px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.image-viewer .nav-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-viewer .prev-button {
    left: 20px;
}

.image-viewer .next-button {
    right: 20px;
}

.image-viewer .close-viewer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

.image-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

/* 搜索按钮样式 */
.search-button {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.search-button svg {
    width: 24px;
    height: 24px;
}

/* 搜索框样式 */
.search-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.search-container.active {
    opacity: 1;
    pointer-events: auto;
}

.search-box {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 24px var(--shadow-color);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.search-container.active .search-box {
    transform: translateY(0);
}

.search-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background-color: var(--card-background);
    color: var(--text-color);
}

.search-input:focus {
    outline: none;
    border-color: #2C9678;
}

.search-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-text);
    cursor: pointer;
    padding: 8px;
    margin: -8px;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.search-result-item:hover {
    background-color: var(--hover-background);
}

.search-result-item h4 {
    margin: 0 0 4px;
    color: var(--text-color);
}

.search-result-item p {
    margin: 0;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

.search-result-highlight {
    background-color: var(--primary-color);
    padding: 0 2px;
    border-radius: 2px;
    color: var(--white);
}

@media (max-width: 640px) {
    .search-container {
        padding-top: 60px;
    }
    
    .search-box {
        width: calc(100% - 32px);
        padding: 16px;
    }
    
    .search-input {
        padding: 10px 14px;
    }
    
    .search-results {
        max-height: 300px;
    }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .product-item img {
        border-bottom-color: var(--border-color);
    }

    .search-input::placeholder {
        color: var(--secondary-text);
    }

    .close-button img {
        opacity: 0.8;
    }

    .close-button:hover img {
        opacity: 1;
    }
}

