/* ===== Scroll & Wrapper ===== */
.dataTables_wrapper .dataTables_scrollBody {
    max-height: 45vh !important;
    overflow: auto !important;
}

/* ให้โชว์เฉพาะ thead ที่อยู่ใน scrollHead */
.dataTables_wrapper .dataTables_scrollHead thead {
    display: table-header-group !important;
    visibility: visible !important;
}


.dashboard-header {
    height: auto !important;
}

.dashboard-content .sc-data-summary .sc-body .sc-table {
    overflow: visible !important;
}

/* ===== Table ===== */
#energyTable {
    border-collapse: separate;
    border-spacing: 0;
    width: 100% !important;
    table-layout: auto;
    /* ปรับอัตโนมัติ */
    white-space: nowrap;
    /* ไม่ให้บรรทัดตัด */
}

/* ===== Table Head ===== */
.dt-container .dt-scroll-head thead th {
    background: #dc0021 !important;
    /* สีแดง NSK */
    color: #fff !important;
    font-weight: 600;
    text-transform: none;
    border: 0 !important;
    padding: 10px 12px;
    text-align: center;
}

/* ===== Table Body ===== */
#energyTable tbody td {
    padding: 0px 12px;
    background: #ffffff;
    border-color: #eee !important;
}

#energyTable tbody tr:nth-child(even) td {
    background: #f9f9f9;
}

#energyTable tbody tr:hover td {
    background: #fff3f5 !important;
}

#energyTable td.text-center {
    text-align: center;
}

/* ===== Paging ===== */
.dt-container .dt-paging {
    display: flex;
    justify-content: center;
    gap: 6px;
    /* margin-top: 10px; */
}

.dt-container .dt-paging button.dt-paging-button {
    background: #fff;
    color: #dc0021;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    min-width: 34px;
    height: 34px;
    line-height: 32px;
    font-weight: 600;
    transition: all .15s ease;
}

.dt-container .dt-paging button.dt-paging-button:hover:not(.disabled):not(.current) {
    background: #ffe6ea;
    border-color: #ffc7d0;
}

.dt-container .dt-paging button.current {
    background: #dc0021 !important;
    color: #fff !important;
    border-color: #dc0021 !important;
}

.dt-container .dt-paging button.disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ===== Info Text ===== */
.dt-container .dt-info {
    color: #6c757d;
    padding: 6px 0 0 2px;
    font-size: .95rem;
}

/* ===== Card Style ===== */
.sc-table {
    background: #fff;
    /* border-radius: 12px; */
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    padding: 6px 8px;
}

.dt-container .dt-scroll-head,
.dt-container .dt-scroll-body {
    background: #fff !important;
}

/* ===== Column Header Align ===== */
.dt-column-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dt-column-header .dt-column-title {
    font-weight: 600;
    white-space: nowrap;
}

.dt-column-header .dt-column-order {
    font-size: 0.8em;
    opacity: 0.6;
    cursor: pointer;
}

th.dt-ordering-asc .dt-column-order::after {
    content: "▲";
    font-size: 0.7em;
}

th.dt-ordering-desc .dt-column-order::after {
    content: "▼";
    font-size: 0.7em;
}

#energyTable {
    table-layout: fixed !important;
    width: 100% !important;
    white-space: nowrap;
}

#energyTable th:first-child,
#energyTable td:first-child {
    width: 160px !important;
    max-width: 160px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CSS - namespace ด้วย ns- */
.ns-date-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 250px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;

}

.ns-date-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ns-date-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 50px;
    background: #fff;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease-in-out;
    outline: none;
    cursor: pointer;
    min-height: 55px;
    height: 55px;
}

/* Hover effect */
.ns-date-input:hover {
    border-color: #dc0021;
    /* สีแดง NSK */
    box-shadow: 0 0 4px rgba(220, 0, 33, 0.25);
}

/* Focus effect */
.ns-date-input:focus {
    border-color: #dc0021;
    box-shadow: 0 0 6px rgba(220, 0, 33, 0.4);
}

/* สำหรับ Browser ที่รองรับ calendar picker */
.ns-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(28%) sepia(95%) saturate(3185%) hue-rotate(337deg) brightness(90%) contrast(97%);
}

.ns-cardmenu {
    padding: 10px;
}

.ns-power-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 👈 เพิ่มระยะห่างระหว่างการ์ด */
    padding: 20px;
    /* 👈 padding รอบทั้งหมด */
}

.ns-power-card {
    display: flex;
    align-items: center;
    gap: 14px;
    /* 👈 ระยะห่างระหว่าง icon กับ text */
    background: #fff;
    border-radius: 14px;
    padding: 16px 20px;
    /* 👈 เพิ่ม padding ข้างในให้กว้างขึ้น */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.ns-power-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.ns-power-icon {
    width: 40px;
    /* 👈 ใหญ่ขึ้นนิด */
    height: 40px;
    object-fit: contain;
}

.ns-power-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ns-tabfilter {
    display: flex;
    width: 100%;
    background: #f2f2f2;
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
    min-height: 55px;
    height: 55px;
}

.ns-tab {
    flex: 1;
    /* 👈 ให้แต่ละปุ่มกินพื้นที่เท่าๆ กัน */
    border: none;
    background: transparent;
    padding: 10px 0;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ns-tab.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#energyTable thead {
    display: none;
}

.bgcardmenu {
    background-color: #fff !important;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    padding: 10px !important;
    margin-bottom: 15px !important;
}

.row.--row-dashboard-inner {

    /* margin-left: 0px !important; */
    /* padding: 15px !important; */
}

#energyChart {
    min-height: 450px;
}

@media (max-width: 991px) {
    .dashboard-content .sc-data-summary .sc-body .sc-table table td {
        display: table-cell !important;
    }
}

@media (max-width: 991px) {
    .dashboard-content .sc-data-summary .sc-body .sc-table table tr {
        display: table-row !important;
    }
}