/* 首先修复横向滚动条问题 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, calc((99% - 140px) / 7))); /* 桌面端7列 */
    grid-auto-rows: calc((100vw - 120px) / 7);
    grid-auto-flow: dense;
    gap: 15px;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    padding: 20px 15px; /* 新增上下内边距，与轮播图区分 */
    margin-top: 10px; /* 新增：避免与轮播图贴边 */
}

/* 平板端（≤1024px）：改为4列 */
@media screen and (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(4, minmax(0, calc((99% - 60px) / 4))); /* 4列，减少gap计算 */
        grid-auto-rows: calc((100vw - 60px) / 4);
        gap: 10px; /* 缩小间距 */
    }
}

/* 手机端（≤768px）：改为2列 */
@media screen and (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, minmax(0, calc((99% - 20px) / 2))); /* 2列，适配手机 */
        grid-auto-rows: calc((100vw - 20px) / 2);
        gap: 8px; /* 进一步缩小间距 */
    }
    /* 手机端隐藏清晰度标签（避免文字拥挤） */
    .qingxidu { display: none; }
    /* 手机端放大产品名称字体 */
    .product-name { font-size: 14px; }
}

/* 超小手机端（≤480px）：优化2列布局 */
@media screen and (max-width: 480px) {
    .grid-container {
        gap: 5px;
        padding: 15px 8px;
    }
    .product-name { font-size: 12px; }
}


/* 修复无结果提示的样式，使其不会导致容器过宽 */
.no-results {
    width: 100%;
    text-align: center;
    padding: 50px 15px; /* 添加左右内边距 */
    color: #e28b01;
    box-sizing: border-box; /* 确保padding不增加总宽度 */
    margin: 0 auto; /* 居中显示 */
    max-width: 90%; /* 设置最大宽度 */
}
.no-results-container {
    width: 100%; /* 让容器占满整行宽度 */
    display: flex; /* 启用flex布局辅助居中 */
    justify-content: center; /* 水平居中内容 */
}

/* 其他原有样式保持不变 */
.grid-item {
    background: #605f5f;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0);
    overflow: hidden;
    position: relative;
}

.grid-item.style-1 {
    grid-row: span 1;
    grid-column: span 1;
}

.grid-item.style-12 {
    grid-row: span 2;
    grid-column: span 1;
}

.grid-item.style-21 {
    grid-row: span 1;
    grid-column: span 2;
}

.grid-item.style-22 {
    grid-row: span 2;
    grid-column: span 2;
}

.product-image-link {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.product-image-link img.lazy {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qingxidu {
    position: absolute;
    top: 20px;
    left: 50px;
    transform: translate(-50%, -50%);
    display: grid;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.7vw;
    width: 100%;
    color: #e28b01;
    text-shadow: 2px 2px 2px black;
}

.product-name {
    opacity: 0;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.0vw;
    width: 100%;
    color: white;
    text-shadow: 2px 2px 2px black;
}

.grid-item:hover .product-name {
    opacity: 1;
    background-color: rgba(33, 33, 33, 0.5);
    transition: all 0.2s ease;
}

.grid-item:hover {
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.5s ease;
    z-index: 999;
    animation: breath 2s ease-in-out infinite;
}

@keyframes breath {
    0% {
        box-shadow: 0 0 45px rgba(255, 255, 255, 1);
    }
    50% {
        box-shadow: 0 0 45px rgba(55, 55, 55, 0.1);
    }
    100% {
        box-shadow: 0 0 45px rgba(255, 255, 255, 1);
    }
}

/***************************************** 收藏星标样式 */
.grid-item {
    position: relative;
}

.favorite-star {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    z-index: 10;
    color: #ffffff;
    font-size: 24px;
    transition: all 0.3s ease;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.favorite-star:hover {
    animation: breathe 1.5s infinite ease-in-out;
}

@keyframes breathe {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.favorite-star.active i:before {
    content: "\f005";
    color: #e28b01;
}

.favorite-star i:before {
    content: "\f006";
}

.favorite-star.loading {
    opacity: 0.7;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 登录提示框样式 */
.login-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.prompt-content {
    background-color: #222;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    width: 300px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.prompt-content p {
    margin: 0 0 20px;
    font-size: 16px;
}

.prompt-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.login-btn, .close-btn {
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    border: none;
}

.login-btn {
    background-color: #e28b01;
    color: white;
}

.login-btn:hover {
    background-color: #00b894;
}

.close-btn {
    background-color: #444;
    color: white;
}

.close-btn:hover {
    background-color: #555;
}
