/* ==========================================================================
   CENTRAL SCADA DASHBOARD SYSTEM - STYLESHEET
   North South Ha Irrigation Multi-Station Command Center
   ========================================================================== */

:root {
    --bg-dark: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-card: #1e293b;
    --border-accent: #0284c7;
    
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    
    --status-online: #10b981;
    --status-online-glow: rgba(16, 185, 129, 0.35);
    --status-warning: #f59e0b;
    --status-warning-glow: rgba(245, 158, 11, 0.35);
    --status-danger: #ef4444;
    --status-danger-glow: rgba(239, 68, 68, 0.35);
    --status-offline: #64748b;
    
    --accent-cyan: #38bdf8;
    --accent-blue: #0284c7;
    --accent-purple: #818cf8;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(2, 132, 199, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 85% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==================== HEADER BAR ==================== */
.dashboard-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #1e293b;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border: 1px solid #38bdf8;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #ffffff, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 2px;
    font-weight: 500;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.live-clock-badge {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
}

.clock-time {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.clock-date {
    font-size: 11px;
    color: var(--text-sub);
    border-left: 1px solid #334155;
    padding-left: 10px;
}

.btn-dashboard-action {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #38bdf8;
    border: 1px solid #0284c7;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    text-decoration: none;
}

.btn-dashboard-action:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    transform: translateY(-1px);
}

/* ==================== SUMMARY KPI STATS BAR ==================== */
.dashboard-kpi-container {
    padding: 20px 24px 10px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-cyan);
}

.kpi-card.kpi-online::before { background: var(--status-online); }
.kpi-card.kpi-running::before { background: var(--accent-cyan); }
.kpi-card.kpi-warning::before { background: var(--status-warning); }
.kpi-card.kpi-danger::before { background: var(--status-danger); }

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
}

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

.kpi-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ==================== FILTER & SEARCH BAR ==================== */
.dashboard-filter-bar {
    padding: 10px 24px 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 12px 8px 36px;
    color: #f8fafc;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #1e293b;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-sub);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active, .filter-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

/* ==================== MULTI-STATION GRID (12 CARDS) ==================== */
.dashboard-grid {
    padding: 0 24px 30px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

/* STATION CARD */
.station-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.station-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.25);
    background: var(--bg-card-hover);
}

.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.station-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.station-id-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.station-name {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px var(--status-online-glow);
}

.status-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px var(--status-warning-glow);
}

.status-pill.offline {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pill.online .status-dot {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

.status-pill.warning .status-dot {
    background: #f59e0b;
}

.status-pill.offline .status-dot {
    background: #64748b;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* METRICS PANEL INSIDE CARD */
.station-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.metric-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #1e293b;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
}

/* PUMPS MINI STATUS BADGES */
.pumps-bar {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pumps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 600;
}

.pumps-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pump-badge {
    flex: 1;
    min-width: 60px;
    padding: 5px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid transparent;
}

.pump-badge.running {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

.pump-badge.stopped {
    background: rgba(30, 41, 59, 0.7);
    color: #64748b;
    border-color: #334155;
}

.pump-badge.fault {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
    animation: blink-danger 1s infinite alternate;
}

@keyframes blink-danger {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ACTIVE ALARM BANNER IN CARD */
.station-alarm-box {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    color: #fca5a5;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-alarm-box.clean {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #64748b;
}

/* CARD ACTION BUTTON */
.station-card-footer {
    padding-top: 4px;
}

.btn-open-hmi {
    width: 100%;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border: 1px solid #38bdf8;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-open-hmi:hover {
    background: linear-gradient(135deg, #0284c7, #0284c7);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
}

/* FOOTER */
.dashboard-footer {
    margin-top: auto;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid #1e293b;
    padding: 12px 24px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
