/*
 * Trang Thành viên
 * Full-width cover + mobile refinements.
 */

/* Bỏ breadcrumb khỏi giao diện trang Thành viên. */
.container.my-5 > nav[aria-label="breadcrumb"] {
    display: none !important;
}

/* Ảnh bìa full-width giống cách index.php hiển thị hero banner. */
.container.my-5 > .brand-header {
    width: 100vw !important;
    max-width: none !important;
    margin-top: -3rem !important;
    margin-right: calc(50% - 50vw) !important;
    margin-bottom: 2.5rem !important;
    margin-left: calc(50% - 50vw) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
}

.container.my-5 > .brand-header .banner-image {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    object-fit: cover !important;
}

@media (max-width: 767.98px) {
    .member-directory-section {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    /* Section title: keep the orange identity but remove the heavy table-like underline. */
    .member-directory-section h2 {
        margin-bottom: 18px !important;
        padding-bottom: 0 !important;
        border: 0 !important;
        font-size: 1.62rem !important;
        line-height: 1.25 !important;
    }

    .member-directory-section h2::before,
    .member-directory-section h2::after {
        display: none !important;
        content: none !important;
    }

    .member-directory-section .table-responsive {
        overflow: visible !important;
        border: 0 !important;
        background: transparent !important;
    }

    .member-directory-section table {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }

    .member-directory-section thead {
        display: none !important;
    }

    #memberDirectoryBody {
        display: block !important;
        width: 100% !important;
    }

    /* One company = one clean card. */
    #memberDirectoryBody tr {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        margin: 0 0 16px !important;
        padding: 0 14px 14px !important;
        overflow: hidden !important;
        border: 1px solid #e2e8ee !important;
        border-radius: 16px !important;
        background: #ffffff !important;
        box-shadow: 0 5px 18px rgba(17, 24, 39, 0.07) !important;
    }

    /* Bootstrap table-striped uses an inset box shadow; explicitly remove it. */
    #memberDirectoryBody tr > td {
        --bs-table-accent-bg: transparent !important;
        --bs-table-bg: transparent !important;
        display: grid !important;
        grid-template-columns: 118px minmax(0, 1fr) !important;
        align-items: start !important;
        column-gap: 12px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid #edf1f4 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #252b32 !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        line-height: 1.45 !important;
        text-align: left !important;
        white-space: normal !important;
    }

    #memberDirectoryBody tr > td:nth-child(1):not([colspan]) {
        display: none !important;
    }

    /* Company is the visual header of each card. */
    #memberDirectoryBody tr > td:nth-child(3) {
        order: -10 !important;
        display: block !important;
        margin: 0 -14px 2px !important;
        padding: 13px 14px !important;
        border-bottom: 1px solid #e4e9ee !important;
        background: #fbfcfd !important;
    }

    #memberDirectoryBody tr > td:nth-child(2) {
        order: -9 !important;
    }

    #memberDirectoryBody tr > td:nth-child(6) {
        border-bottom: 0 !important;
    }

    #memberDirectoryBody tr > td:nth-child(7) {
        order: 20 !important;
        display: block !important;
        margin-top: 3px !important;
        padding: 13px 0 0 !important;
        border-top: 1px solid #edf1f4 !important;
        border-bottom: 0 !important;
    }

    /* Loading / empty / error rows must remain normal full-width messages. */
    #memberDirectoryBody tr > td[colspan] {
        display: block !important;
        width: 100% !important;
        padding: 24px 10px !important;
        border: 0 !important;
        text-align: center !important;
    }

    /* Labels share one fixed column and one typography scale across all rows. */
    #memberDirectoryBody tr > td:nth-child(2)::before,
    #memberDirectoryBody tr > td:nth-child(4)::before,
    #memberDirectoryBody tr > td:nth-child(5)::before,
    #memberDirectoryBody tr > td:nth-child(6)::before {
        display: block !important;
        width: 118px !important;
        min-width: 118px !important;
        padding: 1px 0 0 !important;
        color: #69727c !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1.45 !important;
        letter-spacing: 0 !important;
        text-transform: uppercase !important;
        white-space: nowrap !important;
    }

    #memberDirectoryBody tr > td:nth-child(2)::before {
        content: 'Người đại diện' !important;
    }

    #memberDirectoryBody tr > td:nth-child(4)::before {
        content: 'Vai trò' !important;
    }

    #memberDirectoryBody tr > td:nth-child(5)::before {
        content: 'Ngành nghề' !important;
    }

    #memberDirectoryBody tr > td:nth-child(6)::before {
        content: 'Nhóm GT' !important;
    }

    .member-list-company {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .member-list-logo {
        width: 54px !important;
        height: 54px !important;
        flex: 0 0 54px !important;
        padding: 4px !important;
        border: 1px solid #e1e6eb !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        object-fit: contain !important;
    }

    .member-list-company-name {
        min-width: 0 !important;
        color: #0d6efd !important;
        font-size: 16px !important;
        font-weight: 800 !important;
        line-height: 1.4 !important;
        word-break: break-word !important;
    }

    .member-list-person {
        min-width: 0 !important;
        gap: 2px !important;
        font-size: 15px !important;
        line-height: 1.45 !important;
    }

    .member-list-person-name {
        color: #252b32 !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        line-height: 1.45 !important;
    }

    .member-list-position {
        margin-top: 2px !important;
        color: #6f7780 !important;
        font-size: 13px !important;
        font-weight: 400 !important;
        line-height: 1.4 !important;
    }

    /* Main CTA: coherent with the green profile modal rather than the legacy red outline. */
    #memberDirectoryBody .member-detail-btn {
        width: 100% !important;
        min-height: 44px !important;
        padding: 0.55rem 0.8rem !important;
        border: 1px solid #168c5b !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        color: #168c5b !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        box-shadow: none !important;
    }

    #memberDirectoryBody .member-detail-btn:hover,
    #memberDirectoryBody .member-detail-btn:focus,
    #memberDirectoryBody .member-detail-btn:active {
        border-color: #117447 !important;
        background: #168c5b !important;
        color: #ffffff !important;
    }

    /* Mobile pagination: balanced and thumb-friendly. */
    .member-directory-section > .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .member-directory-section .pagination-info {
        width: 100% !important;
        color: #737b84 !important;
        font-size: 13px !important;
        text-align: center !important;
    }

    .member-directory-section .pagination-controls {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .member-directory-section .pagination-controls .btn {
        min-height: 42px !important;
        margin: 0 !important;
        padding: 0.45rem 0.55rem !important;
        border-radius: 9px !important;
    }

    #currentPage {
        margin: 0 !important;
        color: #626b75 !important;
        font-size: 13px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 380px) {
    /* Keep the same text grid on very small phones so all values stay on one visual axis. */
    #memberDirectoryBody tr {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    #memberDirectoryBody tr > td {
        grid-template-columns: 118px minmax(0, 1fr) !important;
        column-gap: 8px !important;
    }

    #memberDirectoryBody tr > td:nth-child(3) {
        margin-right: -12px !important;
        margin-left: -12px !important;
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    .member-list-logo {
        width: 50px !important;
        height: 50px !important;
        flex-basis: 50px !important;
    }
}
