/* ── Bar (top: search + category + fav) ── */
.bam-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.bam-bar--top {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.bam-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.bam-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.45;
    pointer-events: none;
}

.bam-search-input {
    width: 100%;
    padding: 14px 20px 14px 48px !important;
    font-size: 16px;
    line-height: 1.4;
    color: #1d2327;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 30px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bam-search-input::placeholder {
    color: #9ca3af;
}

.bam-search-input:hover {
    border-color: #d1d5db;
}

.bam-search-input:focus {
    outline: 0;
    border-color: var(--blue-color) !important;
    box-shadow: 0 0 0 4px rgba(14, 77, 164, 0.12);
    border-style: solid !important;
    outline: none !important;
}

.bam-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Searchable category dropdown ── */
.bam-category-wrap {
    position: relative;
}

.bam-category-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    background: var(--blue-color);
    border: 1px solid var(--blue-color);
    border-radius: 30px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-width: 300px;
    text-align: left;
    justify-content: space-between;
}

.bam-category-chevron {
    display: inline-block;
    width: 10px;
    height: 10px;
    font-size: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0.9;
    transition: transform 0.2s;
}

.bam-category-wrap.open .bam-category-chevron {
    transform: rotate(-180deg);
}

.bam-category-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    width: 100%;
    min-width: 240px;
    max-height: 280px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bam-category-dropdown[hidden] {
    display: none !important;
}

.bam-category-search {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 14px;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
}

.bam-category-search:focus {
    outline: 0;
}

.bam-category-list {
    overflow-y: auto;
    padding: 6px 0;
    max-height: 220px;
}

.bam-category-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 18px;
    font-size: 14px;
    color: var(--ast-global-color-3);
    cursor: pointer;
    transition: background 0.15s;
}

.bam-category-option:hover {
    background: #f3f4f6;
}

.bam-category-option:first-child {
    font-weight: 600;
    color: #0E4DA4;
}

.bam-category-option-label {
    flex: 1;
    min-width: 0;
}

.bam-category-pdf-dl {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--blue-color);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.bam-category-pdf-dl .bam-category-pdf-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.bam-category-pdf-dl:hover,
.bam-category-pdf-dl:focus {
    background: rgba(33, 88, 167, 0.12);
    color: var(--blue-color);
}

/* ── Favorites button in bar ── */
.bam-fav-wrap .bam-btn-fav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 170px;
}

.bam-btn-fav-icon {
    font-size: 16px;
}

/* ── Table wrapper ── */
.bam-table-wrap {
    margin-bottom: 16px;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

/* ── Bottom bar (summary + pagination) ── */
.bam-bar--bottom {
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px 4px;
    flex-wrap: wrap;
    gap: 12px;
}

.bam-bar-bottom-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.bam-per-page-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 16px;
    /* margin-right: 16px; */
    border-right: 1px solid #e5e7eb;
}

.bam-per-page-label,
.bam-per-page-suffix {
    font-size: 13px;
    color: #6b7280;
}

.bam-per-page-select {
    padding: 6px 32px 6px 14px;
    font-size: 14px;
    color: var(--ast-global-color-3);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 10px;
    border: 1px solid #e5e7eb;
    border-radius: var(--cc-btn-radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.bam-summary-wrap {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: gray;
    /* background: linear-gradient(135deg, #0E4DA4 0%, #0a3d84 100%); */
    /* border-radius: 12px; */
    /* box-shadow: 0 2px 8px rgba(14, 77, 164, 0.25); */
}

.bam-summary {
    font-size: 14px;
    /* font-weight: 600; */
    color: #6b7280;
    letter-spacing: 0.02em;
}

.bam-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bam-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ast-global-color-3);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--cc-btn-radius);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}


.bam-page-btn.disabled:hover {
    background: #fff;
    border-color: #e5e7eb;
    color: var(--ast-global-color-3);
}

.bam-page-btn:hover:not(.disabled):not(.active) {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--ast-global-color-3);
}

.bam-page-btn.active {
    background: #0E4DA4;
    border-color: #0E4DA4;
    color: #fff;
    cursor: default;
}

.bam-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bam-page-nums {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bam-page-ellipsis {
    padding: 0 4px;
    font-size: 14px;
    color: #9ca3af;
}

/* ── Buttons ── */
.bam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 17px;
    font-size: 14px;
    font-weight: 500;
    /* line-height: 1.4; */
    border: 1px solid var(--blue-color);
    border-radius: 30px;
    background: var(--blue-color);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.bam-btn-sm {
    padding: 10px 12px;
    font-size: 13px;
}

.bam-btn-outline {
    /* background: var(--blue-color); */
    /* color: #fff; */
    /* border-color: 1px solid var(--blue-color); */
}

.bam-btn:hover,
.bam-btn-outline:hover,
.bam-btn-outline.active,
.bam-category-trigger:hover {
    background: var(--hover-blue);
    color: #fff;
}

/* ── Select ── */
.bam-select {
    padding: 7px 12px;
    font-size: 14px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #fff;
    min-width: 180px;
}

/* ── Table ── */
.bam-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

/* No inner vertical borders; only row dividers and outer border */
.bam-table-wrap .bam-table thead th,
.bam-table-wrap .bam-table tbody td {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.bam-table-wrap .bam-table thead th {
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    background: #fafafa;
    text-align: justify;
}

.bam-table-wrap .bam-table thead th:first-child {
    border-radius: 12px 0 0 0;
}

.bam-table-wrap .bam-table thead th:last-child {
    border-radius: 0 12px 0 0;
}

.bam-table-wrap .bam-table tbody tr {
    transition: background 0.15s;
}

.bam-table-wrap .bam-table tbody tr:hover {
    background: #f8fafc;
}

.bam-table-wrap .bam-table tbody tr:last-child td {
    border-bottom: none;
}

.bam-table-wrap .bam-table tbody td {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--ast-global-color-3);
    background: #fff;
}

.bam-table-wrap .bam-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 12px;
}

.bam-table-wrap .bam-table tbody tr:last-child td:last-child {
    border-radius: 0 0 12px 0;
}

/* DataTables overrides: remove any default borders */
.bam-table-wrap .dataTables_wrapper .dataTables_scroll .dataTables_scrollBody .bam-table,
.bam-table-wrap .dataTables_wrapper .bam-table {
    border: none;
}

.bam-table-wrap .dataTables_wrapper .bam-table th,
.bam-table-wrap .dataTables_wrapper .bam-table td {
    border-left: none !important;
    border-right: none !important;
}

.bam-col-fav {
    text-align: center;
}

.bam-col-fav {
    width: 50px;
}
.bam-col-details {
    width: 120px;
}

/* ── Favourite button ── */
.bam-fav-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.2s;
}

.bam-fav-btn:hover,
.bam-fav-btn.active {
    color: #f0ad4e;
    background: transparent;
}

.bam-fav-btn:not(.active):focus,
.bam-fav-btn:not(.active):focus-visible {
    background-color: transparent;
    border-color: transparent;   
    color: #999;
}

/* ── Modal ── */
.bam-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

.bam-modal.open {
    display: flex;
}

.bam-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.bam-modal-container {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 1140px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    animation: bamModalIn 0.2s ease-out;
    overflow: hidden;
}

@keyframes bamModalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bam-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--blue-color);
    color: #fff;
}

.bam-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.bam-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #fff;
    opacity: 0.8;
    padding: 0 4px;
    line-height: 1;
}

.bam-modal-close:hover {
    opacity: 1;
    background-color: unset;
}

.bam-modal-body {
    padding: 24px;
    overflow-y: auto;
    line-height: 1.6;
}

body.bam-modal-open {
    overflow: hidden;
}

/* ── Modal Detail Layout ── */
.bam-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chips row (code + categories) */
.bam-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bam-chip {
    display: inline-block;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 500;
    background: #f0f0f1;
    color: #50575e;
    border-radius: 20px;
}

.bam-chip-code {
    background: var(--blue-color);
    color: #fff;
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Status badges row */
.bam-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bam-badge {
    position: relative;
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f6f7f7;
    overflow: visible;
    border: 1px solid #e0e0e0;
}

.bam-badge-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #787c82;
    margin-bottom: 4px;
}

.bam-badge-value {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.bam-badge-green {
    background: #edfaef;
    border-color: #b8e6be;
}

.bam-badge-green .bam-badge-value {
    color: #00713a;
}

.bam-badge-amber {
    background: #fef8ee;
    border-color: #f0d5a0;
}

.bam-badge-amber .bam-badge-value {
    color: #8a6a0a;
}

.bam-badge-red {
    background: #fef2f2;
    border-color: #f0b8b8;
}

.bam-badge-red .bam-badge-value {
    color: #a41e1e;
}

/* Tooltips */
.bam-tooltip-wrap {
    display: inline-block;
    vertical-align: middle;
    cursor: help;
    margin-left: 0.35em;
}

.bam-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    color: var(--blue-color);
    border: 1.5px solid var(--blue-color);
    border-radius: 50%;
    background: #fff;
}

/* Global tooltip (rendered on body to avoid modal clipping) */
.bam-global-tooltip {
    position: fixed;
    z-index: 100002;
    max-width: 350px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    text-transform: none;
    letter-spacing: 0;
    color: #fff;
    background: #1d2327;
    border-radius: 6px;
    white-space: pre-line;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s, visibility 0.15s;
}

.bam-global-tooltip.visible {
    visibility: visible;
    opacity: 1;
}

.bam-global-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1d2327;
}

/* Section cards */
.bam-detail-section {
    background: #fafafa;
    border: 1px solid #ebebeb;
    border-radius: 8px;
    padding: 16px 20px;
}

.bam-detail-heading {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--blue-color);
}

.bam-detail-body {
    font-size: 14px;
    color: #3c434a;
    line-height: 1.7;
}

/* Definition list rows */
.bam-detail-dl {
    margin: 0;
    padding: 0;
}

.bam-detail-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.bam-detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bam-detail-row:first-child {
    padding-top: 0;
}

.bam-detail-row dt {
    flex: 0 0 42%;
    font-size: 13px;
    font-weight: 600;
    color: #50575e;
}

.bam-detail-row dd {
    flex: 1;
    margin: 0;
    font-size: 14px;
    color: #1d2327;
    line-height: 1.5;
}

/* Collapsible classification */
.bam-detail-collapse {
    border: 1px solid #ebebeb;
    border-radius: 8px;
    overflow: hidden;
}

.bam-detail-summary {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #50575e;
    cursor: pointer;
    background: #fafafa;
    list-style: none;
    user-select: none;
}

.bam-detail-summary::-webkit-details-marker {
    display: none;
}

.bam-detail-summary::before {
    content: '+ ';
    font-weight: 400;
}

.bam-detail-collapse[open] .bam-detail-summary::before {
    content: '- ';
}

.bam-detail-collapse .bam-detail-dl {
    padding: 4px 20px 16px;
}

/* ── Toast ── */
.bam-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 100001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.bam-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media screen and (max-width: 768px) {
    .bam-bar--top {
        flex-direction: column;
        align-items: stretch;
    }

    .bam-search-wrap {
        min-width: 0;
    }

    .bam-category-trigger {
        min-width: 0;
        width: 100%;
    }

    .bam-bar--bottom {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .bam-bar-bottom-left {
        flex-direction: column;
        gap: 12px;
    }

    .bam-per-page-group {
        padding-right: 0;
        margin-right: 0;
        border-right: none;
        justify-content: center;
    }

    .bam-modal-container {
        width: 95%;
        max-height: 90vh;
    }

    .bam-detail-badges {
        flex-direction: column;
    }

    .bam-badge {
        min-width: 0;
    }

    .bam-detail-row {
        flex-direction: column;
        gap: 2px;
    }

    .bam-detail-row dt {
        flex: none;
    }

    .bam-col-fav,
    .bam-col-details {
        width: 60px;
    }
}