/* ===== VARIABLES ===== */
:root {
    /* Logo color palette */
    --primary: #1572a1;      /* Main blue from logo */
    --secondary: #c8a04f;    /* Gold/beige from logo */
    --accent: #009640;       /* Green from logo */
    
    /* Neutral colors */
    --dark: #1a1a1a;
    --light: #f8f9fa;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* Semantic colors */
    --success: #009640;      /* Using logo green */
    --warning: #c8a04f;      /* Using logo gold */
    --danger: #dc3545;
    --info: #1572a1;         /* Using logo blue */
    
    /* Layout */
    --sidebar-width: 250px;
    
    /* Light theme as default */
    --text-color: var(--gray-800);
    --bg-color: var(--light);
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: var(--gray-300);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --ui-font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.dark-mode {
    /* Dark theme variables */
    --text-color: var(--gray-100);
    --bg-color: var(--gray-900);
    --sidebar-bg: var(--gray-800);
    --header-bg: var(--gray-800);
    --card-bg: var(--gray-800);
    --border-color: var(--gray-700);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ===== BASE STYLES ===== */
html, body {
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.45;
}

*,
*::before,
*::after {
  font-family: inherit;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR STYLES ===== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1000;
}

.logo {
    padding: 0px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    height: 50px;
    width: auto;
}

.dark-mode .logo-img {
    filter: brightness(0) invert(1);
}

.menu {
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.menu-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    background-color: var(--primary);
    color: white;
    border-right: 4px solid var(--secondary);
}

.menu-item i {
    margin-left: 10px;
    font-size: 1.2rem;
}

/* ===== MAIN CONTENT STYLES ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: var(--header-bg);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 999;
}

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

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.content {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.page-title {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h2 {
    font-size: 1.8rem;
    color: var(--primary);
}

.date-display {
    color: var(--text-color);
    opacity: 0.7;
}

/* ===== KPI CARDS ===== */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 4px solid var(--primary);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.kpi-card.warning {
    border-top-color: var(--warning);
}

.kpi-card.danger {
    border-top-color: var(--danger);
}

.kpi-card.success {
    border-top-color: var(--success);
}

.kpi-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

.kpi-title {
    font-size: 0.9rem;
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
}

.kpi-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

.kpi-trend.up {
    color: var(--success);
}

.kpi-trend.down {
    color: var(--danger);
}

/* ===== WIDGET STYLES ===== */
.dashboard-widgets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.widget {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.widget-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.widget-actions {
    display: flex;
    gap: 10px;
}

.widget-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.tab.active {
    border-bottom: 3px solid var(--primary);
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.dark-mode .data-table th {
    background-color: rgba(255, 255, 255, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active {
    background-color: rgba(0, 150, 64, 0.2);
    color: var(--success);
}

.status-inactive {
    background-color: rgba(220, 53, 69, 0.2);
    color: var(--danger);
}

.status-warning {
    background-color: rgba(200, 160, 79, 0.2);
    color: var(--warning);
}

/* ===== CONTROL PANEL ===== */
.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.control-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.control-title {
    font-size: 1.1rem;
    font-weight: bold;
}

.control-status {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
    background-color: rgba(0, 150, 64, 0.2);
    color: var(--success);
}

.control-params {
    margin-top: 15px;
}

.param-group {
    margin-bottom: 15px;
}

.param-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.param-input {
    width: 100%;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.dark-mode .param-input {
    background-color: rgba(255, 255, 255, 0.1);
}

.param-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* ===== EXPANDABLE TABLE ROWS ===== */
.expandable-row {
    cursor: pointer;
    transition: background-color 0.3s;
}

.expandable-row:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .expandable-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.expandable-row.expanded {
    background-color: rgba(21, 114, 161, 0.1);
}

.dark-mode .expandable-row.expanded {
    background-color: rgba(21, 114, 161, 0.2);
}

.expansion-content {
    display: none;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--border-color);
}

.dark-mode .expansion-content {
    background-color: rgba(255, 255, 255, 0.05);
}

.expansion-content.active {
    display: block;
}

.expansion-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.expansion-param {
    flex: 1;
    min-width: 200px;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    height: 10px;
}

.dark-mode .progress-container {
    background-color: rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.8rem;
}

/* ===== VALVES GRID ===== */
.valves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.valve-card {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.dark-mode .valve-card {
    background-color: rgba(255, 255, 255, 0.05);
}

.valve-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.valve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.valve-title {
    font-size: 1rem;
    font-weight: bold;
}

.valve-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.valve-slider {
    width: 100%;
}

.valve-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* ===== INCIDENTS & ALERTS STYLES ===== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary);
}

.stat-card.critical {
    border-top-color: var(--danger);
}

.stat-card.warning {
    border-top-color: var(--warning);
}

.stat-card.info {
    border-top-color: var(--info);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Trello Board */
.board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    align-items: flex-start;
}

.column {
    background-color: var(--card-bg);
    border-radius: 6px;
    min-width: 280px;
    max-width: 280px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.column-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-title {
    font-size: 1.1rem;
    font-weight: bold;
}

.column-count {
    background-color: var(--primary);
    color: white;
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 0.8rem;
}

.column-map {
    height: 120px;
    background: 
        radial-gradient(circle, rgba(0,0,0,0) 70%, rgba(0,0,0,0.8) 100%),
        url("baha-map.png") center/cover no-repeat;
    background-repeat: no-repeat;
    background-position: center;
    background-size: auto;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.map-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.column-content {
    padding: 15px;
    flex: 1;
}

.log-item {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.dark-mode .log-item {
    background-color: rgba(255, 255, 255, 0.05);
}

.log-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.log-item.critical {
    border-left-color: var(--danger);
}

.log-item.warning {
    border-left-color: var(--warning);
}

.log-item.info {
    border-left-color: var(--info);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-title {
    font-weight: bold;
    font-size: 0.9rem;
}

.log-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

.log-preview {
    font-size: 0.8rem;
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
}

.log-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 10px;
}

.log-item.expanded .log-details {
    max-height: 300px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.detail-label {
    opacity: 0.7;
}

.detail-value {
    font-weight: 500;
}

.log-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: var(--transition);
}

.action-btn:hover {
    background-color: var(--primary);
    color: white;
}

.action-btn.delete:hover {
    background-color: var(--danger);
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.filter-btn:hover {
    background-color: var(--primary);
    color: white;
}

.filter-btn.active {
    background-color: var(--primary);
    color: white;
}

/* ===== SYSTEM ANALYTICS STYLES ===== */
.system-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 25px;
    box-shadow: var(--shadow);
    text-align: center;
}

.overview-icon {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

.overview-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 10px 0;
}

.overview-label {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 10px;
}

.overview-status {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-count {
    font-size: 1.5rem;
    font-weight: bold;
}

.status-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.status-online .status-count {
    color: var(--success);
}

.status-offline .status-count {
    color: var(--danger);
}

.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.component-status {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.component-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.component-item {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.dark-mode .component-item {
    background-color: rgba(255, 255, 255, 0.05);
}

.component-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.component-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.component-info {
    flex: 1;
}

.component-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.component-location {
    font-size: 0.8rem;
    opacity: 0.7;
}

.component-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-online .component-status-indicator {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-offline .component-status-indicator {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.status-warning .component-status-indicator {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.performance-metrics {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.metric {
    margin-bottom: 20px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.metric-title {
    font-weight: bold;
    font-size: 0.9rem;
}

.metric-value {
    font-weight: bold;
    color: var(--primary);
}

.metric-bar {
    height: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.dark-mode .metric-bar {
    background-color: rgba(255, 255, 255, 0.1);
}

.metric-progress {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-success {
    background-color: var(--success);
}

.progress-warning {
    background-color: var(--warning);
}

.progress-danger {
    background-color: var(--danger);
}

.system-health {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.health-score {
    text-align: center;
    margin-bottom: 20px;
}

.health-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--success);
    margin: 10px 0;
}

.health-label {
    font-size: 1rem;
    opacity: 0.8;
}

.health-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.health-item:last-child {
    border-bottom: none;
}

/* Component Filters */
.component-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.component-filters .filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: var(--text-color);
}

.component-filters .filter-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.component-filters .filter-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.component-item.hidden {
    display: none;
}

/* ===== TREE MAP STYLES ===== */
.tree-map-container {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: 600px;
    position: relative;
}

#treeMap {
    width: 100%;
    height: 100%;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.controls .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.controls .btn:hover {
    background-color: var(--primary);
    color: white;
}

.controls .btn.active {
    background-color: var(--primary);
    color: white;
}

.system-info {
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.info-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-label {
    font-weight: bold;
}

.info-value {
    color: var(--primary);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .board {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .column {
        min-width: calc(50% - 20px);
        max-width: calc(50% - 20px);
    }
}

@media (max-width: 992px) {
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .menu {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    
    .menu-item {
        white-space: nowrap;
        padding: 10px 15px;
    }
}

@media (max-width: 768px) {
    .kpi-cards {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .valves-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .tree-map-container {
        height: 500px;
    }
    
    .content {
        padding: 15px;
    }
    
    .column {
        min-width: 100%;
        max-width: 100%;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters {
        flex-direction: column;
    }
    
    .system-overview {
        grid-template-columns: 1fr;
    }
    
    .component-list {
        grid-template-columns: 1fr;
    }
    
    .info-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .kpi-cards {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 15px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .expansion-row {
        flex-direction: column;
    }
    
    .valves-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .health-details {
        grid-template-columns: 1fr;
    }
}

        /* ===== WTG DASHBOARD STYLES ===== */
        .weather-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
            color: white;
            border-radius: 3px;
            padding: 20px;
            margin-bottom: 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .weather-main {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .weather-icon {
            font-size: 4rem;
        }

        .weather-temp {
            font-size: 3.5rem;
            font-weight: bold;
        }

        .weather-details {
            display: flex;
            gap: 30px;
        }

        .weather-item {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .weather-label {
            font-size: 0.9rem;
            opacity: 0.8;
            margin-bottom: 5px;
        }

        .weather-value {
            font-size: 1.2rem;
            font-weight: bold;
        }

        .location-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* ===== WTG CARDS GRID ===== */
        .wtg-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }

        .wtg-card {
            background-color: var(--card-bg);
            border-radius: 5px;
            padding: 20px;
            box-shadow: var(--shadow);
            transition: var(--transition);
            border: 2px solid transparent;
            position: relative;
        }

        .wtg-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        }

        .wtg-card.running {
            border-color: var(--success);
        }

        .wtg-card.stopped {
            border-color: var(--danger);
        }

        .wtg-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .wtg-code {
            font-size: 0.9rem;
            color: var(--gray-600);
        }

        .progress-gauge {
            width: 120px;
            height: 120px;
            margin: 0 auto 15px;
            position: relative;
        }

        .gauge-background {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background-color: var(--gray-200);
            position: relative;
            overflow: hidden;
        }

        .gauge-fill {
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            clip: rect(0, 120px, 120px, 60px);
        }

        .gauge-fill-inner {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: conic-gradient(var(--primary) 0%, var(--primary) 75%, transparent 75%, transparent 100%);
            transform: rotate(0deg);
            transition: transform 0.5s ease;
        }

        .gauge-center {
            position: absolute;
            top: 10px;
            left: 10px;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: var(--card-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            font-weight: bold;
        }

        .wtg-details {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
            font-size: 0.9rem;
        }

        .wtg-date {
            color: var(--gray-600);
        }

        .wtg-time {
            font-weight: bold;
        }

        .wtg-phase {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }

        .phase-selector {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 0.9rem;
        }

        .wtg-labels {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            margin-bottom: 10px;
        }

        .wtg-label-primary {
            font-weight: bold;
        }

        .wtg-label-secondary {
            color: var(--gray-600);
        }

        .wtg-temp {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 5px;
            font-size: 0.9rem;
            color: var(--warning);
        }

        /* ===== RIGHT SIDEBAR ===== */
        .dashboard-layout {
            display: flex;
            flex-direction: row;
            gap: 25px;
        }
        .main-panel {
            flex: 5;
        }
        .sidebar-content {
            background-color: var(--card-bg);
            border-radius: 0px;
            padding: 20px;
            border-left: 1px solid var(--border-color);
            flex: 1;
        }

        .sidebar-section {
            margin-bottom: 25px;
        }

        .sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border-color);
        }

        .sidebar-title {
            font-size: 1.1rem;
            font-weight: bold;
        }

        .checklist {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .checklist-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .checklist-item input[type="checkbox"],
        .checklist-item input[type="radio"] {
            width: 18px;
            height: 18px;
        }

        .map-preview {
            width: 100%;
            height: 150px;
            background-color: var(--gray-200);
            border-radius: 8px;
            margin-bottom: 15px;
            position: relative;
            overflow: hidden;
        }

        .map-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle, rgba(0,0,0,0) 70%, rgba(0,0,0,0.8) 100%),
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect width='100' height='100' fill='%231a1a2e'/%3E%3Cpath d='M20,20 L80,20 L80,80 L20,80 Z' fill='none' stroke='%2300bfff' stroke-width='2'/%3E%3Ccircle cx='30' cy='30' r='3' fill='%23ff0000'/%3E%3Ccircle cx='50' cy='50' r='3' fill='%23ffff00'/%3E%3Ccircle cx='70' cy='70' r='3' fill='%2300ff00'/%3E%3C/text%3E%3C/svg%3E");
            background-size: cover;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
        }

        .alert-badges {
            display: flex;
            justify-content: space-between;
            margin-bottom: 15px;
        }

        .alert-badge {
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: bold;
        }

        .alert-danger {
            background-color: var(--danger);
            color: white;
        }

        .alert-warning {
            background-color: var(--warning);
            color: white;
        }

        .alert-success {
            background-color: var(--success);
            color: white;
        }

        .report-btn {
            width: 100%;
            padding: 10px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: var(--transition);
        }

        .report-btn:hover {
            background-color: var(--info);
        }

        /* ===== WEATHER CARDS FROM ONE.HTML ===== */
        .weather-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 25px;
        }

        .weather-card {
            background-color: var(--card-bg);
            border-radius: 3px;
            padding: 20px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--border-color);
        }

        .weather-card.main {
            grid-column: span 2;
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .weather-icon {
            font-size: 3rem;
            color: var(--primary);
        }

        .weather-main-temp {
            font-size: 3rem;
            font-weight: 700;
        }

        .weather-main-details {
            flex: 1;
        }

        .weather-main-info {
            display: flex;
            justify-content: space-between;
            margin-top: 10px;
        }

        .weather-main-info div {
            text-align: center;
        }

        .weather-main-info div span:first-child {
            display: block;
            font-size: 0.8rem;
            color: var(--text-light);
        }

        .weather-main-info div span:last-child {
            font-weight: 600;
        }

        .sensor-location {
            font-weight: 600;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .sensor-location i {
            color: var(--primary);
        }

        .sensor-readings {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .sensor-reading {
            display: flex;
            justify-content: space-between;
            font-size: 0.9rem;
        }

        .sensor-reading span:first-child {
            color: var(--text-light);
        }

        .sensor-reading span:last-child {
            font-weight: 600;
        }

        /* ===== IRRIGATION MANAGEMENT SIDEBAR FROM ONE.HTML ===== */
        .irrigation-management {
            margin-bottom: 25px;
        }

        .irrigation-header {
            margin-bottom: 20px;
        }

        .irrigation-title {
            font-size: 1.2rem;
            font-weight: 700;
            margin-bottom: 15px;
        }

        .dropdown {
            width: 100%;
            padding: 10px 15px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            background-color: var(--card-bg);
            color: var(--text-color);
            margin-bottom: 15px;
        }

        .toggle-group {
            display: flex;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 20px;
        }

        .toggle-option {
            flex: 1;
            text-align: center;
            padding: 10px;
            cursor: pointer;
            transition: all 0.2s;
            background-color: var(--card-bg);
        }

        .toggle-option.active {
            background-color: var(--primary);
            color: white;
        }

        .tree-section {
            margin-bottom: 20px;
        }

        .tree-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            cursor: pointer;
            border-bottom: 1px solid var(--border-color);
        }

        .tree-title {
            font-weight: 600;
        }

        .tree-content {
            padding: 10px 0;
            display: none;
        }

        .tree-content.active {
            display: block;
        }

        .tree-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
        }

        .sensor-toggles {
            margin-bottom: 20px;
        }

        .sensor-toggle {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
        }

        .filter-options {
            display: flex;
            gap: 15px;
            margin-bottom: 15px;
        }

        .filter-option {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .clear-btn {
            width: 100%;
            padding: 10px;
            background-color: var(--danger-color);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .clear-btn:hover {
            background-color: #d42a4a;
        }

        /* ===== RESPONSIVE DESIGN ===== */
        @media (max-width: 1200px) {
            .wtg-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .dashboard-layout {
                grid-template-columns: 1fr;
            }
            
            .weather-cards {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .wtg-grid {
                grid-template-columns: 1fr;
            }
            
            .weather-header {
                flex-direction: column;
                gap: 20px;
            }
            
            .weather-details {
                flex-wrap: wrap;
                justify-content: center;
            }
            
            .weather-cards {
                grid-template-columns: 1fr;
            }
        }
      
/* Donut Chart Styles */
.donut-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 15px;
}

.donut-chart {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        var(--danger) 0% 70%,
        var(--success) 70% 93.3%,
        var(--warning) 93.3% 100%
    );
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-total {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
}

.donut-label {
    font-size: 10px;
    color: var(--gray-600);
    margin-top: 2px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color[style*="#ff4d4d"] {
    background-color: var(--danger) !important;
}

.legend-color[style*="#4CAF50"] {
    background-color: var(--success) !important;
}

.legend-color[style*="#ffeb3b"] {
    background-color: var(--warning) !important;
}

.legend-text {
    font-size: 12px;
    color: var(--text-color);
}

/* Connectivity Chart Styles */
.connectivity-chart {
    text-align: center;
    padding: 15px;
}

.connectivity-level {
    font-size: 24px;
    font-weight: bold;
    color: var(--success);
    margin-bottom: 15px;
}

.dots-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: var(--transition);
}

.dot.connected {
    background-color: var(--success);
}

.dot.disconnected {
    background-color: var(--danger);
}

.connectivity-status {
    font-size: 12px;
    color: var(--gray-600);
}

/* Map Styles */
.map-container {
    background: var(--card-bg);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.system-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* WTG Card Styles */
.wtg-card {
    background: var(--card-bg);
    border-radius: 5px;
    padding: 15px;
    margin: 10px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.wtg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.wtg-code {
    font-weight: bold;
    color: var(--text-color);
}

.wtg-card.stopped {
}

.wtg-card.running {
}

/* Dark mode specific adjustments */
.dark-mode .donut-center {
    border: 1px solid var(--gray-700);
}

.dark-mode .donut-chart {
    box-shadow: 0 0 0 1px var(--border-color);
}

.dark-mode .connectivity-chart {
    background: var(--card-bg);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.dark-mode .map-container {
    background: var(--gray-800);
}

/* Ensure proper contrast in dark mode */
.dark-mode .legend-text,
.dark-mode .connectivity-status,
.dark-mode .donut-label {
    color: var(--gray-400);
}

.dark-mode .donut-total,
.dark-mode .wtg-code {
    color: var(--gray-100);
}

/* Hover effects for interactive elements */
.wtg-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.dark-mode .wtg-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .donut-chart-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .donut-chart {
        width: 100px;
        height: 100px;
    }
    
    .donut-center {
        width: 60px;
        height: 60px;
    }
    
    .donut-total {
        font-size: 16px;
    }
    
    .map-container {
        height: 250px;
    }
}
/* ===== IRRIGATION WIDGET STYLES ===== */
.irrigation-widget {
    background-color: var(--card-bg);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    font-family: var(--ui-font);
    direction: rtl;
    text-align: right;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
}

.header-box {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    padding: 10px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.dark-mode .header-box {
    background-color: rgba(255, 255, 255, 0.05);
}

.header-box.status-active {
    background-color: rgba(21, 114, 161, 0.1);
    border-right: 3px solid var(--primary);
}

.dark-mode .header-box.status-active {
    background-color: rgba(21, 114, 161, 0.2);
}

.header-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.header-value {
    font-weight: bold;
    font-size: 1rem;
}

.zone-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.info-box {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    padding: 10px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.dark-mode .info-box {
    background-color: rgba(255, 255, 255, 0.05);
}

.info-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.info-value {
    font-weight: bold;
    font-size: 1rem;
}

.section-title {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-title h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin: 0;
}

.sensor-indicators {
    margin-bottom: 20px;
}

.sensor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.sensor-row:last-child {
    border-bottom: none;
}

.sensor-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sensor-label {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.sensor-value {
    font-weight: bold;
    font-size: 0.9rem;
}

.indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-left: 10px;
}

.indicator-success {
    background-color: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.indicator-warning {
    background-color: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.indicator-danger {
    background-color: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.equipment-section {
    margin-top: 10px;
}

.equipment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.equipment-row:last-child {
    border-bottom: none;
}

.equipment-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.equipment-label {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.equipment-value {
    font-weight: bold;
    font-size: 0.9rem;
}

.equipment-icon {
    font-size: 1.2rem;
    margin-left: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .widget-header,
    .zone-info {
        flex-direction: column;
    }
    
    .header-box,
    .info-box {
        margin-bottom: 10px;
    }
}

        .chart-container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            max-width: 700px;
            width: 100%;
        }

        .chart-title {
            text-align: center;
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 30px;
            color: #333;
        }

        .chart-wrapper {
            position: relative;
            height: 400px;
            border: 1px solid #ccc;
            background: white;
        }

        .y-axis {
            position: absolute;
            right: 0;
            top: 0;
            bottom: 40px;
            width: 50px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 20px 10px;
        }

        .y-label {
            font-size: 12px;
            color: #666;
            text-align: right;
        }

        .y-axis-title {
            position: absolute;
            right: -25px;
            top: 50%;
            transform: translateY(-50%) rotate(-90deg);
            font-size: 14px;
            color: #333;
            white-space: nowrap;
        }

        .chart-area {
            position: absolute;
            left: 60px;
            right: 70px;
            top: 20px;
            bottom: 60px;
            background: linear-gradient(to bottom, transparent 0%, transparent 100%);
        }

        .grid-lines {
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
        }

        .grid-line {
            position: absolute;
            left: 0;
            right: 0;
            height: 1px;
            background: #e0e0e0;
        }

        .highlight-zone {
            position: absolute;
            top: 0;
            bottom: 0;
            background: rgba(173, 216, 230, 0.3);
        }

        .zone1 {
            right: 66.67%;
            width: 16.67%;
        }

        .zone2 {
            right: 16.67%;
            width: 16.67%;
        }

        svg {
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            width: 100%;
            height: 100%;
        }

        .x-axis {
            position: absolute;
            left: 60px;
            right: 70px;
            bottom: 20px;
            height: 40px;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            padding-top: 10px;
        }

        .x-label {
            font-size: 12px;
            color: #666;
        }

        .x-axis-title {
            position: absolute;
            left: 50%;
            bottom: 0;
            transform: translateX(-50%);
            font-size: 14px;
            color: #333;
        }