/* =========================================
   容器與全域設定 (防呆機制)
   ========================================= */
.cpm-inq-container {
    max-width: 1200px;
    width: 100%;
    margin: 30px auto;
    display: flex;
    flex-wrap: wrap;
    /* 關鍵：空間不足自動換行 */
    gap: 40px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    align-items: flex-start;
    position: relative;
    box-sizing: border-box;
}

/* 強制所有內部元件使用 border-box，避免佈景主題干擾 */
.cpm-inq-container *,
.cpm-inq-container *::before,
.cpm-inq-container *::after {
    box-sizing: border-box;
}

/* =========================================
   左側：清單與上傳 (RWD 設定)
   ========================================= */
.cpm-inq-left {
    flex: 1 1 600px;
    /* 基礎寬度 600px，可伸縮 */
    min-width: 0;
    /* 防止 flex item 內容撐破容器 */
}

.cpm-inq-title {
    font-size: 28px;
    color: #335c8c;
    font-weight: 800;
    margin: 0 0 10px 0;
    border-bottom: 2px solid #83a7d0;
    display: inline-block;
    padding-bottom: 5px;
    line-height: 1.4;
}

.cpm-inq-subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

/* --- 清單表格結構 --- */
.cpm-list-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f4f6f8;
    font-weight: bold;
    color: #333;
    font-size: 14px;
    border: 1px solid #eee;
    border-bottom: none;
}

.cpm-list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    margin-bottom: -1px;
    /* 邊框重疊 */
    transition: background 0.2s;
}

.cpm-list-item:hover {
    background: #fcfcfc;
}

/* --- 欄位寬度設定 --- */
.col-prod {
    flex: 4;
    padding-right: 15px;
    word-break: break-word;
    /* 防止長單字破版 */
}

.col-oem {
    flex: 3;
    color: #333;
    word-break: break-word;
}

.col-qty {
    flex: 0 0 80px;
    text-align: center;
}

.col-del {
    flex: 0 0 40px;
    text-align: right;
}

/* --- 元件樣式 --- */
.cpm-qty-input {
    width: 60px;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    height: 38px;
    /* 固定高度 */
}

.cpm-del-btn {
    color: #ff4d4d;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    padding: 5px;
}

.cpm-del-btn:hover {
    color: #d93636;
}

.cpm-empty-cart {
    padding: 40px;
    text-align: center;
    color: #999;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
}

/* --- 上傳區塊 --- */
.cpm-upload-area {
    border: 2px dashed #cbd2d9;
    background: #f9fbff;
    padding: 30px;
    text-align: center;
    border-radius: 6px;
    color: #5a6c7d;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 25px;
}

.cpm-upload-area:hover {
    border-color: #335c8c;
    background: #f0f6fc;
}

.cpm-upload-area strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

/* =========================================
   右側：表單區 (RWD 設定)
   ========================================= */
.cpm-inq-right {
    flex: 1 1 350px;
    /* 基礎寬度 350px，若空間不足會自動換行 */
    min-width: 300px;
    position: relative;
}

.cpm-form-box {
    background: #fff;
    padding: 30px;
    border: 1px solid #e0e0e0;
    border-top: 4px solid #b01b1b;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    position: sticky;
    top: 20px;
}

.cpm-form-box h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.cpm-form-group {
    margin-bottom: 18px;
}

.cpm-form-group label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    font-weight: 700;
}

.cpm-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 15px;
    color: #333;
    height: 45px;
}

.cpm-btn-submit {
    width: 100%;
    background: #b01b1b;
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.2s;
    margin-top: 10px;
}

.cpm-btn-submit:hover {
    background: #900f0f;
}

.cpm-btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#cpm-submit-msg {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
}

/* 購物車數量徽章 (header用) */
.cpm-cart-badge {
    display: inline-block;
    background-color: #b01b1b;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    padding: 0 4px;
    margin-left: 5px;
    vertical-align: middle;
}

/* =========================================
   手機版專用調整 (Max-Width 768px)
   ========================================= */
@media (max-width: 768px) {
    .cpm-inq-container {
        gap: 30px;
        /* ★★★ 這裡加入了您要求的 padding ★★★ */
        padding: 0px 15px;
    }

    /* 隱藏表格標題 */
    .cpm-list-header {
        display: none;
    }

    /* 列表轉為卡片式 */
    .cpm-list-item {
        flex-wrap: wrap;
        padding: 20px 15px;
        position: relative;
        border-bottom: 10px solid #f9f9f9;
        /* 卡片間隔 */
    }

    .col-prod {
        flex: 0 0 100%;
        /* 佔滿整行 */
        margin-bottom: 10px;
        padding-right: 30px;
        /* 留位置給刪除按鈕 */
        font-size: 16px;
    }

    .col-oem {
        flex: 1;
        font-size: 14px;
        color: #666;
        display: flex;
        align-items: center;
    }

    .col-oem::before {
        content: 'OEM: ';
        font-weight: bold;
        margin-right: 5px;
        color: #999;
    }

    .col-qty {
        flex: 0 0 auto;
    }

    .col-del {
        position: absolute;
        top: 15px;
        right: 10px;
    }

    /* 表單區塊調整 */
    .cpm-inq-right {
        min-width: 100%;
        /* 強制滿版 */
    }
}