/* 商城容器 */
.shop-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 12px;
}

/* 标题 */
.shop-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.shop-header h2 {
    font-size: 22px;
    color: #1f2937;
}

.shop-header p {
    color: #6b7280;
    font-size: 13px;
}

/* 商品网格 */
.shop-list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* 商品卡片 */
.shop-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.shop-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* 🔥 图片容器缩小为90%宽度，保持1:1 */
.shop-item img {
    width: 90%; /* 核心：缩小为卡片宽度的90% */
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    object-position: center;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
    background: #fafafa;
    margin-bottom: 12px;
    box-sizing: border-box;
}

/* 商品名 */
.shop-item h4 {
    font-size: 15px;
    color: #1f2937;
    margin: 0 0 10px;
}

/* 🔥 价格 + 库存 往内缩进（padding 加大） */
.price-stock-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px; /* 从8px改为16px，内容更靠内 */
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px dashed #e5e7eb;
    box-sizing: border-box;
}

.shop-item .price {
    font-size: 17px;
    font-weight: bold;
    color: #2563eb;
    margin: 0;
}

.shop-item .stock {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* 按钮组（横排适配手机） */
.btn-group {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: auto;
    padding: 0 2px;
    box-sizing: border-box;
}

.btn-detail,
.buy-btn {
    flex: 1;
    padding: 10px 6px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-detail {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-detail:hover {
    background: #f3f4f6;
}

.buy-btn {
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
}

.buy-btn:hover {
    background: #1d4ed8;
}

/* 弹窗 */
.modal-overlay {
    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: 9999;
}

.modal-box {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    width: 92%;
    max-width: 400px;
}

.form-item {
    margin-bottom: 14px;
}

.form-item input, .form-item textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
}

.btn-cancel {
    background: #9ca3af;
    color: #fff;
}

.btn-confirm {
    background: #2563eb;
    color: #fff;
}

/* 响应式适配：平板/手机 */
@media (max-width: 768px) {
    .shop-list-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .shop-container {
        padding: 16px 10px;
    }

    /* 商品卡片 */
    .shop-item {
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
        transition: all 0.2s ease;

        /* 🔥 核心：让卡片整体缩小到 90%，并且自动居中 */
        width: 90%;
        margin: 0 auto;
    }

    .btn-detail,
    .buy-btn {
        font-size: 11px;
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .shop-list-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .shop-header h2 {
        font-size: 20px;
    }

    .shop-item {
        padding: 14px;
    }

    .btn-detail,
    .buy-btn {
        font-size: 13px;
        padding: 10px 6px;
    }
}