/**
 * System Monitoring Styles
 * Styles for network/system monitoring indicator and modal
 */

/* ========================================
   SIDEBAR MONITORING INDICATOR
   ======================================== */

.sidebar-monitoring {
    padding: 10px 15px;
    margin: 10px 8px 8px 8px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(102, 126, 234, 0.1);
    flex-shrink: 0;
    margin-top: auto; /* Push to bottom of sidebar */
}

.sidebar-monitoring:hover {
    background-color: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.monitoring-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
}

.monitoring-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.monitoring-status.online {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.monitoring-status.warning {
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.monitoring-status.offline {
    background: #f87171;
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
    animation: none;
}

/* pulse keyframes defined in base.css */

.monitoring-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    overflow: hidden;
    flex: 1;
}

.monitoring-label {
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.monitoring-latency {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Collapsed sidebar - show latency beside dot */
.sidebar.collapsed .monitoring-text {
    display: none;
}

.sidebar.collapsed .sidebar-monitoring {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sidebar.collapsed .monitoring-indicator {
    flex-direction: column;
    gap: 3px;
    text-align: center;
    justify-content: center;
    align-items: center;
}

/* Show latency number in collapsed mode */
.monitoring-latency-collapsed {
    display: none;
}

.sidebar.collapsed .monitoring-latency-collapsed {
    display: block;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    line-height: 1;
    margin-top: 2px;
}

/* ========================================
   MONITORING MODAL
   ======================================== */

#monitoringModal .modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.monitoring-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #667eea;
    flex-shrink: 0;
}

.monitoring-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.monitoring-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Server Info Section */
.monitoring-server-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.server-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.server-info-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
}

.server-info-item .value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Stats Grid */
.monitoring-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .monitoring-stats-grid {
        grid-template-columns: 1fr;
    }
}

.monitoring-stat-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.monitoring-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.monitoring-stat-card.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card-icon.network {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
}

.stat-card-icon.memory {
    background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
    color: white;
}

.stat-card-icon.cpu {
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
    color: white;
}

.stat-card-icon.disk {
    background: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
    color: white;
}

.stat-card-icon.latency {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
    color: white;
}

.stat-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.stat-card-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.stat-card-detail {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Progress Bar */
.stat-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.stat-progress-fill.low {
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
}

.stat-progress-fill.medium {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

.stat-progress-fill.high {
    background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
}

/* Chart Container */
.monitoring-chart-container {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.monitoring-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.monitoring-chart-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #374151;
}

.chart-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #6b7280;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.send {
    background: #67e8f9;
}

.legend-color.receive {
    background: #c4b5fd;
}

.legend-color.cpu {
    background: #fca5a5;
}

.legend-color.memory {
    background: #67e8f9;
}

#monitoringChart {
    width: 100%;
    height: 200px;
}

/* Uptime Badge */
.uptime-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #065f46;
}

.uptime-badge i {
    color: #10b981;
}

/* Modal Footer */
.monitoring-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #f9fafb;
}

.last-updated {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .monitoring-server-info {
        grid-template-columns: 1fr 1fr;
    }
    
    .monitoring-modal-body {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .monitoring-server-info {
        grid-template-columns: 1fr;
    }
}
