/* Charts Row - Improved Responsive Layout */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 300px; /* Fixed height for charts */
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.chart-header h3 {
    font-size: 14px;
    color: #333;
    margin: 0;
}

.chart-value {
    font-size: 16px;
    font-weight: 600;
    color: #4361ee;
}

.chart-container canvas {
    flex: 1;
    width: 100% !important;
    height: calc(100% - 40px) !important;
    max-height: 240px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 280px;
    }
}

/* Metrics Grid - Make cards more compact */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.metric-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #4361ee;
    font-size: 18px;
    flex-shrink: 0;
}

.metric-content {
    flex: 1;
    min-width: 0; /* Prevent text overflow */
}

.metric-content h3 {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.2;
}

.metric-details {
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: #888;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.progress-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

/* Config Panel - Make it more compact */
.config-panel {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.config-header h3 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.config-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.config-tab {
    padding: 6px 12px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    font-weight: 500;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.config-tab:hover {
    background: #f8f9fa;
    color: #4361ee;
}

.config-tab.active {
    background: #4361ee;
    color: white;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.config-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.config-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 12px;
}

.config-control {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.config-control input,
.config-control select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.config-control input:focus,
.config-control select:focus {
    outline: none;
    border-color: #4361ee;
}

.config-item small {
    color: #888;
    font-size: 11px;
}

/* Stats Panels - Make tables scrollable horizontally */
.stats-panel {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.panel-header h3 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.table-container {
    overflow-x: auto;
    margin: 0 -5px;
    padding: 0 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensure tables are readable on small screens */
}

th {
    text-align: left;
    padding: 10px 8px;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

td {
    padding: 8px;
    border-bottom: 1px solid #e9ecef;
    color: #666;
    font-size: 12px;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #888;
}

/* Make the performance dashboard container responsive */
.performance-dashboard {
    padding: 15px;
    max-width: 100%;
    overflow-x: hidden;
}

/* Responsive fixes for very small screens */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 18px;
    }
    
    .config-tab {
        padding: 4px 8px;
        font-size: 12px;
    }
}