/* 分类容器（保持120px宽度） */
#categories-container {
    width: 120px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 900;
}

/* 搜索框容器 */
.search-wrapper {
    padding: 0 2px;
    margin-bottom: 12px;
}

#game-search {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 12px;
}

#search-btn {
    width: 100%;
    padding: 6px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

#search-btn:hover {
    background: #218838;
}

/* 分类项 */
.category-item {
    width: calc(100% - 4px);
    padding: 8px;
    margin: 4px 2px;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    box-sizing: border-box;
}

.category-item:hover {
    background: #e9ecef;
}

.category-item.active {
    background: #dee2e6;
    font-weight: bold;
}

/* ===== 游戏列表网格布局 ===== */
#games-container {
    margin-left: 120px;
    padding: 15px;
    min-height: calc(100vh - 100px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* ===== 游戏卡片 ===== */
.game-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.game-item:hover {
    transform: translateY(-4px);
}

.game-item > a {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.game-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    object-fit: cover;
    background: #f0f0f0;
}

.game-title {
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 4px 0;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 40px;
    text-align: center;
}

.game-info {
    width: 100%;
    margin-top: 4px;
}

.game-size {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    font-size: 13px;
    color: #888;
}

.game-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff6b35;
}

.loading, .error, .no-data {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

/* 底部统计栏 */
#selection-bar {
    position: fixed;
    bottom: 0;
    left: 120px;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 25px;
    color: white;
    z-index: 1000;
    backdrop-filter: blur(5px);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.selection-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

#selection-bar button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

#selection-bar button:first-of-type {
    background: #dc3545;
    color: white;
    margin-left: auto;
}

#selection-bar button:first-of-type:hover {
    background: #c82333;
}

#confirm-order-btn {
    background: #28a745;
    color: white;
}

#confirm-order-btn:hover {
    background: #218838;
}

#selected-count-link {
    color: #ffc107;
    text-decoration: none;
    font-weight: bold;
}

#selected-count-link:hover {
    text-decoration: underline;
}

/* 选择管理弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1100;
}

.modal-content {
    position: fixed;
    bottom: 0;
    left: 120px;
    right: 0;
    max-height: 70vh;
    background: white;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

.close-modal:hover {
    color: #495057;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(70vh - 60px);
}

.selected-game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.selected-game-item:last-child {
    border-bottom: none;
}

.selected-game-item .game-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.selected-game-item img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

.selected-game-item .game-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.selected-game-item .game-size {
    color: #6c757d;
    font-size: 14px;
}

.remove-game {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.remove-game:hover {
    background: #c82333;
}

.empty-selection {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

/* 订单弹窗样式 */
#order-modal .modal-content, #success-modal .modal-content {
    max-width: 400px;
    margin: 10% auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 90%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.submit-btn {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
}

.tip {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* 订单成功弹窗样式 */
#success-modal .modal-content {
    text-align: center;
}

#success-modal .tip {
    margin: 15px 0;
    color: #666;
    font-size: 14px;
}

#success-modal .submit-btn {
    margin-top: 15px;
    background: #28a745;
    width: auto;
    padding: 8px 20px;
}

/* ===== 响应式：小屏适配 ===== */
@media (max-width: 768px) {
    #categories-container {
        width: 90px;
        padding: 6px;
    }
    #games-container {
        margin-left: 90px;
        padding: 10px;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    #selection-bar {
        left: 90px;
        padding: 10px 15px;
    }
    .selection-content {
        font-size: 12px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .game-title {
        font-size: 13px;
        min-height: 36px;
    }
    .modal-content {
        left: 90px;
    }
}

@media (max-width: 480px) {
    #categories-container {
        width: 70px;
        padding: 4px;
    }
    #games-container {
        margin-left: 70px;
        padding: 8px;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    #selection-bar {
        left: 70px;
        padding: 8px 10px;
    }
    .selection-content {
        font-size: 11px;
        gap: 6px;
    }
    .game-title {
        font-size: 12px;
        min-height: 32px;
    }
    #selection-bar button {
        padding: 4px 10px;
        font-size: 11px;
    }
    .modal-content {
        left: 70px;
    }
}