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

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f0f4f8;
    color: #333;
    direction: rtl;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #00796b, #004d40);
    color: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-brand h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.nav-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-right: 8px;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.2);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 16px 24px;
    flex: 1;
    min-width: 150px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-top: 3px solid #00796b;
}

.stat-card.stat-success { border-top-color: #4caf50; }
.stat-card.stat-danger { border-top-color: #f44336; }
.stat-card.stat-warning { border-top-color: #ff9800; }

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #00796b;
}

.stat-success .stat-value { color: #4caf50; }
.stat-danger .stat-value { color: #f44336; }
.stat-warning .stat-value { color: #ff9800; }

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

/* System Alerts Banner */
.system-alerts-banner {
    background: #fff3e0;
    border: 1px solid #ffcc02;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.system-alerts-banner h3 {
    color: #e65100;
    margin-bottom: 8px;
}

.system-alert {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.system-alert.critical { background: #ffebee; border-right: 3px solid #f44336; }
.system-alert.warning { background: #fff8e1; border-right: 3px solid #ff9800; }
.system-alert.info { background: #e8f5e9; border-right: 3px solid #4caf50; }

.alert-time {
    color: #888;
    margin-left: 8px;
    font-size: 0.8rem;
}

/* Search */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-bar input, .search-bar select {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    direction: rtl;
}

.search-bar input {
    flex: 1;
    max-width: 400px;
}

/* Table */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #00796b;
    color: white;
}

.data-table th {
    padding: 10px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #e0f2f1;
    cursor: pointer;
}

.unit-row.row-disconnected {
    background: #fff5f5;
}

.unit-row.row-disconnected:hover {
    background: #ffebee;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }

/* Alert Count */
.alert-count {
    background: #f44336;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Battery low */
.battery-low { color: #c62828; font-weight: 700; background: #ffebee; }

/* Serial & Timestamp */
.serial { font-family: monospace; font-size: 0.8rem; color: #666; }
.timestamp { font-family: monospace; font-size: 0.85rem; color: #555; }

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #00796b;
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* Unit Header */
.unit-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.unit-header h2 { color: #004d40; }

/* Info Grid */
.unit-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.info-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.info-card h3 {
    color: #00796b;
    margin-bottom: 12px;
    border-bottom: 2px solid #e0f2f1;
    padding-bottom: 8px;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #f5f5f5;
}

.info-table td:first-child {
    font-weight: 600;
    color: #555;
    width: 120px;
}

.description {
    white-space: pre-line;
    font-size: 0.85rem;
}

/* Weather */
.weather-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.weather-day {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 10px;
    background: #e0f7fa;
    border-radius: 8px;
}

.weather-date { font-weight: 600; font-size: 0.8rem; color: #006064; }
.weather-desc { font-size: 0.75rem; color: #555; margin: 4px 0; }
.weather-temp { font-size: 1.1rem; font-weight: bold; color: #00838f; }
.weather-detail { font-size: 0.75rem; color: #666; }

/* Valves Grid */
.valves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.valve-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-top: 3px solid #ccc;
}

.valve-card.valve-active { border-top-color: #4caf50; }
.valve-card.valve-inactive { border-top-color: #bdbdbd; }

.valve-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.valve-type { font-size: 0.75rem; color: #888; }
.valve-status { font-size: 0.8rem; margin-top: 4px; }
.valve-output { font-size: 0.75rem; color: #999; }

/* Sections */
.section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.section h3 {
    color: #00796b;
    margin-bottom: 12px;
}

.empty-state {
    color: #999;
    text-align: center;
    padding: 20px;
}

/* Severity */
.severity-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.severity-badge.severity-critical { background: #ffebee; color: #c62828; }
.severity-badge.severity-warning { background: #fff8e1; color: #e65100; }
.severity-badge.severity-info { background: #e8f5e9; color: #2e7d32; }

tr.severity-critical { background: #fff5f5; }
tr.severity-warning { background: #fffde7; }

/* Buttons */
.btn-ack {
    background: #00796b;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-ack:hover { background: #004d40; }

.ack-done {
    color: #999;
    font-size: 0.8rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 16px;
    color: #999;
    font-size: 0.8rem;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .unit-info-grid { grid-template-columns: 1fr; }
    .stats-bar { flex-direction: column; }
    .navbar { flex-direction: column; gap: 8px; }
}
