/* ObservaLite - Dark Ops/Monitoring Theme */
/* Green/Orange/Red status colors for operational monitoring */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --bg-hover: #292e36;
    --border-color: #30363d;
    --border-light: #3d444d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-purple: #bc8cff;
    --status-healthy: #3fb950;
    --status-degraded: #d29922;
    --status-down: #f85149;
    --status-healthy-bg: rgba(63, 185, 80, 0.15);
    --status-degraded-bg: rgba(210, 153, 34, 0.15);
    --status-down-bg: rgba(248, 81, 73, 0.15);
    --severity-critical: #f85149;
    --severity-warning: #d29922;
    --severity-info: #58a6ff;
    --chart-line: #58a6ff;
    --chart-fill: rgba(88, 166, 255, 0.1);
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    --transition: 0.2s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Layout */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
    color: var(--status-healthy);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.08);
    border-left-color: var(--accent-blue);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.healthy { background: var(--status-healthy); box-shadow: 0 0 6px var(--status-healthy); }
.status-dot.degraded { background: var(--status-degraded); box-shadow: 0 0 6px var(--status-degraded); }
.status-dot.down { background: var(--status-down); box-shadow: 0 0 6px var(--status-down); }

.content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 50;
}

.topbar h1 {
    font-size: 18px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.page-content {
    flex: 1;
    padding: 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #4393e6; }
.btn-success { background: var(--status-healthy); border-color: var(--status-healthy); color: #fff; }
.btn-success:hover { background: #36a348; }
.btn-danger { background: var(--status-down); border-color: var(--status-down); color: #fff; }
.btn-danger:hover { background: #e04842; }
.btn-warning { background: var(--status-degraded); border-color: var(--status-degraded); color: #fff; }
.btn-warning:hover { background: #c08d1e; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Grid layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.stat-card.healthy .stat-value { color: var(--status-healthy); }
.stat-card.degraded .stat-value { color: var(--status-degraded); }
.stat-card.down .stat-value { color: var(--status-down); }
.stat-card.info .stat-value { color: var(--accent-blue); }

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
    cursor: pointer;
}

.service-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-lg);
}

.service-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.service-name {
    font-weight: 600;
    font-size: 15px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.healthy { background: var(--status-healthy-bg); color: var(--status-healthy); }
.status-badge.degraded { background: var(--status-degraded-bg); color: var(--status-degraded); }
.status-badge.down { background: var(--status-down-bg); color: var(--status-down); }
.status-badge.firing { background: var(--status-down-bg); color: var(--status-down); }
.status-badge.resolved { background: var(--status-healthy-bg); color: var(--status-healthy); }
.status-badge.open { background: var(--status-down-bg); color: var(--status-down); }
.status-badge.acknowledged { background: var(--status-degraded-bg); color: var(--status-degraded); }

.severity-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.critical { background: rgba(248,81,73,0.2); color: var(--severity-critical); }
.severity-badge.warning { background: rgba(210,153,34,0.2); color: var(--severity-warning); }
.severity-badge.info { background: rgba(88,166,255,0.2); color: var(--severity-info); }

.service-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* Chart container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.sparkline-container {
    height: 80px;
    position: relative;
    overflow: hidden;
}

.sparkline-canvas {
    width: 100%;
    height: 100%;
}

.metric-chart-area {
    height: 200px;
    position: relative;
}

.metric-chart-canvas {
    width: 100%;
    height: 100%;
}

/* Filters */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
    padding: 6px 12px;
    font-size: 13px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}

.filter-bar select:focus, .filter-bar input:focus {
    border-color: var(--accent-blue);
}

/* Log viewer */
.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-entry:hover { background: var(--bg-hover); }

.log-level {
    font-weight: 700;
    min-width: 65px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.log-level.DEBUG { color: var(--text-muted); background: rgba(110,118,129,0.15); }
.log-level.INFO { color: var(--accent-blue); background: rgba(88,166,255,0.15); }
.log-level.WARNING { color: var(--status-degraded); background: rgba(210,153,34,0.15); }
.log-level.ERROR { color: var(--status-down); background: rgba(248,81,73,0.15); }
.log-level.CRITICAL { color: #ff6b6b; background: rgba(255,107,107,0.2); }

.log-timestamp { color: var(--text-muted); min-width: 180px; }
.log-service { color: var(--accent-purple); min-width: 120px; }
.log-message { color: var(--text-primary); flex: 1; word-break: break-word; }

/* Incident timeline */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 22px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-primary);
}

.timeline-item.critical::before { background: var(--severity-critical); }
.timeline-item.warning::before { background: var(--severity-warning); }
.timeline-item.resolved::before { background: var(--status-healthy); }

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-title {
    font-weight: 600;
    font-size: 14px;
}

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-body {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.timeline-actions {
    display: flex;
    gap: 8px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .logo-text, .nav-link span:not(.nav-icon) { display: none; }
    .nav-link { justify-content: center; padding: 12px; }
    .content { margin-left: 60px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .service-grid { grid-template-columns: 1fr; }
    .sidebar-footer { display: none; }
}
