/* ================================
   全局表格样式
   ================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    table-layout: auto;
    /* 允许自适应列宽 */
}

th,
td {
    padding: 8px 10px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
    /* 保持文字不换行 */
    transition: background-color 0.3s ease;
}

/* 表头 */
th {
    background-color: #007bff;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
}

/* 表格行高度 */
tbody tr {
    height: 40px;
}

/* 奇偶行背景 */
tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

/* 鼠标悬停效果 */
tbody tr:hover {
    background-color: #f1f1f1;
}

/* 可滚动表格容器 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* iOS 平滑滚动 */
}

/* ================================
   工具栏 & 搜索框
   ================================ */
.toolbar,
.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.btn-toggle {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    font-size: 13px;
    flex-shrink: 0;
    /* 防止按钮在移动端被压缩 */
}

.btn-toggle:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* 搜索框自适应 */
#search-input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    flex: 1 1 auto;
    /* 自动拉伸 */
    min-width: 150px;
}


.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.toolbar-group {
    flex: 1;
    min-width: 200px;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    min-width: 50px;
}

#search-input {
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* 弹窗主体 */
.swal2-game-popup {
    background: linear-gradient(145deg, #2b2b2b, #1f1f1f);
    border: 1px solid #444;
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 详情卡片容器 */
.trade-detail-card {
    padding: 10px 5px;
    text-align: left;
}

/* 头部：物品名与状态 */
.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.item-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700; /* 金色 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    word-break: break-all;
}

.status-badge {
    color: #1a1a1a;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* 核心信息网格 (2列布局) */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item.full-width {
    grid-column: span 2;
    flex-direction: row;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.info-item .label {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 2px;
}

.info-item .value {
    font-size: 1.1rem;
    color: #fff;
    font-family: monospace;
}

.info-item .value.highlight {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.4rem;
}

/* 底部信息 */
.trade-footer {
    border-top: 1px solid #444;
    padding-top: 15px;
}

.trade-footer .row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 0.9rem;
}

.trade-footer .label { color: #888; }
.trade-footer .text { color: #ddd; font-family: monospace; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 5px 10px;
    border: 1px solid #007bff;
    background-color: #fff;
    color: #007bff;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.page-btn:hover:not(.disabled) {
    background-color: #007bff;
    color: #fff;
}

.page-btn.active {
    background-color: #007bff;
    color: #fff;
    font-weight: bold;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================
   移动端自适应
   ================================ */
@media (max-width: 768px) {
    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 6px 8px;
    }

    tbody tr {
        height: auto;
    }

    /* 工具栏按钮换行显示 */
    .toolbar,
    .search-toolbar {
        gap: 6px;
    }

    .btn-toggle {
        font-size: 12px;
        padding: 5px 8px;
    }

    /* 表格单元格换行显示，防止内容过宽 */
    td,
    th {
        white-space: normal;
    }

    /* 搜索框在移动端更窄 */
    #search-input {
        min-width: 100px;
        flex: 1 1 100%;
    }

    .search-toolbar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-group select {
        flex: 1;
        font-size: 12px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    table {
        font-size: 11px;
    }

    .btn-toggle {
        padding: 4px 6px;
    }

    #search-input {
        padding: 4px 6px;
    }
}