/* Import modern, premium fonts optimized for Vietnamese language */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* EVN SCADA / IOC Light Theme Styles */
:root {
    --evn-blue: #005A9C;
    --evn-blue-hover: #004b87;
    --evn-blue-light: #e6f0fa;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #cbd5e1;
    --border-color-light: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-white: #ffffff;
    
    /* Status Colors */
    --status-good: #10b981;
    --status-good-bg: #d1fae5;
    --status-warning: #f59e0b;
    --status-warning-bg: #fef3c7;
    --status-danger: #ef4444;
    --status-danger-bg: #fee2e2;
    --status-bad: #ef4444;      /* alias for status-danger — dùng cho nút Xóa */
    --status-info: #3b82f6;
    --status-info-bg: #dbeafe;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    line-height: 1.5; /* Optimized vertical spacing for Vietnamese tone marks */
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header Styling */
.header {
    height: 65px;
    min-height: 65px;
    max-height: 65px;
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    z-index: 100;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-evn {
    height: 45px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-divider {
    width: 1px;
    height: 36px;
    background-color: var(--border-color);
    flex-shrink: 0;
}

.system-title-block {
    display: flex;
    flex-direction: column;
}

.system-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--evn-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-address {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color-light);
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.weather-item i {
    color: var(--evn-blue);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.clock-widget {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.realtime-time {
    font-size: 16px;
    font-weight: 700;
    color: var(--evn-blue);
    font-family: monospace;
}

.realtime-date {
    font-size: 11px;
    color: var(--text-muted);
}

.status-badge {
    background-color: var(--status-good-bg);
    color: var(--status-good);
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--status-good);
}

.notification-bell {
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.notification-bell:hover {
    color: var(--evn-blue);
}

.bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--status-danger);
    color: white;
    font-size: 9px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--evn-blue-light);
    color: var(--evn-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.status-badge-mini {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
.status-badge-mini.status-good { background-color: var(--status-good-bg); color: var(--status-good); }
.status-badge-mini.status-warning { background-color: var(--status-warning-bg); color: var(--status-warning); }
.status-badge-mini.status-danger { background-color: var(--status-danger-bg); color: var(--status-danger); }

/* Sidebar and Workspace Area */
.workspace {
    display: flex;
    flex-grow: 1;
    height: calc(100vh - 65px);
    width: 100vw;
}

/* Sidebar Layout */
.sidebar {
    width: 240px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 15px 10px;
    overflow-y: auto;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s ease;
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item-left i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

.menu-item:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.menu-item.active {
    background-color: var(--evn-blue);
    color: var(--text-white);
}

.menu-item.active i {
    color: var(--text-white);
}

.badge-new {
    background-color: var(--status-danger);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Main Dashboard Panel */
.dashboard-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 15px;
    gap: 15px;
}

.tab-panel {
    display: none;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.tab-panel.active {
    display: flex;
}

/* Evaluation tab: không giới hạn chiều cao, cho phép scroll tự nhiên */
#tab-evaluation {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
}

/* Khi tab-evaluation active, dashboard-panel phải scroll thay vì fixed */
.dashboard-panel:has(#tab-evaluation.active) {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Forecast Tab Toolbar */
.forecast-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: 10px;
    padding: 10px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    flex-shrink: 0;
}

.forecast-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.forecast-horizon-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-main);
    border-radius: 8px;
    padding: 4px;
}

.horizon-btn {
    padding: 6px 18px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.horizon-btn:hover {
    background-color: var(--evn-blue-light);
    color: var(--evn-blue);
}

.horizon-btn.active {
    background-color: var(--evn-blue);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 90, 156, 0.3);
}

/* KPI Panel (Row of 7 Cards) */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.kpi-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100px;
    position: relative;
    overflow: hidden;
}

.kpi-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.kpi-card-header i {
    font-size: 13px;
    color: var(--evn-blue);
}

.kpi-card-body {
    margin-top: 5px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.kpi-card-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-card-unit {
    font-size: 11px;
    color: var(--text-muted);
}

.kpi-card-trend {
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.kpi-card-trend.up { color: var(--status-danger); }
.kpi-card-trend.down { color: var(--status-info); }
.kpi-card-trend.stable { color: var(--text-muted); }

.kpi-card-footer {
    font-size: 9.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color-light);
    padding-top: 4px;
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

.kpi-gauge-container {
    position: absolute;
    right: 4px;
    top: 10px;
    width: 60px;
    height: 60px;
}

/* Inner Layout Grid (Charts - Map - Meteorology Right Column) */
.inner-grid {
    display: grid;
    grid-template-columns: 340px 1fr 340px;
    gap: 15px;
    flex-grow: 1;
    overflow: hidden;
}

/* Card Styling */
.scada-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scada-card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color-light);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scada-card-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--evn-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.scada-card-header h3 i {
    font-size: 14px;
}

.scada-card-body {
    padding: 12px;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Left Column & Right Column: Stacked Charts */
.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.left-column .scada-card, .right-column .scada-card {
    min-height: 220px;
    flex-grow: 1;
}

#card-dakglun2-monitoring {
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    min-height: auto !important;
    height: auto !important;
}

#card-dakglun2-monitoring .scada-card-body {
    overflow: visible !important;
    flex-grow: 0 !important;
    padding: 10px 12px !important;
}

.chart-container-mini {
    flex-grow: 1;
    width: 100%;
    height: 230px;
}

/* Center Column: GIS Map */
.center-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-container-wrapper {
    flex-grow: 1;
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #f1f5f9;
}

/* Map Toolbar */
.map-toolbar {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.map-btn {
    width: 36px;
    height: 36px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    transition: all 0.15s;
}

.map-btn:hover {
    background-color: var(--evn-blue-light);
    color: var(--evn-blue);
    border-color: var(--evn-blue);
}

.map-btn.active {
    background-color: var(--evn-blue);
    color: white;
    border-color: var(--evn-blue);
    box-shadow: 0 0 8px rgba(0, 90, 156, 0.4);
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    font-size: 11px;
}

.map-legend-title {
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--evn-blue);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Right Column: Operations Panel */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.ops-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

/* Spillway gate item */
.gate-item {
    background-color: #f8fafc;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gate-title {
    font-weight: bold;
    font-size: 12px;
}

.gate-status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.gate-status-badge.open { background-color: var(--status-good-bg); color: var(--status-good); }
.gate-status-badge.closed { background-color: var(--border-color-light); color: var(--text-muted); }

.gate-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gate-slider {
    flex-grow: 1;
    accent-color: var(--evn-blue);
    cursor: pointer;
}

.gate-value {
    font-size: 12px;
    font-weight: bold;
    width: 60px;
    text-align: right;
    color: var(--evn-blue);
}

/* Generator turbine item */
.turbine-item {
    background-color: #f8fafc;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.turbine-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.turbine-name {
    font-weight: bold;
    font-size: 12px;
}

.turbine-flow {
    font-size: 11px;
    color: var(--text-muted);
}

.turbine-power-badge {
    background-color: var(--evn-blue-light);
    color: var(--evn-blue);
    font-weight: bold;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 90, 156, 0.15);
}

.turbine-power-badge.off {
    background-color: var(--border-color-light);
    color: var(--text-muted);
    border-color: transparent;
}

/* What-if simulation box */
.simulation-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color-light);
}

.sim-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.sim-input-row select, .sim-input-row input {
    background-color: white;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    font-size: 12px;
    width: 140px;
}

.sim-output-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color-light);
    padding-top: 8px;
}

.sim-out-item {
    display: flex;
    flex-direction: column;
    background-color: white;
    border: 1px solid var(--border-color-light);
    padding: 6px;
    border-radius: 4px;
    align-items: center;
}

.sim-out-label {
    font-size: 9.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.sim-out-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--evn-blue);
}

.sim-out-val.danger {
    color: var(--status-danger);
}

/* AI Recommendation Card (light blue bg) */
.ai-recommendation-card {
    background-color: #f0f7ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-rec-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 12px;
    color: #0369a1;
}

.ai-rec-header i {
    font-size: 14px;
}

.ai-rec-content {
    font-size: 11.5px;
    color: #0c4a6e;
    line-height: 1.4;
}

.btn-ai-apply {
    align-self: flex-end;
    background-color: #0284c7;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.btn-ai-apply:hover {
    background-color: #0369a1;
}

/* Alerts / Logs feed */
.alert-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-feed-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color-light);
    font-size: 11.5px;
}

.alert-feed-item.info { background-color: var(--status-info-bg); border-color: rgba(59, 130, 246, 0.15); color: #1e3a8a; }
.alert-feed-item.warning { background-color: var(--status-warning-bg); border-color: rgba(245, 158, 11, 0.15); color: #78350f; }
.alert-feed-item.danger { background-color: var(--status-danger-bg); border-color: rgba(239, 68, 68, 0.15); color: #7f1d1d; }

.alert-feed-icon {
    font-size: 14px;
    margin-top: 2px;
}

.alert-feed-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.alert-feed-time {
    font-size: 9.5px;
    color: var(--text-muted);
}

.alert-feed-more {
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    color: var(--evn-blue);
    text-decoration: none;
    margin-top: 4px;
}

/* Links & Footer Bottom Bar */
.bottom-bar {
    background-color: var(--bg-card);
    border-top: 2px solid var(--border-color);
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    z-index: 90;
}

.quick-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quick-links-label {
    font-weight: bold;
    color: var(--evn-blue);
}

.quick-links-list {
    display: flex;
    gap: 10px;
}

.quick-link-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color-light);
    transition: all 0.15s;
}

.quick-link-item:hover {
    border-color: var(--evn-blue);
    color: var(--evn-blue);
}

.footer-info {
    color: var(--text-muted);
    display: flex;
    gap: 20px;
}

.footer-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-info i {
    color: var(--evn-blue);
}

/* Customized scrollbars for SCADA */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* SCADA Table Styling */
.scada-table {
    width: 100%;
    border-collapse: collapse;
}

.scada-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    font-size: 11.5px;
    text-transform: uppercase;
}

.scada-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color-light);
    font-size: 12px;
}

.scada-table tbody tr:hover {
    background-color: #f8fafc;
}

.text-center {
    text-align: center;
}

/* Mobile & Tablet Responsive Media Queries */
@media (max-width: 1200px) {
    .kpi-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    #sidebar-toggle {
        display: flex !important;
    }
    
    body {
        overflow-y: auto !important;
        height: auto;
    }
    
    .app-container {
        height: auto;
        min-height: 100vh;
    }
    
    .workspace {
        height: auto;
    }
    
    .sidebar {
        position: fixed;
        left: -240px;
        top: 65px;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.sidebar-open {
        left: 0;
    }
    
    .dashboard-panel {
        padding: 10px;
        overflow-y: visible;
        height: auto;
        width: 100%;
    }
    
    .kpi-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .inner-grid {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
        gap: 15px;
    }
    
    .left-column, .right-column {
        overflow-y: visible;
        height: auto;
    }
    
    .map-container-wrapper {
        height: 350px;
    }
    
    .header-center {
        display: none; /* Hide weather center panel on tablets/mobile */
    }
    
    #tab-forecast .scada-card-body {
        flex-direction: column !important;
        height: auto;
        overflow: visible;
    }
    
    #tab-forecast #chart-ai-forecast {
        height: 300px;
    }
    
    #tab-forecast div[style*="border-left"] {
        border-left: none !important;
        border-top: 1px solid var(--border-color-light);
        padding-left: 0 !important;
        padding-top: 20px;
        margin-top: 20px;
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0 10px;
    }
    
    .system-title {
        font-size: 11px;
    }
    
    .system-address {
        display: none;
    }
    
    .header-right .clock-widget {
        display: none; /* Hide clock on very small displays */
    }
    
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .kpi-card {
        height: 90px;
        padding: 8px 10px;
    }
    
    .kpi-card-value {
        font-size: 15px;
    }
    
    .kpi-gauge-container {
        width: 50px;
        height: 50px;
    }
    
    .bottom-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 15px 10px;
    }
    
    .quick-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .quick-links-list {
        flex-wrap: wrap;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    
    #tab-reports .scada-card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    #tab-reports .scada-card-header div {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Card Fullscreen Mode Styles */
.btn-card-fullscreen {
    position: absolute;
    top: 10px;
    right: 15px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.btn-card-fullscreen:hover {
    background-color: var(--evn-blue-light);
    border-color: var(--evn-blue);
    color: var(--evn-blue);
}

.scada-card.fullscreen-mode {
    background-color: var(--bg-card) !important;
    padding: 20px !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 99999 !important;
}

.scada-card.fullscreen-mode .scada-card-body {
    flex-grow: 1 !important;
    overflow-y: auto !important;
    height: calc(100% - 20px) !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important;
}

.scada-card.fullscreen-mode #chart-ai-forecast,
.scada-card.fullscreen-mode #chart-forecast-10d,
.scada-card.fullscreen-mode #chart-6h-avg,
.scada-card.fullscreen-mode #chart-forecast-6m {
    height: 85vh !important;
    width: 100% !important;
}

/* ================================================================
   FULLSCREEN - Module Thong Ke
   ================================================================ */

/* Card fullscreen: phủ toàn màn hình, flexbox column */
#stats-card-chart.fullscreen-mode,
#stats-card-q-pivot.fullscreen-mode,
#stats-rain-detail-card.fullscreen-mode,
#stats-rain-stations-card.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    background: var(--bg-card) !important;
    padding: 16px 24px 20px !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    gap: 0 !important;
}

/* Header: không co giãn, chiều cao cố định */
#stats-card-chart.fullscreen-mode .scada-card-header,
#stats-card-q-pivot.fullscreen-mode .scada-card-header,
#stats-rain-detail-card.fullscreen-mode .scada-card-header,
#stats-rain-stations-card.fullscreen-mode .scada-card-header {
    flex: 0 0 auto !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 8px !important;
}

/* Nút fullscreen trong fullscreen mode */
#stats-card-chart.fullscreen-mode .btn-card-fullscreen,
#stats-card-q-pivot.fullscreen-mode .btn-card-fullscreen,
#stats-rain-detail-card.fullscreen-mode .btn-card-fullscreen,
#stats-rain-stations-card.fullscreen-mode .btn-card-fullscreen {
    top: 14px !important;
    right: 20px !important;
}

/* Wrapper bảng/chart: flex:1 chiếm toàn bộ chiều cao còn lại, scroll bên trong */
#stats-card-q-pivot.fullscreen-mode > div:last-of-type,
#stats-rain-detail-card.fullscreen-mode > div:last-of-type,
#stats-rain-stations-card.fullscreen-mode > div:last-of-type {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
}

/* Biểu đồ fullscreen: chiếm toàn bộ chiều cao còn lại sau header */
#stats-card-chart.fullscreen-mode > div:last-of-type {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
}

#stats-card-chart.fullscreen-mode #chart-monthly-stats {
    width: 100% !important;
    height: 100% !important;
}

/* Bảng bên trong fullscreen: font lớn hơn để dễ đọc */
#stats-card-q-pivot.fullscreen-mode table,
#stats-rain-detail-card.fullscreen-mode table,
#stats-rain-stations-card.fullscreen-mode table {
    font-size: 13px !important;
}

#stats-card-q-pivot.fullscreen-mode td,
#stats-card-q-pivot.fullscreen-mode th,
#stats-rain-detail-card.fullscreen-mode td,
#stats-rain-detail-card.fullscreen-mode th,
#stats-rain-stations-card.fullscreen-mode td,
#stats-rain-stations-card.fullscreen-mode th {
    padding: 10px 14px !important;
}

/* Header hàng sticky trong bảng fullscreen */
#stats-card-q-pivot.fullscreen-mode thead tr,
#stats-rain-detail-card.fullscreen-mode thead tr,
#stats-rain-stations-card.fullscreen-mode thead tr {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}


/* ================================================================
   RESPONSIVE - Forecast Module (Mobile & Tablet)
   ================================================================ */

/* --- Tablet (≤ 1024px) đã xử lý sidebar, bổ sung forecast --- */
@media (max-width: 1024px) {
    /* Toolbar chính: stack thành 2 dòng */
    .forecast-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 12px;
    }

    .forecast-toolbar-left {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    #forecast-release-time {
        display: none;
    }

    .forecast-horizon-tabs {
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
        justify-content: flex-start;
    }

    .horizon-btn {
        padding: 5px 12px;
        font-size: 12px;
    }

    /* Toolbar right: stack dọc khi hẹp */
    .forecast-toolbar > div:last-child,
    #tab-forecast .forecast-toolbar-right {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    /* Model select wrapper full width */
    .model-select-wrapper {
        width: 100%;
    }

    .model-select-wrapper select {
        flex: 1;
        width: 100%;
    }

    /* Card body: chart + table chuyển từ row → column */
    #forecast-panel-hourly .scada-card-body,
    #forecast-panel-10d .scada-card-body,
    #forecast-panel-6m .scada-card-body {
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Chart container full width */
    #forecast-panel-hourly .scada-card-body > div:first-child,
    #forecast-panel-10d .scada-card-body > div:first-child,
    #forecast-panel-6m .scada-card-body > div:first-child {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Chart height thu nhỏ */
    #chart-ai-forecast,
    #chart-forecast-10d,
    #chart-forecast-6m {
        height: 320px !important;
    }

    /* Table panel: bỏ border-left, full width, scroll ngang */
    #forecast-panel-hourly .scada-card-body > div:last-child,
    #forecast-panel-10d .scada-card-body > div:last-child,
    #forecast-panel-6m .scada-card-body > div:last-child {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        border-left: none !important;
        border-top: 1px solid var(--border-color-light) !important;
        padding-left: 0 !important;
        padding-top: 15px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    /* Bảng số liệu: font nhỏ, cho phép scroll ngang */
    #table-forecast-data,
    #table-forecast-10d,
    #table-forecast-6m {
        font-size: 11px !important;
        min-width: 600px;
    }

    #table-forecast-data th,
    #table-forecast-10d th,
    #table-forecast-6m th,
    #table-forecast-data td,
    #table-forecast-10d td,
    #table-forecast-6m td {
        padding: 7px 8px !important;
    }

    /* Bảng đánh giá sai số */
    .model-eval-section {
        margin-top: 15px !important;
    }

    /* Panel 6h-avg */
    #forecast-panel-6h-avg {
        padding: 10px 6px !important;
    }
}

/* --- Mobile nhỏ (≤ 768px) --- */
@media (max-width: 768px) {
    /* ── HEADER: chỉ giữ logo + badge cảnh báo ── */
    .header {
        height: 52px;
        min-height: 52px;
        max-height: 52px;
        padding: 0 10px;
        justify-content: space-between;
    }

    /* Ẩn toàn bộ phần giữa (thời tiết) */
    .header-center { display: none !important; }

    /* Ẩn: đường kẻ dọc giữa logo và tiêu đề */
    .logo-divider { display: none !important; }

    /* Ẩn: khối tiêu đề hệ thống và địa chỉ */
    .system-title-block { display: none !important; }

    /* Nút sidebar toggle: giữ lại để bấm mở/đóng menu */
    #sidebar-toggle { display: flex !important; }


    /* Logo nhỏ lại */
    .logo-evn { height: 32px !important; }

    /* Header right: chỉ giữ status-badge đầu tiên */
    .header-right { gap: 6px; }

    /* Ẩn: đồng hồ giờ phút */
    .clock-widget { display: none !important; }

    /* Ẩn: badge giờ cập nhật dữ liệu */
    #data-time-badge { display: none !important; }

    /* Ẩn: chuông thông báo */
    .notification-bell { display: none !important; }

    /* Giữ lại status-badge "Bình thường" — thu gọn font */
    .status-badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
        gap: 4px !important;
    }

    .status-dot {
        width: 7px !important;
        height: 7px !important;
    }


    /* Tab panel forecast: padding nhỏ hơn */
    #tab-forecast {
        padding: 6px 0;
    }

    /* Toolbar */
    .forecast-toolbar {
        padding: 8px 10px;
        border-radius: 8px;
        gap: 8px;
    }

    .forecast-title {
        font-size: 13px !important;
    }

    /* Horizon tabs wrap nhỏ gọn */
    .horizon-btn {
        padding: 4px 10px;
        font-size: 11px;
        border-radius: 5px;
    }

    /* Ẩn nút Fullscreen trên mobile */
    .btn-card-fullscreen {
        display: none !important;
    }

    /* Chart nhỏ hơn */
    #chart-ai-forecast,
    #chart-forecast-10d,
    #chart-forecast-6m,
    #chart-6h-avg {
        height: 295px !important; /* Tăng chiều cao lên để dễ nhìn biểu đồ */
    }

    #tab-forecast .scada-card-body {
        padding: 6px !important; /* Tối ưu hóa tối đa lề card body */
        gap: 6px !important;
    }

    /* Card scada: padding */
    .scada-card {
        border-radius: 8px;
        padding: 4px !important; /* Tối ưu lề của card */
    }

    #forecast-panel-hourly,
    #forecast-panel-10d,
    #forecast-panel-6m,
    #forecast-panel-6h-avg {
        margin-top: 8px !important;
    }

    /* Bảng: font nhỏ, padding tối thiểu */
    #table-forecast-data,
    #table-forecast-10d,
    #table-forecast-6m {
        font-size: 10.5px !important;
        min-width: 560px;
    }

    #table-forecast-data th,
    #table-forecast-10d th,
    #table-forecast-6m th,
    #table-forecast-data td,
    #table-forecast-10d td,
    #table-forecast-6m td {
        padding: 6px 7px !important;
        font-size: 10.5px !important;
    }

    /* Bảng đánh giá sai số: font nhỏ */
    #table-evaluation-metrics-hourly th,
    #table-evaluation-metrics-hourly td,
    #table-evaluation-metrics-daily th,
    #table-evaluation-metrics-daily td,
    #table-evaluation-metrics-6h th,
    #table-evaluation-metrics-6h td {
        font-size: 10px !important;
        padding: 5px 6px !important;
    }

    /* Toggle đánh giá: nhỏ hơn */
    .eval-toggle-group {
        margin-left: auto;
    }

    /* Nút Chạy AI và Huấn luyện: thu nhỏ */
    #btn-trigger-ai,
    #btn-retrain-ai {
        font-size: 11px !important;
        padding: 5px 10px !important;
    }

    /* Select model: full width */
    #select-ai-model {
        font-size: 11px !important;
        padding: 5px 8px !important;
        width: 100% !important;
    }

}

/* --- Mobile rất nhỏ (≤ 480px) --- */
@media (max-width: 480px) {
    /* Header thu gọn tối đa */
    .logo-evn {
        height: 30px !important;
    }

    .system-title {
        font-size: 10px !important;
        line-height: 1.3 !important;
    }

    /* Horizon tabs: 3 cột dạng grid */
    .forecast-horizon-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }

    .horizon-btn {
        text-align: center;
        width: 100%;
        padding: 5px 4px !important;
        font-size: 10.5px !important;
    }

    /* Chart tối giản */
    #chart-ai-forecast,
    #chart-forecast-10d,
    #chart-forecast-6m,
    #chart-6h-avg {
        height: 255px !important; /* Tăng chiều cao lên 255px */
    }

    #tab-forecast .scada-card-body {
        padding: 4px !important; /* Lề siêu nhỏ cho màn hình siêu nhỏ */
        gap: 4px !important;
    }

    /* Bảng: font tối thiểu, scroll */
    #table-forecast-data,
    #table-forecast-10d,
    #table-forecast-6m {
        font-size: 10px !important;
        min-width: 500px;
    }

    #table-forecast-data th,
    #table-forecast-10d th,
    #table-forecast-6m th,
    #table-forecast-data td,
    #table-forecast-10d td,
    #table-forecast-6m td {
        padding: 5px 5px !important;
        font-size: 10px !important;
    }

    /* Ẩn cột ít quan trọng trên màn hình rất nhỏ */
    #table-forecast-data th:nth-child(3),
    #table-forecast-data td:nth-child(3),
    #table-forecast-10d th:nth-child(3),
    #table-forecast-10d td:nth-child(3) {
        display: none;
    }

    /* Toolbar right: stack dọc */
    #tab-forecast .scada-card-header,
    .forecast-toolbar {
        gap: 6px !important;
    }

    /* KPI: 2 cột */
    .kpi-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .kpi-card {
        height: 80px !important;
        padding: 8px !important;
    }

    .kpi-card-value {
        font-size: 14px !important;
    }
}

/* =====================================================================
   RESPONSIVE MOBILE / TABLET CHO: THỐNG KÊ, DỰ BÁO MƯA & BÁO CÁO
   ===================================================================== */

@media (max-width: 1024px) {
    /* --- TAB DỰ BÁO MƯA (#tab-rain-forecast) --- */
    #tab-rain-forecast {
        height: auto !important;
        padding: 8px !important;
    }

    #tab-rain-forecast .scada-card-body {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }

    #rain-forecast-panel-10d .scada-card-body > div,
    #rain-forecast-panel-radar .scada-card-body > div,
    #rain-forecast-panel-6m .scada-card-body > div {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
    }

    #chart-rain-forecast-10d {
        height: 320px !important;
    }

    #map-rain-radar {
        height: 300px !important;
    }

    #rain-forecast-panel-10d div[style*="border-left"],
    #rain-forecast-panel-radar div[style*="border-left"],
    #rain-forecast-panel-6m div[style*="border-left"] {
        border-left: none !important;
        border-top: 1px solid var(--border-color-light) !important;
        padding-left: 0 !important;
        padding-top: 15px !important;
        margin-top: 10px !important;
    }

    #table-rain-forecast-10d,
    #table-rain-nowcast-6h {
        min-width: 480px;
    }

    /* --- TAB BÁO CÁO & BẢN TIN (#tab-reports) --- */
    #tab-reports {
        height: auto !important;
        padding: 8px !important;
    }

    #tab-reports .scada-card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    #tab-reports .scada-card-header > div {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    #tab-reports select,
    #tab-reports input[type="date"] {
        flex: 1 1 auto;
        min-width: 120px;
    }

    #tab-reports .btn-ai-apply {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    #table-report-data,
    #table-bulletins-list {
        min-width: 520px;
    }
}

@media (max-width: 768px) {
    /* --- TAB THỐNG KÊ (#tab-statistics) --- */
    #tab-statistics {
        height: auto !important;
        padding: 8px !important;
    }

    #tab-statistics .forecast-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px !important;
        gap: 10px !important;
    }

    #tab-statistics .forecast-toolbar-left,
    #tab-statistics .forecast-toolbar-right {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    #tab-statistics .forecast-toolbar-right button {
        width: 100% !important;
        justify-content: center;
    }

    #chart-monthly-stats {
        height: 280px !important;
    }

    #table-monthly-stats,
    #table-rain-pivot {
        min-width: 580px;
        font-size: 11px !important;
    }

    #table-monthly-stats th,
    #table-monthly-stats td,
    #table-rain-pivot th,
    #table-rain-pivot td {
        padding: 6px 4px !important;
    }

    /* --- TAB DỰ BÁO MƯA TOOLBAR & SUBTABS --- */
    #tab-rain-forecast .forecast-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px !important;
        gap: 10px !important;
    }

    #tab-rain-forecast .forecast-toolbar-left,
    #tab-rain-forecast .forecast-toolbar-right {
        width: 100% !important;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    #tab-rain-forecast .btn-subtab {
        flex: 1 1 auto;
        padding: 6px 8px !important;
        font-size: 10.5px !important;
        text-align: center;
    }

    /* Floating Timeline Bar cho Bản đồ Tổng quan trên Mobile */
    #overview-radar-timeline-bar {
        width: 92% !important;
        bottom: 10px !important;
        padding: 4px 10px !important;
        font-size: 10px !important;
    }

    #overview-radar-slider {
        width: 70px !important;
    }

    #overview-radar-time-label {
        min-width: 100px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 480px) {
    #chart-rain-forecast-10d,
    #chart-rain-nowcast-6h {
        height: 240px !important;
    }

    #map-rain-radar {
        height: 260px !important;
    }

    #tab-statistics .forecast-toolbar-left select {
        width: 100% !important;
    }

    /* --- TAB GIÁM SÁT MƯA (#tab-hydrology) --- */
    #tab-hydrology {
        height: auto !important;
        padding: 8px !important;
    }

    #tab-hydrology .forecast-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px !important;
        gap: 10px !important;
    }

    #tab-hydrology .forecast-toolbar-left,
    #tab-hydrology .forecast-toolbar-right {
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    #tab-hydrology .forecast-toolbar-right button {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    #tab-hydrology select,
    #tab-hydrology input[type="date"] {
        flex: 1 1 auto;
        min-width: 110px;
    }

    #rain-matrix-table-container {
        height: 480px !important;
        min-height: 380px !important;
    }
}

/* =====================================================================
   TỐI ƯU COMPACT PADDING & RESPONSIVE TRÊN MOBILE (EVALUATION, THỐNG KÊ, DỰ BÁO MƯA)
   ===================================================================== */
@media (max-width: 768px) {
    /* Tab Container Padding compact */
    #tab-evaluation,
    #tab-statistics,
    #tab-rain-forecast,
    #tab-hydrology,
    #tab-reports,
    #tab-forecast {
        padding: 6px 4px 40px 4px !important;
    }

    /* Scada Card Padding compact */
    #tab-evaluation .scada-card,
    #tab-statistics .scada-card,
    #tab-rain-forecast .scada-card,
    #tab-hydrology .scada-card,
    #tab-reports .scada-card {
        padding: 6px 8px !important;
        margin-top: 6px !important;
        border-radius: 8px !important;
    }

    /* Card Body Padding compact */
    #tab-evaluation .scada-card-body,
    #tab-statistics .scada-card-body,
    #tab-rain-forecast .scada-card-body,
    #tab-hydrology .scada-card-body,
    #tab-reports .scada-card-body {
        padding: 6px !important;
        gap: 6px !important;
    }

    /* Card Header Padding compact */
    #tab-evaluation .scada-card-header,
    #tab-statistics .scada-card-header,
    #tab-rain-forecast .scada-card-header,
    #tab-hydrology .scada-card-header,
    #tab-reports .scada-card-header {
        padding: 6px 8px !important;
        margin-bottom: 4px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    /* Toolbar Padding compact & responsive layout */
    #tab-evaluation .forecast-toolbar,
    #tab-statistics .forecast-toolbar,
    #tab-rain-forecast .forecast-toolbar,
    #tab-hydrology .forecast-toolbar {
        padding: 8px 10px !important;
        gap: 8px !important;
        border-radius: 8px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    #tab-evaluation .forecast-toolbar-left,
    #tab-evaluation .forecast-toolbar-right {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    #tab-evaluation .forecast-toolbar-left > div {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
    }

    #tab-evaluation select,
    #tab-evaluation input[type="date"] {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: 100% !important;
    }

    #tab-evaluation .btn-eval-calc,
    #tab-evaluation .btn-eval-excel {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 10px 14px !important;
    }

    /* Chart height on mobile */
    #chart-eval-hydrograph {
        height: 340px !important;
    }

    /* Leaderboard table font size & padding on mobile */
    #tab-evaluation .forecast-table th,
    #tab-evaluation .forecast-table td {
        padding: 6px 4px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 480px) {
    #tab-evaluation,
    #tab-statistics,
    #tab-rain-forecast,
    #tab-hydrology,
    #tab-reports,
    #tab-forecast {
        padding: 4px 2px 30px 2px !important;
    }

    #tab-evaluation .scada-card,
    #tab-statistics .scada-card,
    #tab-rain-forecast .scada-card,
    #tab-hydrology .scada-card,
    #tab-reports .scada-card {
        padding: 4px 6px !important;
        margin-top: 4px !important;
    }

    #tab-evaluation .scada-card-body,
    #tab-hydrology .scada-card-body,
    #tab-reports .scada-card-body {
        padding: 4px !important;
    }

    #chart-eval-hydrograph {
        height: 300px !important;
    }

    #tab-evaluation .forecast-toolbar-left > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
}

/* Evaluation Buttons */
.btn-eval-calc {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 18px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: auto !important;
    height: auto !important;
    min-height: 34px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.15s ease-in-out;
}
.btn-eval-calc:hover {
    background: #7c3aed !important;
    box-shadow: 0 3px 6px rgba(139, 92, 246, 0.3);
}

.btn-eval-excel {
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 18px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: auto !important;
    height: auto !important;
    min-height: 34px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.15s ease-in-out;
}
.btn-eval-excel:hover {
    background: #059669 !important;
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.3);
}

/* =====================================================================
   DAK GLUN 2 POPUP MODAL STYLES
   ===================================================================== */
.modal-overlay {
    animation: fadeInOverlay 0.2s ease-out;
}
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.btn-dg2-filter {
    padding: 5px 14px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-card) !important;
    color: var(--text-color) !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
}
.btn-dg2-filter.active,
.btn-dg2-filter:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25) !important;
}

#card-dakglun2-monitoring {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#card-dakglun2-monitoring:hover {
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15) !important;
}

@media (max-width: 768px) {
    #modal-dakglun2 .modal-content {
        max-height: 96vh !important;
        border-radius: 8px !important;
    }
    #dakglun2-modal-kpis {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    #chart-dakglun2-mn-vt,
    #chart-dakglun2-flows {
        height: 210px !important;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   MODULE BẢN ĐỒ GIS LƯU VỰC & HỒ CHỨA THÁC MƠ (PHASE 1)
   ────────────────────────────────────────────────────────────────────────── */

.btn-gis-tool {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-gis-tool:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.gis-floating-panel {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    color: #1e293b;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.gis-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.gis-card-header {
    background: #f8fafc;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}
.gis-card-header:hover {
    background: #f1f5f9;
}

.gis-basemap-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    transition: all 0.2s ease;
}
.gis-basemap-option:hover {
    border-color: #0284c7;
    background: #f0f9ff;
    color: #0284c7;
}
.gis-basemap-option.active {
    border-color: #0284c7;
    background: #e0f2fe;
    color: #0369a1;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}
.gis-bm-thumb {
    width: 100%;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.gis-layer-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    transition: background 0.15s ease;
}
.gis-layer-item:hover {
    background: #f1f5f9;
}
.gis-layer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gis-layer-title {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    flex-grow: 1;
}
.gis-layer-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0369a1;
}

.gis-toggle-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}
.gis-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.gis-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 18px;
}
.gis-slider:before {
    position: absolute;
    content: "";
    height: 14px; width: 14px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.gis-toggle-switch input:checked + .gis-slider {
    background-color: #0284c7;
}
.gis-toggle-switch input:checked + .gis-slider:before {
    transform: translateX(14px);
}

.gis-range-input {
    width: 100%;
    accent-color: #0284c7;
    height: 4px;
    cursor: pointer;
}

.btn-gis-player {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #0284c7;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.btn-gis-player:hover {
    background: #0369a1;
    transform: scale(1.05);
}

.gis-station-label {
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 4px !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 6px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}
.gis-station-label::before {
    border-top-color: rgba(15, 23, 42, 0.85) !important;
}

/* Sắc nét & Nổi bật màu sắc cho ảnh DEM Địa hình & Diện ngập */
.leaflet-paneTopo-pane img {
    filter: contrast(1.15) saturate(1.22) brightness(1.02) !important;
    image-rendering: -webkit-optimize-contrast !important;
}
.leaflet-paneInundation-pane img {
    filter: contrast(1.1) saturate(1.15) !important;
}

/* Mobile Responsive System for GIS Map Module */
@media (max-width: 768px) {
    #btn-toggle-gis-layers {
        display: flex !important;
    }
    #gis-left-panel {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 285px !important;
        max-width: 85vw !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 12px 12px 0 !important;
        transform: translateX(-105%);
        transition: transform 0.25s ease-in-out;
        z-index: 2000 !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.6);
        background: rgba(15, 23, 42, 0.96) !important;
        backdrop-filter: blur(8px);
    }
    #gis-left-panel.active {
        transform: translateX(0) !important;
    }
    #gis-top-toolbar {
        top: 12px !important;
        right: 10px !important;
        z-index: 1000 !important;
    }
    #gis-top-toolbar .btn-gis-tool span {
        display: none !important;
    }
    #gis-legend-panel {
        max-width: calc(100vw - 20px) !important;
        right: 10px !important;
        left: 10px !important;
        bottom: 10px !important;
        z-index: 1000 !important;
    }
    #gis-radar-player-panel {
        width: calc(100% - 20px) !important;
        bottom: 10px !important;
        padding: 6px 10px !important;
        z-index: 1000 !important;
    }
    #gis-windy-drawer {
        width: calc(100% - 20px) !important;
        bottom: 10px !important;
        max-height: 75vh !important;
    }
}

/* Windy Map Picker Pin Animation - Căn chuẩn 100% tâm điểm bấm */
.gis-picker-pin-wrapper {
    background: transparent !important;
    border: none !important;
}
.windy-picker-pin {
    position: absolute;
    top: 0;
    left: 0;
    width: 26px;
    height: 32px;
    color: #ef4444;
    font-size: 28px;
    text-align: center;
    line-height: 32px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
    animation: windyPinBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes windyPinBounce {
    0% { transform: translateY(-20px) scale(0.6); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.windy-picker-pin .windy-pulse {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    background: rgba(239, 68, 68, 0.6);
    border-radius: 50%;
    animation: windyPulse 1.5s infinite;
}
@keyframes windyPulse {
    0% { transform: translateX(-50%) scale(1); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(2.5); opacity: 0; }
}

/* Hide all scrollbars in Windy point forecast drawer for clean modern aesthetic */
#gis-windy-drawer,
#gis-windy-drawer *,
#gis-windy-daily-container,
.windy-hourly-table-container {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
#gis-windy-drawer::-webkit-scrollbar,
#gis-windy-drawer *::-webkit-scrollbar,
#gis-windy-daily-container::-webkit-scrollbar,
.windy-hourly-table-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Windy Daily Container & Cards - overflow:visible để shadow active không bị cắt */
#gis-windy-daily-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 4px 2px 14px 2px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.windy-daily-card {
    width: 100% !important;
    min-width: 0 !important;
    height: 84px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 5px 3px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    cursor: pointer !important;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    user-select: none !important;
}
.windy-daily-card:hover {
    background: #f0f9ff !important;
    border-color: #38bdf8 !important;
}
.windy-daily-card.active {
    background: #e0f2fe !important;
    border: 2px solid #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15), 0 4px 12px rgba(2, 132, 199, 0.25) !important;
}
.windy-daily-card .day-name {
    font-weight: 700 !important;
    font-size: 10.5px !important;
    color: #0f172a !important;
    white-space: nowrap;
}
.windy-daily-card .rain-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    color: #0284c7 !important;
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    padding: 1px 4px !important;
    border-radius: 5px !important;
    white-space: nowrap;
}
.windy-daily-card .temp-range {
    font-size: 9.5px !important;
    color: #475569 !important;
    font-weight: 600 !important;
    white-space: nowrap;
}

/* Windy Hourly Table - Nền Trắng Sáng */
.windy-hourly-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.windy-hourly-table tbody tr:hover {
    background: #f8fafc;
}
.windy-hourly-table .badge-source-radar {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #d8b4fe;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}
.windy-hourly-table .badge-source-smartmet {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}






