/* Monitoring module - shared/base styles */

.monitoring-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    background: var(--bg);
}

/* Sidebar */
.monitoring-sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.monitoring-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
}

.monitoring-header svg {
    color: var(--primary);
}

.monitoring-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

.alert-badge {
    margin-left: auto;
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.alert-badge:empty,
.alert-badge:contains("0") {
    display: none;
}

.health-indicator {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.health-indicator.warning {
    background: var(--warning);
}

.health-indicator.error {
    background: var(--error);
}

.monitoring-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

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

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

/* Main Content */
.monitoring-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.monitoring-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 64px;
    z-index: 100;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toolbar-left h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.last-updated {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-range-selector select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
}

.time-range-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.toolbar-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--primary);
}

.toolbar-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.monitoring-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Quick Stats Bar */
.quick-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    z-index: 100;
}

.quick-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.quick-stat svg {
    color: var(--primary);
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--text);
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.error {
    color: var(--error);
}

/* Dashboard Grid (default content) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.card-title svg {
    color: var(--primary);
}

.card-action {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
}

.card-action:hover {
    text-decoration: underline;
}

/* Services List */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.service-item:hover {
    border-color: var(--primary);
}

.service-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.service-status.running {
    background: var(--success);
}

.service-status.stopped {
    background: var(--error);
}

.service-status.warning {
    background: var(--warning);
}

.service-info {
    flex: 1;
}

.service-name {
    font-weight: 500;
    color: var(--text);
}

.service-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.service-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .monitoring-sidebar {
        width: 200px;
    }

    .quick-stats-bar {
        left: 200px;
        gap: 1rem;
    }

    .quick-stat .stat-label {
        display: none;
    }
}

@media (max-width: 768px) {
    .monitoring-layout {
        flex-direction: column;
    }

    .monitoring-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .monitoring-nav {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .nav-item {
        flex-direction: column;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
        border-right: none !important;
        border-radius: 6px;
    }

    .nav-item.active {
        border-bottom: 2px solid var(--primary);
    }

    .nav-item span:not(.alert-badge):not(.health-indicator) {
        display: none;
    }

    .monitoring-footer {
        display: none;
    }

    .monitoring-toolbar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        position: relative;
        top: 0;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: space-between;
    }

    .quick-stats-bar {
        left: 0;
        gap: 0.5rem;
        padding: 0.5rem;
        flex-wrap: wrap;
    }

    .quick-stat {
        font-size: 0.75rem;
    }

    .monitoring-content {
        padding-bottom: 80px;
    }
}
