/* =========================================
   1. 全局变量 (Variables)
   ========================================= */
:root {
    --bg-dark: #1a1b1e;
    --bg-panel: #25262b;
    --bg-hover: #2c2e33;
    --primary: #fab005;
    --text-main: #c1c2c5;
    --text-bright: #ffffff;
    --border: #373a40;
    --green: #40c057;
    --red: #fa5252;
}

/* =========================================
   2. 基础样式 (Base Styles)
   ========================================= */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================================
   3. 导航栏 (Navbar)
   ========================================= */
.navbar {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* =========================================
   4. 布局容器 (Layout)
   ========================================= */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* =========================================
   5. 控制区域 (Controls Area)
   ========================================= */
.controls-area {
    background-color: var(--bg-panel);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 20px;

    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

/* 搜索框 */
.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
}

/* 分类标签按钮 */
.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--primary);
    color: black;
    border-color: var(--primary);
    font-weight: bold;
}

/* 加成复选框组 */
.bonus-group {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #444;
    white-space: nowrap;
    align-items: center;
}

.bonus-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.bonus-label input {
    accent-color: var(--primary);
    transform: scale(1.2);
}

/* 操作按钮 (同步数据) */
.action-btn {
    background: var(--primary);
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

/* --- 控制区域的手机端适配 --- */
@media (max-width: 768px) {
    .controls-area {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }

    .search-box,
    .filter-tabs,
    .bonus-group,
    .action-btn {
        width: 100%;
        margin: 0;
        box-sizing: border-box;
    }

    .bonus-group {
        white-space: normal;
        flex-wrap: wrap;
        justify-content: center;
        height: auto;
    }

    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .brand {
        font-size: 1.1rem;
    }
}

/* =========================================
   6. 表格样式 (Data Table)
   ========================================= */
.table-responsive {
    overflow-x: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background: #2c2e33;
    color: white;
    white-space: nowrap;
}

td {
    color: var(--text-main);
    font-size: 0.95em;
}

/* --- 单元格特定样式 --- */

/* 物品名称列 (包含图标) */
.cell-name {
    font-weight: bold;
    color: var(--primary);
    vertical-align: middle; 
}

.item-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

/* 商店售价列 */
.cell-sell {
    color: #888;
}

/* 比率列 (基础) */
.cell-ratio {
    font-size: 1.1em;
}

/* 比率颜色状态 */
.ratio-high {
    color: var(--green);
    font-weight: bold;
}

.ratio-low {
    color: var(--red);
    font-weight: bold;
}

.ratio-normal {
    color: #666;
    font-weight: normal;
}

/* --- 表格内输入框 --- */
.p2p-input {
    width: 100px;
    padding: 4px;
    border-radius: 4px;
    font-family: monospace;
    background: transparent;
    border: 1px solid transparent;
    color: inherit;
    transition: all 0.2s;
}

.p2p-input:focus {
    border-color: var(--primary);
    background: var(--bg-dark);
    outline: none;
    color: var(--text-bright);
}

.p2p-input.is-custom {
    border-color: var(--primary);
    color: var(--primary);
}

/* =========================================
   7. 底部信息 (Footer)
   ========================================= */
.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.85em;
    color: #666;
    padding: 0 5px;
}

@media (max-width: 768px) {
    .footer-info {
        flex-direction: column-reverse;
        gap: 5px;
        align-items: flex-end;
    }
}