/* Monitor Dashboard — ServiceAlert.ai */

/* ── Summary Stat Bar ────────────────────────────────────── */
.mon-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.mon-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
}

.mon-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.mon-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.mon-stat-value.green { color: #10B981; }
.mon-stat-value.red { color: #ef4444; }
.mon-stat-value.amber { color: #f59e0b; }
.mon-stat-value.gray { color: var(--text-secondary); }
.mon-stat-value.blue { color: var(--accent); }

a.mon-stat-card { text-decoration: none; color: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
a.mon-stat-card:hover { border-color: var(--accent); background: var(--bg-tertiary); }

.mon-trend { display: inline-block; font-size: 0.6875rem; font-weight: 700; margin-left: 4px; vertical-align: middle; }
.mon-trend.bad { color: #ef4444; }
.mon-trend.good { color: #10B981; }

/* ── Two-Column Dashboard Grid ───────────────────────────── */
.mon-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

/* ── Chart Cards ─────────────────────────────────────────── */
.mon-charts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mon-chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.mon-chart-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.mon-chart-wrap {
    position: relative;
    height: 270px;
}

/* ── Uptime Heatmap ──────────────────────────────────────── */
.mon-heatmap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mon-heatmap-header {
    display: flex;
    gap: 3px;
    padding-left: 120px;
    margin-bottom: 2px;
}

.mon-heatmap-header span {
    flex: 1;
    text-align: center;
    font-size: 0.625rem;
    color: var(--text-tertiary);
    font-weight: 600;
}

.mon-heatmap-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.mon-heatmap-label {
    width: 120px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}
a.mon-heatmap-label:hover { color: var(--accent); }

.mon-heatmap-cell {
    flex: 1;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.1s, transform 0.1s;
    cursor: default;
    transition: opacity 0.1s;
}

.mon-heatmap-cell:hover {
    opacity: 0.8;
}

.mon-heatmap-cell.great { background: #10B981; }
.mon-heatmap-cell.good { background: #34D399; }
.mon-heatmap-cell.warn { background: #f59e0b; }
.mon-heatmap-cell.bad { background: #ef4444; }
.mon-heatmap-cell.none { background: var(--bg-tertiary); }

/* ── Sidebar Panels ──────────────────────────────────────── */
.mon-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mon-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
}

.mon-panel h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.mon-incident-row {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.mon-incident-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mon-incident-meta {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.mon-incident-meta .ongoing {
    color: #ef4444;
    font-weight: 600;
}

/* Alert channel bars */
.mon-channel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.75rem;
}

.mon-channel-label {
    width: 60px;
    color: var(--text-secondary);
    text-transform: capitalize;
    flex-shrink: 0;
}

.mon-channel-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.mon-channel-sent {
    height: 100%;
    background: #10B981;
    border-radius: 4px 0 0 4px;
}

.mon-channel-failed {
    height: 100%;
    background: #ef4444;
}

.mon-channel-count {
    width: 40px;
    text-align: right;
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.6875rem;
    flex-shrink: 0;
}

/* Maintenance rows */
.mon-maint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
}

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

.mon-maint-title {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.mon-maint-time {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.mon-empty-small {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    text-align: center;
    padding: 12px 0;
}

/* ── Sparkline in monitor cards ──────────────────────────── */
.mon-sparkline-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.mon-sparkline-wrap svg {
    flex-shrink: 0;
}

.mon-uptime-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}

.mon-uptime-badge.great { background: rgba(16,185,129,0.12); color: #10B981; }
.mon-uptime-badge.good { background: rgba(52,211,153,0.12); color: #34D399; }
.mon-uptime-badge.warn { background: rgba(245,158,11,0.12); color: #f59e0b; }
.mon-uptime-badge.bad { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Infrastructure Tags ────────────────────────────────── */
.mon-infra-tag {
    display: inline-block; font-size: 0.625rem; font-weight: 600;
    padding: 1px 6px; border-radius: 4px; margin-top: 4px;
    background: var(--bg-tertiary); color: var(--text-secondary);
}

/* ── Alert Channel Badges ───────────────────────────────── */
.mon-alert-channels { display: flex; gap: 3px; flex-wrap: wrap; margin: 4px 0; }
.mon-channel-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 4px; font-size: 0.5625rem; font-weight: 700;
    background: var(--bg-tertiary); color: var(--text-tertiary);
}

/* ── Stability Indicator ────────────────────────────────── */
.mon-stability {
    display: inline-block; font-size: 0.6875rem; font-weight: 600;
    padding: 1px 6px; border-radius: 4px; margin: 2px 0;
}
.mon-stability.good { background: rgba(16,185,129,0.12); color: #10B981; }
.mon-stability.warn { background: rgba(245,158,11,0.12); color: #f59e0b; }
.mon-stability.bad { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Sort & Tag Dropdowns ───────────────────────────────── */
.monitor-sort, .monitor-tag-filter {
    padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-secondary); color: var(--text-primary); font-size: 0.8125rem; cursor: pointer;
}

/* ── Empty Good States ──────────────────────────────────── */
.mon-empty-good {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 16px; text-align: center; color: #10B981; font-size: 0.8125rem; font-weight: 500;
}
.mon-empty-good svg { flex-shrink: 0; }

/* ── Sidebar Improvements ───────────────────────────────── */
a.mon-incident-link { text-decoration: none; color: var(--text-primary); font-weight: 600; font-size: 0.8125rem; }
a.mon-incident-link:hover { color: var(--accent); }
.mon-incident-status { font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.mon-incident-status.active { color: #ef4444; }
.mon-incident-status.resolved { color: #10B981; }
.mon-panel-count { font-size: 0.6875rem; font-weight: 700; color: var(--text-tertiary); margin-left: 4px; }

/* ── Sidebar Toggle (Mobile) ────────────────────────────── */
.mon-sidebar-toggle {
    display: none; align-items: center; gap: 6px;
    padding: 8px 14px; border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-secondary); color: var(--text-secondary);
    font-size: 0.8125rem; font-weight: 500; cursor: pointer; margin-bottom: 12px;
}
.mon-sidebar-toggle:hover { background: var(--bg-tertiary); }
.mon-sidebar-toggle.active { background: var(--bg-tertiary); border-color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .mon-grid { grid-template-columns: 1fr; }
    .mon-sidebar { display: none; }
    .mon-sidebar.open { display: flex; }
    .mon-sidebar-toggle { display: flex; }
}

@media (max-width: 768px) {
    .mon-heatmap-label { width: 80px; font-size: 0.625rem; }
}
