/* ============================================================
   CPA 租售 Tab 表格样式
   文件: cpa-tabs.css
   路径: /wp-content/uploads/custom-assets/cpa-tabs.css
   ============================================================ */

* {
    box-sizing: border-box;
}
.cpa-wrapper {
    margin: 0;
    background: #f5f7fb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang HK", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a2634;
    padding: 0;
}

//* ===== Tab 标签样式 ===== */
.cpa-tabs {
    display: flex !important;
    gap: 25px !important;          /* 强制间距 */
    margin-bottom: 20px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.cpa-tab-btn {
    display: inline-block !important;
    padding: 6px 4px 12px 4px !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    background: transparent !important;
    color: #bbb !important;          /* 未选中：浅灰色 */
    letter-spacing: 0.5px !important;
    transition: all 0.25s ease !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.cpa-tab-btn:hover {
    color: #555 !important;
    border-bottom-color: #ddd !important;
    background: transparent !important;
}

.cpa-tab-btn.active {
    color: #1e3a5f !important;      /* 选中：深蓝色 */
    border-bottom-color: #1e3a5f !important;
    font-weight: 600 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.cpa-tab-btn .tab-icon {
    margin-right: 6px !important;
}

.cpa-tab-btn .tab-badge {
    display: inline-block !important;
    background: #eef3f9 !important;
    padding: 0 10px !important;
    border-radius: 20px !important;
    font-size: 0.65rem !important;
    font-weight: 500 !important;
    margin-left: 6px !important;
    color: #999 !important;
}

.cpa-tab-btn.active .tab-badge {
    background: #e8ecf1 !important;
    color: #1e3a5f !important;
}
/* ===== Tab 内容容器 ===== */
.cpa-tab-content {
    display: none;
}
.cpa-tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== 标题样式（突出关键词） ===== */
/* ===== 标题样式（居中） ===== */
.cpa-header {
    display: flex;
    flex-direction: column;        /* 改为纵向排列 */
    align-items: center;           /* 水平居中 */
    justify-content: center;
    margin-bottom: 16px;
    padding: 0 0 12px 0;
    border-bottom: 2px solid #e8ecf1;
    text-align: center;            /* 文字居中 */
}
.cpa-header h2 {
    font-weight: 600;
    font-size: 1.2rem;
    margin: 0;
    color: #1e3a5f;
    letter-spacing: 0.5px;
}
.cpa-header h2 .highlight-lease {
    color: #d4af37;
    font-weight: 700;
}
.cpa-header h2 .highlight-sale {
    color: #AC1B08;
    font-weight: 700;
}
.cpa-header h2 .header-icon {
    margin-right: 6px;
}
.cpa-header small {
    background: #eef3f9;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #7a8a9e;
    margin-top: 4px;              /* 与标题的间距 */
}

/* ★★★ 表格容器 + 表头固定 ★★★ */
.table-wrap {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 6px 24px rgba(0, 20, 40, 0.04);
    padding: 0 2px 2px 2px;
    max-height: 700px;
    display: block;
}

.cpa-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.88rem;
    display: block;
    overflow: auto;
    max-height: 600px;
}
.cpa-table thead {
    display: table;
    width: 100%;
    table-layout: fixed;
    background: #1f3f60;
    background: linear-gradient(145deg, #1b3a57, #214a6e);
    position: sticky;
    top: 0;
    z-index: 100;
}
.cpa-table tbody {
    display: block;
    overflow: auto;
    max-height: 440px;
    width: 100%;
}
.cpa-table thead tr,
.cpa-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}
.cpa-table th,
.cpa-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #e6ecf3;
    vertical-align: middle;
    word-break: break-word;
}

/* 列宽分配（租赁表） */
.cpa-table.lease-table th:nth-child(1),
.cpa-table.lease-table td:nth-child(1) { width: 12%; text-align: left; padding-left: 16px; }
.cpa-table.lease-table th:nth-child(2),
.cpa-table.lease-table td:nth-child(2) { width: 18%; }
.cpa-table.lease-table th:nth-child(3),
.cpa-table.lease-table td:nth-child(3) { width: 10%; }
.cpa-table.lease-table th:nth-child(4),
.cpa-table.lease-table td:nth-child(4) { width: 10%; }
.cpa-table.lease-table th:nth-child(5),
.cpa-table.lease-table td:nth-child(5) { width: 20%; font-weight: 600; color: #b65c1a; }
.cpa-table.lease-table th:nth-child(6),
.cpa-table.lease-table td:nth-child(6) { width: 30%; }

/* 列宽分配（销售表）*/
.cpa-table.sale-table th:nth-child(1),
.cpa-table.sale-table td:nth-child(1) { width: 12%; text-align: left; padding-left: 16px; }
.cpa-table.sale-table th:nth-child(2),
.cpa-table.sale-table td:nth-child(2) { width: 15%; }
.cpa-table.sale-table th:nth-child(3),
.cpa-table.sale-table td:nth-child(3) { width: 8%; }
.cpa-table.sale-table th:nth-child(4),
.cpa-table.sale-table td:nth-child(4) { width: 10%; }
.cpa-table.sale-table th:nth-child(5),
.cpa-table.sale-table td:nth-child(5) { width: 15%; }
.cpa-table.sale-table th:nth-child(6),
.cpa-table.sale-table td:nth-child(6) { width: 20%; font-weight: 600; color: #0b4b6b; }
.cpa-table.sale-table th:nth-child(7),
.cpa-table.sale-table td:nth-child(7) { width: 20%; }

.cpa-table th {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 15px 8px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 2px solid #31638b;
    background: #1f3f60;
    background: linear-gradient(145deg, #1b3a57, #214a6e);
}
.cpa-table td:first-child {
    text-align: left;
    padding-left: 16px;
    font-weight: 500;
    color: #0f3857;
    white-space: nowrap;
}
.cpa-table tbody tr:last-child td {
    border-bottom: none;
}
.cpa-table tbody tr:hover td {
    background: #f2f7fe;
}
.cpa-table td:nth-child(4) {
    font-weight: 500;
}

/* 通用标签 */
.badge {
    background: #eef3f9;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
    color: #1d4b6e;
}
.price-tag {
    font-weight: 600;
    color: #1d6b44;
    background: #e8f3ec;
    padding: 3px 10px;
    border-radius: 40px;
    font-size: 0.78rem;
    display: inline-block;
    white-space: nowrap;
}
.unit-code {
    font-weight: 500;
    background: #f4f7fb;
    padding: 4px 8px;
    border-radius: 16px;
    display: inline-block;
    font-size: 0.8rem;
    white-space: nowrap;
}
.empty-unit {
    color: #8f9eb0;
    font-weight: 400;
}
.footnote {
    margin-top: 18px;
    text-align: right;
    font-size: 12px;
    color: #5b6f82;
    padding: 0 8px;
}

/* 滚动条美化 */
.table-wrap::-webkit-scrollbar,
.cpa-table tbody::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.table-wrap::-webkit-scrollbar-track,
.cpa-table tbody::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb,
.cpa-table tbody::-webkit-scrollbar-thumb {
    background: #AC1B08;
    border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.cpa-table tbody::-webkit-scrollbar-thumb:hover {
    background: #8a1606;
}

/* 手机端响应式 */
@media (max-width: 600px) {
    .cpa-wrapper {
        padding: 0;
    }
    .cpa-tab-btn {
        font-size: 0.9rem;
        padding: 12px 10px;
    }
    .cpa-table {
        font-size: 0.8rem;
        min-width: 660px;
    }
    .cpa-table th,
    .cpa-table td {
        padding: 10px 5px;
    }
    .cpa-table th:first-child,
    .cpa-table td:first-child {
        padding-left: 10px;
    }
    .price-tag {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    .table-wrap {
        max-height: 380px;
    }
    .cpa-table tbody {
        max-height: 330px;
    }
    .cpa-header h2 {
        font-size: 1.2rem;
    }
}