﻿/* Bổ sung hiệu ứng và highlight cho tree */
#irrigationTree .permission-item {
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 4px;
    min-height: 32px;
}

    #irrigationTree .permission-item:hover {
        background: #e3f2fd;
    }

#irrigationTree .expand-icon {
    margin-right: 8px;
}

#irrigationTree .permission-tree ul {
    padding-left: 0;
}

#irrigationTree .children-container {
    transition: max-height 0.25s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    max-height: 1000px;
}

    #irrigationTree .children-container.children-hidden {
        max-height: 0;
        padding: 0;
        margin: 0;
    }

#irrigationTree .expand-icon {
    transition: transform 0.2s;
}

    #irrigationTree .expand-icon.collapsed {
        transform: rotate(-90deg);
    }

#irrigationTree .children-container > ul {
    padding-left: 24px;
}

#irrigationTree .permission-tree ul > li {
    margin-bottom: 4px;
}

#irrigationTree .tree-item-content {
    line-height: 1.6;
}

#irrigationTree .permission-item.row-focused,
#irrigationTree .permission-item:hover {
    background: #e3f2fd !important;
    border: 1.5px solid #2196F3 !important;
    box-shadow: 0 2px 8px rgba(33,150,243,0.10);
    z-index: 1;
}

#QuanTracContainer {
    margin-top: -10px;
    margin-bottom: 0;
    margin-left: -15px;
    margin-right: -15px;
    height: calc(100vh - 230px);
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

    #QuanTracContainer::-webkit-scrollbar {
        width: 8px;
    }

    #QuanTracContainer::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    #QuanTracContainer::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

        #QuanTracContainer::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

#irrigationTree {
    flex: 1;
    min-height: 0;
}

#treeSearchInput {
    margin-bottom: 14px;
    margin-top: 6px;
    padding-right: 80px;
}

#treeSearchClear {
    position: absolute;
    right: 36px;
    top: 45%;
    transform: translateY(-50%);
    color: #888;
    font-size: 18px;
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: none;
    cursor: pointer;
}

    #treeSearchClear:hover {
        color: #555;
    }

#QuanTracContainer .fa-search {
    position: absolute;
    right: 10px;
    top: 45%;
    transform: translateY(-50%);
    color: #888;
    font-size: 18px;
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 1;
    pointer-events: none;
}

#QuanTracContainer .search-box {
    position: relative;
}

.permission-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    padding-top: 0;
    border-radius: 8px;
    min-height: 0;
}

.permission-panel-content {
    flex: 1;
    min-height: 0;
    padding-top: 0;
    display: flex;
    flex-direction: column;
}

.card-body, .col-md-9, .row {
    overflow-x: auto !important;
    min-width: 0 !important;
}
/* Xóa ép min-width grid để Handsontable tự xử lý cuộn */

#idKhiTuong {
    height: 65vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/*    #rainStationsGrid {
        height: 100%;
        width: 100%;
        overflow: auto;
    }*/

#rainStationsGrid .ht_master {
    overflow: auto !important;
}

#rainStationsGrid .htCore {
    overflow: auto !important;
}

#rainStationsGrid {
    height: 400px !important;
    overflow: auto !important;
}

    #rainStationsGrid .handsontable {
        overflow: visible !;
    }

/* CSS cho tabs đẹp - Sửa để không xuống dòng */
#quanTracTabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    width: 100%;
}

#quanTracTabs .nav-item {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    margin: 0;
    padding: 0;
}

#quanTracTabs .nav-link {
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 12px 8px;
    font-weight: 500;
    color: #6c757d;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-right: 1px solid #dee2e6;
    width: 100%;
    box-sizing: border-box;
}

#quanTracTabs .nav-item:first-child .nav-link {
    border-radius: 8px 8px 0 0;
}

#quanTracTabs .nav-item:last-child .nav-link {
    border-right: none;
    border-radius: 8px 8px 0 0;
}

#quanTracTabs .nav-link:hover {
    color: #495057;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
    z-index: 2;
}

#quanTracTabs .nav-link.active {
    color: #1976d2;
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
    transform: translateY(-2px);
    z-index: 3;
}

#quanTracTabs .nav-link.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 2px 2px 0 0;
}

#quanTracTabs .nav-link i {
    margin-right: 6px;
    font-size: 14px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

#quanTracTabs .nav-link:hover i {
    transform: scale(1.1);
}

#quanTracTabs .nav-link.active i {
    transform: scale(1.1);
}

/* CSS cho tab content */
.tab-content {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 0;
    min-height: 400px;
    flex: 1;
    overflow-y: auto;
    margin-top: 0;
}

.tab-pane {
    animation: fadeInUp 0.4s ease-out;
    margin-top: 0;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
}

.tab-pane .mt-3 {
    margin-top: 10px !important;
}

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

/* CSS cho cards */
.card {
    margin: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 10px 15px;
    margin: 0;
    border-radius: 12px 12px 0 0 !important;
}

    .card-header h6 {
        color: #495057;
        font-weight: 600;
        margin: 0;
        display: flex;
        align-items: center;
    }

        .card-header h6::before {
            content: '';
            width: 4px;
            height: 20px;
            background: linear-gradient(135deg, #1976d2, #42a5f5);
            margin-right: 10px;
            border-radius: 2px;
        }

.card-body {
    padding: 0px;
    margin: 0;
}

/* CSS cho form controls */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-select, .form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

    .form-select:focus, .form-control:focus {
        border-color: #1976d2;
        box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.15);
        background: white;
    }

/* CSS cho tables */
.table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

    .table thead th {
        background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
        color: white;
        border: none;
        padding: 15px 12px;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 12px;
        letter-spacing: 0.5px;
    }

    .table tbody tr {
        transition: all 0.2s ease;
    }

        .table tbody tr:hover {
            background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
            transform: scale(1.01);
        }

    .table tbody td {
        padding: 12px;
        border-bottom: 1px solid #f1f3f4;
        vertical-align: middle;
    }

/* CSS cho progress bar */
.progress {
    border-radius: 10px;
    background: #e9ecef;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* CSS cho thông tin hồ chứa */
#currentWaterLevel, #currentCapacity {
    color: #1976d2;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#maxWaterLevel, #maxCapacity {
    color: #6c757d;
    font-weight: 600;
    margin: 0;
}

.text-muted {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CSS cho charts */
#rainChart, #waterLevelChart, #reservoirChart {
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 10px;
    border: 1px solid #dee2e6;
}

/* CSS cho tab Lượng mưa, Mực nước và Hồ chứa */
#rain-data table, #water-level-data table, #reservoir-data table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin: 15px 0;
}

#rain-data th, #water-level-data th, #reservoir-data th {
    background: #1a73e8;
    color: white;
    padding: 12px;
    text-align: center;
    border: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
}

#rain-data td, #water-level-data td, #reservoir-data td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    background: white;
}

#rain-data td:first-child, #water-level-data td:first-child, #reservoir-data td:first-child {
    text-align: left;
}

#rain-data .value, #water-level-data .value, #reservoir-data .value {
    font-size: 1.25em;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 4px;
    text-align: center;
}

#rain-data .location, #water-level-data .location, #reservoir-data .location {
    color: #666;
    margin: 4px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 4px;
}

#rain-data .warning, #water-level-data .warning, #reservoir-data .warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
}

#rain-data .no-rain, #water-level-data .no-rain, #reservoir-data .no-rain {
    background: #e8f5e9;
    color: #2e7d32;
}

#rain-data .light-rain, #water-level-data .light-rain, #reservoir-data .light-rain {
    background: #e3f2fd;
    color: #1976d2;
}

#rain-data .medium-rain, #water-level-data .medium-rain, #reservoir-data .medium-rain {
    background: #fff3e0;
    color: #f57c00;
}

#rain-data .heavy-rain, #water-level-data .heavy-rain, #reservoir-data .heavy-rain {
    background: #fbe9e7;
    color: #d84315;
}

#rain-data tr:hover, #water-level-data tr:hover, #reservoir-data tr:hover {
    background-color: #f8f9fa;
}

#rain-data .update-time, #water-level-data .update-time, #reservoir-data .update-time {
    color: #888;
    font-size: 0.85em;
    font-style: italic;
}

#rain-data small, #water-level-data small, #reservoir-data small {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-top: 2px;
}

/* CSS riêng cho tab hồ chứa */
#reservoir-data table {
    table-layout: fixed;
}

#reservoir-data th:nth-child(1),
#reservoir-data td:nth-child(1) {
    width: 30%; /* Tên hồ */
}

#reservoir-data th:nth-child(2),
#reservoir-data td:nth-child(2) {
    width: 15%; /* Dung tích thiết kế */
}

#reservoir-data th:nth-child(3),
#reservoir-data td:nth-child(3) {
    width: 15%; /* Dung tích hiện tại */
}

#reservoir-data th:nth-child(4),
#reservoir-data td:nth-child(4) {
    width: 15%; /* Mực nước */
}

#reservoir-data th:nth-child(5),
#reservoir-data td:nth-child(5) {
    width: 15%; /* Trạng thái */
}

#reservoir-data .capacity {
    font-weight: 600;
    color: #1a73e8;
    text-align: right;
}

#reservoir-data .water-level {
    font-weight: 600;
    color: #1a73e8;
    text-align: right;
}

#reservoir-data .status {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    min-width: 100px;
}

#reservoir-data .status.normal {
    background: #e8f5e9;
    color: #2e7d32;
}

#reservoir-data .status.warning {
    background: #fff3e0;
    color: #f57c00;
}

#reservoir-data .status.danger {
    background: #fbe9e7;
    color: #d84315;
}

#reservoir-data td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#reservoir-data td:first-child {
    white-space: normal;
    min-width: 200px;
}

.trend-up {
    color: #28a745;
}

.trend-down {
    color: #dc3545;
}

.text-muted {
    color: #6c757d;
    font-size: 0.85em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #quanTracTabs .nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    #quanTracTabs .nav-link i {
        font-size: 12px;
        margin-right: 4px;
    }
    
    .tab-content {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
}


#reservoir-data .value {
    font-size: 1.1em !important;
    font-weight: 550 !important;
    color: #1a73e8;
    margin-bottom: 4px;
    text-align: center;
}

#reservoir-data small {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-top: 2px;
}

#reservoir-data .location {
    color: #666;
    margin: 4px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 4px;
}

#reservoir-data .update-time {
    color: #888;
    font-size: 0.85em;
    font-style: italic;
}

#reservoir-data th {
    background: #1a73e8;
    color: white;
    padding: 12px;
    text-align: center;
    border: none;
    font-weight: 600;
}

#reservoir-data td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    background: white;
}
/* Responsive cho offcanvas */
/* Responsive cho mobile */
@media (max-width: 768px) {
    .offcanvas-end {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
    }
}
/* Đảm bảo tabs không bị xuống dòng trên màn hình nhỏ */
/*@media (max-width: 576px) {
    #quanTracTabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        #quanTracTabs .nav-item {
            flex: 0 0 auto;
            min-width: 120px;
        }

        #quanTracTabs .nav-link {
            padding: 8px 10px;
            font-size: 11px;
        }

            #quanTracTabs .nav-link i {
                font-size: 11px;
                margin-right: 3px;
            }
}*/
