/* Tùy chỉnh thanh cuộn cho toàn bộ trang (áp dụng cho body và html) */
body, html {
    scrollbar-width: thin; /* Đặt độ rộng mỏng cho thanh cuộn (dành cho Firefox) */
    scrollbar-color: rgba(0, 0, 0, 0.35) transparent; /* Màu thanh cuộn và nền, tự động điều chỉnh theo theme */
}


table tr:hover {
    background-color: rgba(143, 143, 143, 0.13);
    transition: background-color 0.2s ease-in-out;
}

table td{
    padding: 5px 8px !important;
}

/* Tùy chỉnh thanh cuộn cho các trình duyệt Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px; /* Độ rộng của thanh cuộn */
    height: 8px; /* Độ cao của thanh cuộn ngang nếu có */
}

::-webkit-scrollbar-track {
    background: transparent; /* Đặt nền của đường ray thanh cuộn trong suốt */
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.35); /* Màu của thanh cuộn với độ trong suốt 20% */
    border-radius: 4px; /* Bo tròn các góc của thanh cuộn */
}

/* Tùy chọn: Thêm hiệu ứng khi hover lên thanh cuộn */
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.35); /* Tăng độ đậm khi hover để dễ nhìn hơn */
}



.logo-text {
    --bs-text-opacity: 1;
    color: #ffffff !important;
}

.sidebar-area {
    background-color: #AD63F6; /* #ff0083 */
}

.menu-vertical .menu-item .menu-link {
    color: #fff;
}

.menu-vertical .menu-item .menu-link:hover {
    color: #000; /* Màu chữ khi hover */
    background-color: #b97af7; /* #ff3b9f */
}

.menu-vertical .menu-item .menu-link .menu-icon {
    color: #fff;
}

.menu-vertical .menu-item.open .menu-link.active .menu-icon {
    color: #ffffff;
}

.menu-vertical .menu-item.open .menu-link.active .title {
    color: rgb(0, 0, 0);
}

.menu-vertical .menu-sub .menu-item .menu-link.active {
    color: #505050;
}

.menu-vertical .menu-item.open .menu-link.active {
    border: 1px solid white;
    background-color: #f6f7f930 !important;
}

.menu-vertical .menu-title .menu-title-text {
    color: rgb(219 183 255);
}


.menu-vertical .menu-sub .menu-item .menu-link.active {
    color: #000000;
}

.form-control {
    border: 1px solid #ad63f6 !important;
}

[data-theme=dark] .form-control {
    border-color: #395cad !important;
}




/******************************* Role style ********************************/


.accordion-item {
    border: 1px solid;
    margin: 0px;
}

[data-theme=dark] td {
    background: #fefdfd00 !important;
    color: #ffffffa6 !important;
}

[data-theme=dark] th {
    background: #fefdfd00 !important;
    color: #ffffffa6 !important;
}

[data-theme=dark] button.accordion-button {
    color: #ffffffa6 !important;
}

[data-theme=dark] h2.accordion-header.d-flex.align-items-center {
    background: #15203c;
}

.main-role-setting {
    background-color: white;
}

[data-theme=dark] .main-role-setting {
    background-color: #0c1427;
}

.permission-controller-action {
    overflow: auto;
    height: 500px;
}

.col-lg-12.row {
    border: 1px solid;
    margin: 1px;
    border-radius: 5px;
}

button.btn.btn-sm.btn-outline-secondary.ms-auto.toggle-all {
    width: 100px;
    margin: 10px;
}

/******************************* toast-message ********************************/

.toast-message {
    position: fixed;
    bottom: 80px;
    right: 25px;
    background-color: #f8f9fa;
    color: #212529;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.toast-message.success {
    background-color: #d4edda;
    color: #155724;
}

.toast-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

.toast-message.warning {
    background-color: #fff3cd;
    color: #856404;
}

.toast-message.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.close-toast {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    color: #212529;
    cursor: pointer;
    float: right;
    margin-left: 15px;
}

.textbox-tracking-description {
    background-color: #ededed;
}

/* Base font size - Giảm từ 14px xuống 12px */
html {
    font-size: 12px !important;
}

body {
    font-size: 12px !important;
}

/* Override Bootstrap body font size */
:root {
    --bs-body-font-size: 0.75rem !important; /* 12px */
}

/* Override các phần tử thường dùng có font-size 14px */
.label,
.form-control::placeholder,
.card,
.table,
.btn,
.nav-link,
.breadcrumb,
.badge,
.alert,
.dropdown-item {
    font-size: 12px !important;
}

/* Override các phần tử có font-size 14px trong các component */
.menu-link,
.header-area,
.sidebar-area,
.default-table-area {
    font-size: 12px !important;
}

/* Main Content Container - Max width và căn giữa */
.main-content-container {
    max-width: 1600px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Đảm bảo main-content-container hoạt động trong main-content */
.main-content .main-content-container {
    max-width: 1600px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Đảm bảo footer không bị ảnh hưởng bởi main-content-container */
.footer-area {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    box-sizing: border-box !important;
}

/* Đảm bảo footer rộng tràn toàn bộ container-fluid */
.container-fluid > .footer-area,
.main-content + .footer-area,
footer.footer-area {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
}

/* Đảm bảo container-fluid không bị ảnh hưởng bởi main-content-container */
.container-fluid {
    width: 100% !important;
    max-width: 100% !important;
}

/* Đảm bảo main-content không ảnh hưởng đến footer */
.main-content {
    width: 100% !important;
}

/* Đảm bảo main-content-container chỉ ảnh hưởng đến nội dung bên trong, không ảnh hưởng đến footer */
.main-content-container {
    position: relative !important;
}

/* Đảm bảo footer luôn rộng 100% bất kể main-content-container */
.container-fluid footer.footer-area {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

/* ============================================
   Bỏ border của nút preview content trong playlist detail
   ============================================ */
table.table-hover .btn-outline-primary[title="Preview Content"],
table.table-hover .btn-outline-secondary[title="No content available"],
table.table-hover button[onclick*="previewContentItem"] {
    border: none !important;
}

/* Giảm font-size của h3 xuống 16px */
h3 {
    font-size: 16px !important;
}

/* Giảm icon material-symbols-outlined fs-40 xuống 30px */
.material-symbols-outlined.fs-40 {
    font-size: 30px !important;
}

/* Fix màu icon switch-toggle ở light mode */
/* Light mode: icon cần màu tối để nổi bật trên nền sáng */
[data-theme="light"] .switch-toggle .material-symbols-outlined,
body:not([data-theme]) .switch-toggle .material-symbols-outlined {
    color: #333333 !important;
}

[data-theme="light"] .switch-toggle:hover .material-symbols-outlined,
body:not([data-theme]) .switch-toggle:hover .material-symbols-outlined {
    color: #000000 !important;
}

/* Dark mode: giữ màu sáng như cũ */
[data-theme="dark"] .switch-toggle .material-symbols-outlined {
    color: #ffffff !important;
}

/* Debug: Uncomment để thấy border đỏ (xóa sau khi test xong) */
/* .main-content-container {
    border: 2px solid red !important;
    background-color: rgba(255, 0, 0, 0.1) !important;
} */

/* ============================================
   Điều chỉnh font-size và input cho màn hình create/edit
   ============================================ */

/* Form controls - Giảm font-size và height */
.form-control,
.form-select,
select.form-control {
    font-size: 12px !important;
    height: 38px !important; /* Giảm từ 50px xuống 38px */
    padding: 8px 12px !important; /* Giảm từ 14px 16px xuống 8px 12px */
    line-height: 1.5 !important;
}

/* Textarea - Giảm font-size */
textarea.form-control {
    font-size: 12px !important;
    padding: 8px 12px !important;
    line-height: 1.5 !important;
}

/* Label trong form - Giảm font-size */
.label,
.form-group label,
.form-group .label {
    font-size: 12px !important;
    margin-bottom: 6px !important; /* Giảm khoảng cách dưới label */
}

/* Select2 dropdown - Điều chỉnh font-size */
.select2-container .select2-selection--single {
    font-size: 12px !important;
    height: 38px !important; /* Đồng bộ với form-control */
}

.select2-container .select2-selection--single .select2-selection__rendered {
    font-size: 12px !important;
    line-height: 38px !important;
    padding-left: 12px !important;
    padding-right: 20px !important;
}

.select2-dropdown {
    font-size: 12px !important;
}

.select2-results__option {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

.select2-search__field {
    font-size: 12px !important;
    padding: 6px !important;
}

/* Form group spacing - Giảm khoảng cách giữa các form group */
.form-group {
    margin-bottom: 1rem !important; /* Giảm từ mặc định */
}

/* Input placeholder - Đảm bảo font-size nhỏ */
.form-control::placeholder,
.form-select::placeholder {
    font-size: 12px !important;
    color: #6c757d !important;
}

/* Small text trong form */
.form-text,
small.text-muted {
    font-size: 11px !important;
}

/* Input group - Điều chỉnh cho input group */
.input-group .form-control,
.input-group .form-select {
    font-size: 12px !important;
    height: 38px !important;
}

.input-group-text {
    font-size: 12px !important;
    padding: 8px 12px !important;
}

/* Checkbox và Radio - Điều chỉnh font-size của label */
.form-check-label,
.form-check-input + label {
    font-size: 12px !important;
}

/* Date picker và time input */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
    font-size: 12px !important;
    height: 38px !important;
    padding: 8px 12px !important;
}

/* File input */
input[type="file"].form-control {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

/* Number input */
input[type="number"].form-control {
    font-size: 12px !important;
    height: 38px !important;
    padding: 8px 12px !important;
}

/* ============================================
   Điều chỉnh icon trong input của form create content
   ============================================ */

/* Giảm padding-left của input có icon - từ ps-5 (48px) xuống 32px */
.form-control.ps-5,
input.form-control.ps-5,
select.form-control.ps-5,
textarea.form-control.ps-5 {
    padding-left: 32px !important; /* Giảm từ 48px (ps-5) xuống 32px */
}

/* Điều chỉnh icon trong input - Giảm font-size và loại bỏ padding không cần thiết */
.form-group.position-relative i.position-absolute {
    font-size: 16px !important; /* Giảm từ 20px (fs-20) xuống 16px */
    padding-left: 0 !important; /* Loại bỏ ps-20 */
    left: 10px !important; /* Đặt icon cách trái 10px */
    z-index: 1 !important;
}

/* Icon trong input text/select - Căn giữa theo chiều dọc */
.form-group.position-relative i.position-absolute.top-50 {
    transform: translateY(-50%) !important;
}

/* Icon trong textarea - Căn trên cùng */
.form-group.position-relative i.position-absolute.top-0 {
    top: 10px !important; /* Điều chỉnh từ pt-2 (8px) lên 10px */
    padding-top: 0 !important; /* Loại bỏ pt-2 */
}

/* Đảm bảo icon không bị che bởi text */
.form-control:focus + i,
.form-control + i {
    pointer-events: none !important; /* Icon không chặn click vào input */
}

/* Điều chỉnh màu icon cho dark mode */
[data-theme="dark"] .form-group.position-relative i.position-absolute {
    color: #adb5bd !important;
}

/* Điều chỉnh màu icon cho light mode */
[data-theme="light"] .form-group.position-relative i.position-absolute,
body:not([data-theme]) .form-group.position-relative i.position-absolute {
    color: #6c757d !important;
}

/* ============================================
   Điều chỉnh search input trong table-src-form
   ============================================ */

/* Search form trong listing pages */
.table-src-form {
    position: relative;
    width: 100%;
    min-width: 200px;
}

.table-src-form .form-control {
    padding-left: 32px !important; /* Tạo khoảng trống cho icon search */
    font-size: 12px !important;
    height: 38px !important;
    padding-right: 12px !important;
}

/* Icon search trong table-src-form */
.table-src-form .material-symbols-outlined,
.table-src-form i.position-absolute {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 18px !important;
    color: #6c757d !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Dark mode cho icon search */
[data-theme="dark"] .table-src-form .material-symbols-outlined,
[data-theme="dark"] .table-src-form i.position-absolute {
    color: #adb5bd !important;
}

/* Light mode cho icon search */
[data-theme="light"] .table-src-form .material-symbols-outlined,
[data-theme="light"] .table-src-form i.position-absolute,
body:not([data-theme]) .table-src-form .material-symbols-outlined,
body:not([data-theme]) .table-src-form i.position-absolute {
    color: #6c757d !important;
}

/* ============================================
   Điều chỉnh riêng cho màn hình Screen listing
   ============================================ */

/* Search form trong screen listing - có button submit bên phải */
.table-src-form.flex-grow-1 {
    position: relative;
    min-width: 200px;
    flex: 1 1 auto;
    min-width: 0; /* Cho phép shrink khi cần */
    max-width: 100%;
}

.table-src-form.flex-grow-1 .form-control {
    padding-left: 12px !important; /* Không có icon bên trái, chỉ cần padding cơ bản */
    padding-right: 40px !important; /* Khoảng trống cho button search bên phải */
    font-size: 12px !important;
    height: 38px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Button search submit trong screen listing */
.table-src-form.flex-grow-1 .btn-link.position-absolute {
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    padding: 4px 6px !important;
    width: auto !important;
    height: auto !important;
    min-width: 30px !important;
    z-index: 2 !important;
    margin: 0 !important;
}

.table-src-form.flex-grow-1 .btn-link.position-absolute .material-symbols-outlined {
    font-size: 18px !important;
    color: #6c757d !important;
    display: block !important;
    line-height: 1 !important;
}

[data-theme="dark"] .table-src-form.flex-grow-1 .btn-link.position-absolute .material-symbols-outlined {
    color: #adb5bd !important;
}

.table-src-form.flex-grow-1 .btn-link.position-absolute:hover .material-symbols-outlined {
    color: #667eea !important;
}

/* Nút Bulk Search - đồng bộ height với input search */
button.btn-outline-primary.btn-sm[onclick*="showBulkSearchModal"],
button[onclick*="showBulkSearchModal"].btn-outline-primary {
    height: 38px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

/* Đảm bảo flex container không bị overflow và căn chỉnh đúng */
.d-flex.gap-2.align-items-center {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px !important;
}

/* Đảm bảo search form không overflow */
.table-src-form.flex-grow-1 {
    overflow: visible !important;
}

/* ============================================
   Style cho playlist detail - 3 box cùng hàng
   ============================================ */
/* Đảm bảo các card trong cùng row có cùng chiều cao */
.row.align-items-stretch {
    align-items: stretch !important;
}

.row.align-items-stretch > [class*="col-"] {
    display: flex !important;
    flex-direction: column !important;
}

.row.align-items-stretch > [class*="col-"] > .card {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

.row.align-items-stretch > [class*="col-"] > .card > .card-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Đảm bảo col-md-4 có flex column để 2 card bên trong căn chỉnh */
.row.align-items-stretch .col-md-4.d-flex {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

.row.align-items-stretch .col-md-4.d-flex > .card {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* ============================================
   Style cho search và Add New button cùng hàng
   ============================================ */
/* Đảm bảo search form và button cùng hàng */
.d-flex.justify-content-between.align-items-center .table-src-form.me-auto {
    flex: 1 1 auto !important;
    min-width: 200px !important;
    max-width: 100% !important;
    margin-right: 1rem !important;
}

.d-flex.justify-content-between.align-items-center .table-src-form.me-auto + a,
.d-flex.justify-content-between.align-items-center .table-src-form.me-auto + div,
.d-flex.justify-content-between.align-items-center .table-src-form.me-auto ~ a,
.d-flex.justify-content-between.align-items-center .table-src-form.me-auto ~ div {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Đảm bảo không wrap trên desktop */
@media (min-width: 768px) {
    .d-flex.justify-content-between.align-items-center.flex-wrap {
        flex-wrap: nowrap !important;
    }
    
    .d-flex.justify-content-between.align-items-center .table-src-form.me-auto {
        max-width: calc(100% - 250px) !important;
    }
}

/* Trên mobile vẫn cho phép wrap */
@media (max-width: 767px) {
    .d-flex.justify-content-between.align-items-center.flex-wrap {
        flex-wrap: wrap !important;
    }
    
    .d-flex.justify-content-between.align-items-center .table-src-form.me-auto {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 0.5rem !important;
    }
}
