/* SPDX-License-Identifier: MIT */
/* Monitor Page - Extends Base Styles */

/* Monitor specific grid layout */
.monitor-grid {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-top: var(--space-md);
}

/* Charts Container */
.charts-container {
    margin: var(--space-lg) 0 var(--space-xl);
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: repeat(2, 1fr);
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-lg);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(100, 100, 100, 0.5);
}

.chart-card.full-width {
    grid-column: 1 / -1;
    min-height: 320px;
}

.chart-card h2 {
    margin: 0 0 var(--space-md);
    font-size: 1.05rem;
    font-weight: 600;
    color: #9cc8ff;
    letter-spacing: 0.5px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
}

.chart-header h2 {
    margin: 0;
    flex: 1;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    min-height: 240px;
    flex: 1;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
    font-size: var(--font-size-sm);
}

/* Monitor cards - extending base card system */
.monitor-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}

.monitor-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.monitor-card h2 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-semibold);
    color: #9cc8ff;
}

/* Monitor tables - extending base table system */
.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-md);
}

.monitor-table th,
.monitor-table td {
    padding: 0.35rem var(--space-sm);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.monitor-table th {
    font-weight: var(--font-weight-semibold);
    color: #b8dafc;
}

.monitor-table tr:last-child td {
    border-bottom: none;
}

/* Status indicators */
.status-ok {
    color: #4ade80;
}

.status-warn {
    color: #fbbf24;
}

.status-error {
    color: #f87171;
}

/* Monitor status display */
.monitor-status {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-md);
}

/* Monitor footer */
.monitor-footer {
    margin-top: var(--space-xl);
    font-size: var(--font-size-xs);
    opacity: 0.5;
    text-align: left;
}

/* Memory cleanup button and actions */
.memory-actions {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.cleanup-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 28px;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    flex-shrink: 0;
}

.cleanup-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cleanup-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cleanup-btn:disabled {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cleanup-status {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 20px;
    display: flex;
    align-items: center;
    margin-top: var(--space-sm);
    text-align: center;
    justify-content: center;
}

.cleanup-status.loading {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.cleanup-status.success {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.cleanup-status.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Memory dropdown styles */
.memory-dropdown {
    margin-top: var(--space-md);
}

.dropdown-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    color: #b8dafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-toggle[aria-expanded="true"] {
    border-color: #9cc8ff;
}

.dropdown-content {
    margin-top: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
}

/* Generic metric dropdown container */
.metric-dropdown {
    margin-top: var(--space-md);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .monitor-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        min-height: 240px;
    }
    
    .monitor-card {
        padding: var(--space-sm) var(--space-md);
    }
    
    .monitor-table {
        font-size: var(--font-size-sm);
    }
    
    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-xs);
    }
    
    .chart-header h2 {
        text-align: center;
    }
    
    .cleanup-btn {
        font-size: 0.75rem;
        padding: 5px 8px;
        min-height: 26px;
    }
    
    .cleanup-status {
        font-size: 0.7rem;
    }
}