/* Shared Bootstrap Table theme overrides */

body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="text"],
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="search"],
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control.search-input,
body.theme-dark .bootstrap-table .fixed-table-toolbar .search input.form-control {
    color: var(--dm-input-text, #ffffff) !important;
    -webkit-text-fill-color: var(--dm-input-text, #ffffff) !important;
    caret-color: var(--dm-input-text, #ffffff) !important;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="text"]::placeholder,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="search"]::placeholder,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control.search-input::placeholder,
body.theme-dark .bootstrap-table .fixed-table-toolbar .search input.form-control::placeholder {
    color: var(--dm-input-placeholder, rgba(255, 255, 255, 0.82)) !important;
    opacity: 1;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="text"]:-webkit-autofill,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="text"]:-webkit-autofill:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="text"]:-webkit-autofill:focus,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="search"]:-webkit-autofill,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="search"]:-webkit-autofill:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control[type="search"]:-webkit-autofill:focus,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control.search-input:-webkit-autofill,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control.search-input:-webkit-autofill:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar input.form-control.search-input:-webkit-autofill:focus,
body.theme-dark .bootstrap-table .fixed-table-toolbar .search input.form-control:-webkit-autofill,
body.theme-dark .bootstrap-table .fixed-table-toolbar .search input.form-control:-webkit-autofill:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar .search input.form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--dm-input-text, #ffffff) !important;
    caret-color: var(--dm-input-text, #ffffff) !important;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar .btn,
body.theme-dark .bootstrap-table .fixed-table-toolbar .btn .page-size-text,
body.theme-dark .bootstrap-table .fixed-table-toolbar .btn i,
body.theme-dark .bootstrap-table .fixed-table-toolbar .btn .fa,
body.theme-dark .bootstrap-table .fixed-table-toolbar .btn .fas,
body.theme-dark .bootstrap-table .fixed-table-toolbar .btn .bi {
    color: var(--dm-toolbar-control-text, var(--dm-text-main, #ecf2f8)) !important;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar .dropdown-menu,
body.theme-dark .bootstrap-table .fixed-table-toolbar .page-size-dropdown .dropdown-menu {
    background: var(--dm-toolbar-menu-bg, var(--dm-bg-surface, #1b2733)) !important;
    border-color: var(--dm-toolbar-menu-border, var(--dm-border, rgba(255, 255, 255, 0.18))) !important;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar .dropdown-menu .dropdown-item,
body.theme-dark .bootstrap-table .fixed-table-toolbar .page-size-dropdown .dropdown-menu .dropdown-item {
    color: var(--dm-toolbar-control-text, var(--dm-text-main, #ecf2f8)) !important;
}

body.theme-dark .bootstrap-table .fixed-table-toolbar .dropdown-menu .dropdown-item:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar .dropdown-menu .dropdown-item:focus,
body.theme-dark .bootstrap-table .fixed-table-toolbar .page-size-dropdown .dropdown-menu .dropdown-item:hover,
body.theme-dark .bootstrap-table .fixed-table-toolbar .page-size-dropdown .dropdown-menu .dropdown-item:focus {
    background: var(--dm-bg-hover, rgba(255, 255, 255, 0.12)) !important;
    color: var(--dm-toolbar-control-text, var(--dm-text-main, #ecf2f8)) !important;
}

/* Table action buttons in dark mode */
body.theme-dark .dm-btn-icon-action.dm-btn-outline {
    background: var(--dm-table-action-edit-bg-dark, var(--dm-bg-surface, #2c3e50)) !important;
    border-color: var(--dm-table-action-edit-border-dark, var(--dm-border, #4a5568)) !important;
    color: var(--dm-table-action-edit-text-dark, var(--dm-text-main, #ecf2f8)) !important;
}

body.theme-dark .dm-btn-icon-action.dm-btn-danger {
    background: var(--dm-table-action-delete-bg-dark, #7f1d1d) !important;
    border-color: var(--dm-table-action-delete-border-dark, #991b1b) !important;
    color: var(--dm-table-action-delete-text-dark, #fecaca) !important;
}

/*
 * ตาราง Bootstrap Table ใน card-body / form: ไม่ซ้อนเงากับการ์ด — ใช้ขอบ inset (--dm-table-inset-border)
 * ครอบคลุมทุก endpoint ที่ใช้ data-bootstrap-table-module (โหลดไฟล์นี้จาก layout ร่วมกับ bootstrap-table.min.css)
 */
.card-body .table-responsive:has(table[data-bootstrap-table-module]),
form .table-responsive:has(table[data-bootstrap-table-module]) {
    box-shadow: none !important;
    border: 1px solid var(--dm-table-inset-border, var(--dm-table-border, var(--dm-border, #dce4ec))) !important;
}

.card-body .bootstrap-table,
form .bootstrap-table {
    box-shadow: none !important;
    border: 1px solid var(--dm-table-inset-border, var(--dm-table-border, var(--dm-border, #dce4ec)));
    border-radius: 8px;
    overflow: hidden;
}

/* ขอบอยู่ที่ .table-responsive แล้ว — อย่าซ้อนขอบซ้ำ */
.card-body .table-responsive > .bootstrap-table,
form .table-responsive > .bootstrap-table {
    border: none !important;
    border-radius: 0;
    overflow: visible;
}

.card-body .bootstrap-table .fixed-table-container,
.card-body .bootstrap-table .fixed-table-toolbar,
.card-body .bootstrap-table .fixed-table-pagination,
form .bootstrap-table .fixed-table-container,
form .bootstrap-table .fixed-table-toolbar,
form .bootstrap-table .fixed-table-pagination {
    box-shadow: none !important;
}
