/* =================================================================== */
/* === MATKHAU.VN - MODERN TABLE DESIGN SYSTEM                     === */
/* === Đồng bộ thiết kế Inter, border-radius: .4em, bảng SaaS đẹp   === */
/* =================================================================== */

/* Container bọc ngoài bảng: chống tràn vỡ giao diện trên điện thoại */
.mks-table-responsive {
    width: 100% !important;
    margin: 20px 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: .4em !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px -2px rgba(15, 23, 42, 0.06) !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
}

/* Thanh cuộn tinh tế cho bảng trên máy tính/điện thoại */
.mks-table-responsive::-webkit-scrollbar {
    height: 6px;
}
.mks-table-responsive::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: .4em;
}
.mks-table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: .4em;
}
.mks-table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- ÁP DỤNG TRỰC TIẾP LÊN MỌI THẺ TABLE TRÊN TRANG (TRỪ BẢNG HỆ THỐNG WOOCOMMERCE) --- */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar),
.mks-table-responsive table,
.mks-styled-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 580px !important; /* Đảm bảo các cột so sánh không bị bẹp dúm trên mobile */
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    color: #334155 !important;
    background: #ffffff !important;
    font-family: inherit !important;
    border: none !important; /* Viền ngoài do container đảm nhận */
}

/* Fallback bo góc khi bảng chưa được bọc container */
body:not(:has(.mks-table-responsive)) table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar),
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar):not(.mks-table-responsive table) {
    border: 1.5px solid #e2e8f0 !important;
    border-radius: .4em !important;
    overflow: hidden !important;
}

/* --- DÒNG TIÊU ĐỀ BẢNG (HEADER ROW / FIRST ROW) --- */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) thead th,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:first-child th,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:first-child td,
.mks-head-row th,
.mks-head-row td,
.mks-head-cell {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 14px 16px !important;
    border-top: none !important;
    border-left: none !important;
    border-bottom: 2px solid #cbd5e1 !important;
    border-right: 1px solid #e2e8f0 !important;
    vertical-align: middle !important;
    letter-spacing: -0.01em !important;
    white-space: normal !important;
}

/* Ô tiêu đề đầu tiên: Căn trái */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) thead th:first-child,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:first-child th:first-child,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:first-child td:first-child,
.mks-head-row th:first-child,
.mks-head-row td:first-child {
    text-align: left !important;
    background: #edf2f7 !important;
}

/* --- TẤT CẢ Ô DỮ LIỆU (CELLS) --- */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) th,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) td {
    padding: 12px 16px !important;
    border-top: none !important;
    border-left: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    vertical-align: middle !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

/* Bỏ margin thừa nếu Word/Gutenberg bọc thẻ <p> hoặc <span> bên trong ô */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) td p,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) th p {
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Bỏ viền phải cho cột cuối */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) th:last-child,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) td:last-child {
    border-right: none !important;
}

/* Bỏ viền dưới cho dòng cuối */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:last-child td {
    border-bottom: none !important;
}

/* Cột đầu tiên (Tên tính năng / Tiêu chí): Căn trái, in đậm, nền xám sáng nhẹ */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tbody td:first-child,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:not(:first-child) td:first-child,
.mks-feature-col {
    text-align: left !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    background-color: #fafbfc !important;
    width: 28% !important;
    min-width: 175px !important;
}

/* --- DÒNG PHÂN NHÓM DANH MỤC (CATEGORY HEADER ROWS) --- */
/* Ví dụ: "Mở rộng mạng lưới quan hệ", "Xây dựng hình ảnh chuyên nghiệp", "Hỗ trợ và bảo vệ tài khoản (*)" */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr.mks-table-category td,
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) td[colspan],
.mks-category-cell {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 11px 16px !important;
    text-align: left !important;
    border-top: 1px solid #cbd5e1 !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
    border-right: none !important;
}

/* --- DÒNG GIÁ TIỀN (PRICE ROW) --- */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr.mks-price-row td {
    background: #fffafa !important;
}
.mks-table-price {
    display: inline-block;
    font-weight: 700 !important;
    font-size: 15.5px !important;
    color: #fb3c59 !important; /* Đỏ cam thương hiệu MatKhau.vn */
    letter-spacing: -0.01em;
}

/* --- ZEBRA STRIPING & HOVER --- */
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tbody tr:nth-child(even):not(.mks-table-category):not(.mks-head-row) td:not(:first-child),
body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:nth-child(even):not(.mks-table-category):not(.mks-head-row) td:not(:first-child) {
    background-color: #fcfdfd !important;
}

body table:not(.variations):not(.shop_table):not(.woocommerce-table):not(.woocommerce-checkout-review-order-table):not(#wp-calendar) tr:hover:not(.mks-table-category):not(.mks-head-row) td {
    background-color: #f1f5f9 !important;
    transition: background-color 0.15s ease-in-out;
}

/* --- BIỂU TƯỢNG TÍCH XANH (CHECKMARK ✓) & GẠCH NỐI (–) --- */
.mks-table-check {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    background: #ecfdf5 !important;
    color: #059669 !important;
    font-weight: 700 !important;
    font-size: 13.5px !important;
    border: 1px solid #a7f3d0 !important;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.1) !important;
}

.mks-table-cross {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    background: #fef2f2 !important;
    color: #dc2626 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    border: 1px solid #fecaca !important;
}

.mks-table-dash {
    color: #cbd5e1 !important;
    font-weight: 700 !important;
    font-size: 16px !important;
}

.mks-table-unsupported {
    color: #94a3b8 !important;
    font-size: 13px !important;
}
