/**
 * MKR IoT Dashboard Enhanced Controls - Phase 1 Step 2
 */

/* Control Panel Container */
.mkr-chart-controls {
    background: #252525;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid #333;
}

.mkr-controls-title {
    font-size: 16px;
    color: #fff;
    margin: 0 0 20px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mkr-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.mkr-control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mkr-control-label {
    font-size: 13px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

/* Aggregation Buttons */
.mkr-agg-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mkr-agg-btn {
    background: #1a1a1a;
    color: #999;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mkr-agg-btn:hover {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

.mkr-agg-btn.active {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
}

/* Toggle Switches */
.mkr-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mkr-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.mkr-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mkr-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: 0.3s;
    border-radius: 24px;
}

.mkr-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #666;
    transition: 0.3s;
    border-radius: 50%;
}

.mkr-toggle input:checked + .mkr-toggle-slider {
    background-color: #2196F3;
}

.mkr-toggle input:checked + .mkr-toggle-slider:before {
    background-color: #fff;
    transform: translateX(24px);
}

.mkr-toggle-label {
    font-size: 14px;
    color: #e0e0e0;
}

/* Select Dropdown */
.mkr-select {
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.mkr-select:hover {
    border-color: #444;
    background: #2a2a2a;
}

.mkr-select:focus {
    outline: none;
    border-color: #2196F3;
}

/* Slider */
.mkr-slider-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mkr-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
}

.mkr-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mkr-slider::-webkit-slider-thumb:hover {
    background: #42a5f5;
    transform: scale(1.1);
}

.mkr-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.mkr-slider::-moz-range-thumb:hover {
    background: #42a5f5;
    transform: scale(1.1);
}

.mkr-slider-value {
    font-size: 14px;
    color: #2196F3;
    font-weight: 500;
}

/* Chart Loading State */
.mkr-chart-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 37, 37, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.mkr-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: mkr-spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .mkr-controls-grid {
        grid-template-columns: 1fr;
    }
    
    .mkr-agg-buttons {
        flex-direction: column;
    }
    
    .mkr-agg-btn {
        width: 100%;
    }
}

/* Info Badge */
.mkr-info-badge {
    display: inline-block;
    background: #1a1a1a;
    color: #2196F3;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #333;
}

/* Status Indicator */
.mkr-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #999;
}

.mkr-status-dot-small {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    animation: mkr-pulse 2s infinite;
}

@keyframes mkr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Anomaly Legend */
.mkr-anomaly-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 12px;
}

.mkr-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #999;
}

.mkr-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Comparison Period Hidden by Default */
#mkr-comparison-period-container,
#mkr-threshold-container {
    margin-top: 8px;
}
