/* --- ROOT & RESET --- */
.content {
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.wrapper {
    height: 100vh !important;
    overflow: hidden !important;
}

/* --- CONTAINER HALAMAN --- */
.alarm-page-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    padding: 0.5rem;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
    overflow: hidden;
}

/* --- WRAPPER KONTEN --- */
.alarm-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #1b1b1b;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    overflow: hidden;
    min-height: 0;
}

/* ---  AREA ALARM (Header + Tables) --- */
.div-alarm {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #2c2c2c;
    background-color: #1b1b1b;
    padding: 1rem 1rem;
    overflow: hidden;
    min-height: 0;
}

.alarm-history-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alarm-title {
    color: #fff;
    font-family: "Poppins", sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0;
    text-align: left;
}

/* Button Export Excel Style */
.btn-export-excel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: #198754;
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    border: 1px solid #157347;
    transition: background-color 0.2s;
}

.btn-export-excel:hover {
    background-color: #157347;
    color: white;
}

.btn-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: #344eb8;
    color: white !important;
    padding: 5px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    border: 1px solid #4d65c7;
    transition: background-color 0.2s;
    cursor: pointer;
}

.btn-filter:hover {
    background-color: #4d65c7;
    color: white;
}

.btn-filter::placeholder {
    color: white;
}

/* --- TABLE WRAPPERS --- */
/* Main Table & History Table (Flex Grow) */
.main-alarm-table-wrapper,
.history-alarm-table-wrapper {
    flex: 6; /* Flex grow */
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
    border: 1px solid #555;
    background-color: #1b1b1b;
    padding: 0.5rem;
    overflow: hidden;
    min-height: 150px;
}

/* System Table (Flex Basis/Proportion) */
.system-alarm-table-wrapper {
    flex: 4;
    display: flex;
    flex-direction: column;
    border: 1px solid #555;
    background-color: #1b1b1b;
    padding: 0.5rem;
    overflow: hidden;
    min-height: 120px;
}

/* DATATABLES  */

/* Styling Header Controls */
.dt-search label,
.dt-length label {
    margin: 10px;
}

div.dt-container .dt-search input {
    border-radius: 10px !important;
}

/* Wrapper DataTables harus Flex Column */
.main-alarm-table-wrapper .dataTables_wrapper,
.system-alarm-table-wrapper .dataTables_wrapper,
.history-alarm-table-wrapper .dataTables_wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Header Controls (Search, Length)  */
.dt-header-row {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    color: #ccc;
    font-size: 0.9rem;
}

/* Area Scroll Wrapper (Head + Body) */
.dataTables_scroll {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.dataTables_scrollHead {
    flex-shrink: 0;
    background-color: #282929;
}

/* BODY TABEL: INI PERBAIKAN KRUSIALNYA */
.dataTables_scrollBody {
    flex-grow: 1 !important;
    height: 10px !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    background-color: rgb(122, 122, 122);
    border-bottom: 1px solid #555;
}

/* Footer Info & Pagination */
.dt-footer-row {
    flex-shrink: 0;
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- STYLING TABEL --- */
.table-alarm {
    width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 0;
    color: #fff;
    background-color: rgb(122, 122, 122);
}

table.dataTable {
    width: 100% !important;
    margin: 0 !important;
}

table thead th,
td {
    text-align: left !important;
}

.table-alarm thead th {
    background-color: #282929;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #555;
    white-space: nowrap;
}

.table-alarm tbody td {
    font-size: 0.85rem;
    padding: 0.5rem;
    vertical-align: middle;
    border: 1px solid #555;
    white-space: nowrap;
}

.table-alarm tbody tr.table-warning td {
    background-color: #d6b004;
    color: #000;
    font-weight: bold;
}

.table-alarm tbody tr.table-danger-custom td {
    background-color: rgb(77, 4, 4);
    color: #fff;
    font-weight: bold;
}

/* Scrollbar Styling */
.dataTables_scrollBody::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.dataTables_scrollBody::-webkit-scrollbar-track {
    background: #1b1b1b;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 1px solid #222;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Input Controls (Normal Mode / Dark Background) */
.dataTables_length select,
.dataTables_filter input {
    background-color: #3a3a3a;
    color: #fff;
    border: 1px solid #555;
    border-radius: 0.25rem;
    padding: 0.2rem 0.5rem;
    margin: 0 0.5rem;
}

/* Option Color */
.dataTables_length select option,
div.dt-container select.dt-input option {
    background-color: #fff !important;
    color: #3a3a3a !important;
}

/* --- TABS CUSTOMIZATION --- */
.alarm-tabs-container {
    flex-shrink: 0;
    padding-top: 0;
    width: 100%;
}

.alarm-tabs-container .nav-tabs {
    border-bottom: 1px solid #2c2c2c;
}

.alarm-tabs-container .nav-tabs .nav-link,
.alarm-tabs-container .nav-tabs .nav-item.show .nav-link,
.alarm-tabs-container .nav-pills .nav-link {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
    border: 1px solid #2c2c2c !important;
    border-radius: 0.25rem 0.25rem 0 0;
    margin-right: 2px;
}

.alarm-tabs-container .nav-tabs .nav-link:hover {
    background-color: #3a3a3a !important;
    border-color: #2c2c2c !important;
}

.alarm-tabs-container .nav-tabs .nav-link.active {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
    border-color: #2c2c2c !important;
    border-bottom-color: #2c2c2c !important;
    font-weight: bold;
}

/* Tabs Footer */
.alarm-footer-tabs {
    display: flex;
    flex-shrink: 0;
}

.alarm-tab-item {
    padding: 0.75rem 1.5rem;
    color: #ccc;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    border: 2px solid #505050;
}

.alarm-tab-item.active {
    background-color: #505050;
    color: #fff;
}

.alarm-tab-item:hover {
    background-color: #3a3a3a;
    color: #fff;
}

.alarm-tab-item.active:hover {
    background-color: #3f3f3f;
}

/* DATA-THEME="DARK" (White Mode / Light Theme) */
/* Wrapper & Header Title */
[data-theme="dark"] .alarm-content-wrapper {
    background-color: #ffffff;
    color: #222;
    border: 1px solid #ddd;
}
[data-theme="dark"] .alarm-title {
    color: #000000;
}

/* Div Alarm (Inner Container) */
[data-theme="dark"] .div-alarm {
    background-color: #ffffff;
    border-color: #ccc;
    color: #222;
}

/* Table Wrappers Background */
[data-theme="dark"] .main-alarm-table-wrapper,
[data-theme="dark"] .system-alarm-table-wrapper,
[data-theme="dark"] .history-alarm-table-wrapper {
    background: #ffffff;
    border-color: #ccc;
}

/* Header Controls Text (Entries per page, Search Label) */
[data-theme="dark"] .dt-header-row {
    color: #333 !important;
}

/* Input Fields & Selects*/
[data-theme="dark"] .dataTables_length select,
[data-theme="dark"] .dataTables_filter input {
    background-color: #fff;
    color: #222;
    border: 1px solid #aaa;
}

/* Dropdown Options */
[data-theme="dark"] .dataTables_length select option,
[data-theme="dark"] div.dt-container select.dt-input option {
    background-color: #fff !important;
    color: #222 !important;
}

/* Tabel Body & Header */
[data-theme="dark"] .table-alarm {
    color: #222;
    background-color: #fdfdfd;
    --bs-table-border-color: #ddd;
}
[data-theme="dark"] .table-alarm thead th {
    background-color: #424242;
    color: #ffffff;
}

/* Footer Tabs */
[data-theme="dark"] .alarm-footer-tabs {
    border-color: #ffffff;
    color: #222;
}
[data-theme="dark"] .alarm-tab-item {
    color: #000000;
    border-color: #838383;
}
[data-theme="dark"] .alarm-tab-item.active {
    background-color: #505050;
    color: #fff;
}
[data-theme="dark"] .alarm-tab-item:hover {
    background-color: #3a3a3a;
    color: #fff;
}

/* DataTables Info Text (Showing 1 to 10...)  */
[data-theme="dark"] .dataTables_info {
    color: #333 !important;
}

/* SVG Arrow pada Select (Agar panahnya gelap/hitam) */
[data-theme="dark"] .dataTables_length select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Pagination Buttons */
[data-theme="dark"] .dataTables_paginate .paginate_button {
    background-color: #f0f0f0;
    color: #333 !important;
    border-color: #ddd;
}
[data-theme="dark"] .dataTables_paginate .paginate_button:hover {
    background-color: #e9e9e9;
    color: #111 !important;
    border-color: #ccc;
}
[data-theme="dark"] .dataTables_paginate .paginate_button.current {
    background-color: #0d6efd;
    color: #fff !important;
    border-color: #0d6efd;
}
[data-theme="dark"] .dataTables_paginate .paginate_button.disabled {
    background-color: #f9f9f9;
    color: #bbb !important;
    border-color: #ddd;
}

.date-input-wrapper {
    position: relative;
    display: inline-block;
}

.date-input-wrapper .bi-calendar3 {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    pointer-events: none; /* so it doesn't block clicks */
}

.date-input-wrapper input {
    padding-left: 32px;
    width: 218px;
}

@media (min-width: 564px) {
    .daterangepicker {
        width: 31rem;
    }
}

.daterangepicker {
    top: 9.1rem;
    left: 84.4rem;
}

.daterangepicker.opensright:after,
.daterangepicker.opensright:before {
    left: 188px;
}
