/* --- Multi-Client Dashboard Container --- */
.mc-dashboard-container {
    width: 750px;  /* [FIX] Reduced Default Width */
    height: 500px; /* [FIX] Reduced Default Height */
    background: #09090b;
    border: 1px solid #1a1a1c;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Top Control Bar --- */
.mc-control-bar {
    height: 60px;
    background: #0d0d0f;
    border-bottom: 1px solid #1a1a1c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
}

.mc-stats-group { display: flex; gap: 20px; }
.mc-stat-item { display: flex; flex-direction: column; }
.mc-stat-item .label { font-size: 10px; color: #71717a; text-transform: uppercase; font-weight: 700; }
.mc-stat-item .value { font-size: 18px; color: #fff; font-weight: 700; font-family: monospace; }
.mc-global-actions { display: flex; gap: 10px; }

/* --- View Port (Grid & Focus) --- */
.mc-view-port { flex: 1; overflow: hidden; position: relative; }

/* --- CUSTOM SCROLLBAR STYLING --- */
.mc-view-port::-webkit-scrollbar,
.mc-client-grid::-webkit-scrollbar,
.mc-form-container.expanded::-webkit-scrollbar {
    width: 10px;  
    background: #09090b;
}

.mc-view-port::-webkit-scrollbar-track,
.mc-client-grid::-webkit-scrollbar-track,
.mc-form-container.expanded::-webkit-scrollbar-track {
    background: #09090b;
    border-left: 1px solid #1f1f22; 
}

.mc-view-port::-webkit-scrollbar-thumb,
.mc-client-grid::-webkit-scrollbar-thumb,
.mc-form-container.expanded::-webkit-scrollbar-thumb {
    background-color: #27272a; 
    border-radius: 5px; 
    border: 2px solid #09090b; 
}

.mc-view-port::-webkit-scrollbar-thumb:hover,
.mc-client-grid::-webkit-scrollbar-thumb:hover,
.mc-form-container.expanded::-webkit-scrollbar-thumb:hover {
    background-color: #3f3f46; 
}

/* --- GRID LAYOUT --- */
.mc-client-grid {
    padding: 20px;
    display: grid;
    /* [FIX] Reduced min-width from 240px to 215px to allow 3 cards per row */
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    grid-auto-rows: max-content;
    gap: 15px;
    overflow-y: auto;
    height: 100%;
}

/* --- CLIENT CARD --- */
.mc-card {
    background: #111113;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    position: relative;
}
.mc-card:hover { border-color: #3f3f46; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.mc-card.online { border-left: 3px solid #10b981; }
.mc-card.offline { border-left: 3px solid #52525b; }
.mc-card.error { border-left: 3px solid #ef4444; }

.mc-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.mc-user-info { display: flex; flex-direction: column; }
.mc-name { font-size: 14px; font-weight: 700; color: #fff; }
.mc-script { font-size: 11px; color: #a1a1aa; margin-top: 2px; }

.mc-status-badge { font-size: 9px; padding: 2px 6px; border-radius: 3px; text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.mc-status-badge.online { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.mc-status-badge.offline { background: rgba(82, 82, 91, 0.1); color: #71717a; }
.mc-status-badge.error { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* --- Split Body --- */
.mc-card-body-split { display: flex; gap: 10px; margin-bottom: 12px; }
.mc-metrics-col { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.mc-metric-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mc-metric-row .lbl { font-size: 10px; color: #52525b; width: 40px; }
.mc-metric-row .val { font-size: 10px; color: #d4d4d8; }

.mc-progress-track { flex: 1; height: 4px; background: #18181b; border-radius: 2px; overflow: hidden; }
.mc-progress-fill { height: 100%; background: #10b981; transition: width 0.5s ease; }
.mc-progress-fill.blue { background: #3b82f6; }

/* Stream Column */
.mc-stream-col {
    width: 80px; height: 60px; border-radius: 4px; overflow: hidden; position: relative; border: 1px solid #27272a; background: #000;
}
.mc-stream-thumb { width: 100%; height: 100%; position: relative; }
.mc-stream-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mc-stream-thumb img.grayscale { filter: grayscale(100%) opacity(0.5); }
.live-tag { position: absolute; top: 2px; left: 2px; background: #ef4444; color: #fff; font-size: 7px; font-weight: 800; padding: 1px 3px; border-radius: 2px; }

.btn-expand-stream {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); color: #fff; border: none; cursor: pointer; opacity: 0; transition: opacity 0.2s; display: flex; align-items: center; justify-content: center;
}
.mc-stream-thumb:hover .btn-expand-stream { opacity: 1; }

.mc-card-actions { display: flex; gap: 6px; }
.mc-action-btn { background: #18181b; border: 1px solid #27272a; color: #fff; padding: 6px; font-size: 10px; border-radius: 3px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.mc-action-btn:hover { background: #27272a; border-color: #3f3f46; }
.mc-action-btn.primary { flex: 1; background: rgba(59, 130, 246, 0.1); border-color: #3b82f6; color: #3b82f6; }
.mc-action-btn.primary:hover { background: #3b82f6; color: #fff; }
.mc-action-btn.danger:hover { background: #ef4444; border-color: #ef4444; color: #fff; }

/* --- FORM LAYOUTS (Add/Config) --- */
.mc-form-container { padding: 40px; max-width: 500px; margin: 0 auto; }
.mc-form-container.expanded { max-width: 600px; padding: 30px 40px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }

.mc-form-header { margin-bottom: 30px; text-align: center; }
.mc-form-header h3 { font-size: 18px; color: #fff; margin-bottom: 8px; }
.mc-form-header p { font-size: 12px; color: #71717a; }

.mc-form-section-label { font-size: 10px; text-transform: uppercase; color: #3b82f6; font-weight: 700; margin: 20px 0 10px 0; padding-bottom: 5px; border-bottom: 1px solid #1a1a1c; letter-spacing: 0.5px; }

.mc-form-row { display: flex; gap: 15px; margin-bottom: 10px; }
.mc-input-group { margin-bottom: 20px; flex: 1; }
.mc-input-group label { display: block; font-size: 11px; color: #a1a1aa; margin-bottom: 6px; }
.mc-input { width: 100%; background: #111113; border: 1px solid #27272a; color: #fff; padding: 10px; border-radius: 4px; font-size: 13px; }
.mc-input:focus { border-color: #3b82f6; outline: none; }
.mc-input.monospace { font-family: monospace; letter-spacing: 1px; padding-right: 30px; color: #10b981; background: #0c0c0e; }
.mc-input-wrapper { position: relative; }
.input-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #52525b; font-size: 12px; }

.val-blue { color: #3b82f6; font-weight: 700; }
.mc-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; }
.mc-form-actions.sticky-footer { margin-top: auto; padding-top: 20px; background: #09090b; position: sticky; bottom: 0; }

/* Range Slider */
input[type=range].mc-range { -webkit-appearance: none; appearance: none; width: 100%; background: transparent; cursor: pointer; margin: 8px 0; }
input[type=range].mc-range::-webkit-slider-runnable-track { width: 100%; height: 6px; background: #27272a; border-radius: 3px; border: 1px solid #09090b; }
input[type=range].mc-range::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: #3b82f6; border: 2px solid #09090b; margin-top: -6px; box-shadow: 0 0 8px rgba(59, 130, 246, 0.4); transition: transform 0.1s ease; }
input[type=range].mc-range:focus { outline: none; }
input[type=range].mc-range::-webkit-slider-thumb:hover { transform: scale(1.15); background: #60a5fa; box-shadow: 0 0 12px rgba(59, 130, 246, 0.6); }

/* Focus View */
.mc-focus-container { height: 100%; display: flex; flex-direction: column; background: #000; }
.mc-focus-header { height: 50px; background: #0d0d0f; border-bottom: 1px solid #1a1a1c; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.mc-focus-info { display: flex; align-items: center; gap: 10px; }
.mc-focus-info .name { font-size: 14px; font-weight: 700; color: #fff; }
.mc-focus-info .status { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; }
.mc-focus-info .status.running { background: #10b981; color: #000; }
.mc-focus-info .status.idle { background: #52525b; color: #fff; }
.mc-focus-screen { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: #050505; }
.mc-focus-screen img { max-width: 100%; max-height: 100%; }
.mc-focus-overlay { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.6); color: #00e054; padding: 5px 10px; border-radius: 4px; font-family: monospace; font-size: 11px; display: flex; gap: 10px; }

/* Global Buttons */
.mc-btn-text { background: #18181b; border: 1px solid #27272a; color: #fff; padding: 8px 12px; font-size: 11px; font-weight: 600; border-radius: 4px; cursor: pointer; }
.mc-btn-text:hover { background: #27272a; }
.mc-btn-text.primary { background: #3b82f6; border-color: #3b82f6; }
.mc-btn-text.primary:hover { background: #2563eb; }
.mc-btn-text.danger:hover { background: #ef4444; border-color: #ef4444; }
.mc-btn-icon { width: 32px; height: 32px; background: #3b82f6; border: none; color: #fff; border-radius: 4px; cursor: pointer; }
.mc-btn-icon:hover { background: #2563eb; }

/* --- Sleek Range Slider --- */
input[type=range].mc-range {
    -webkit-appearance: none; /* Remove default styling */
    appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
    margin: 8px 0;
}

/* Webkit Track (Chrome, Safari, Edge) */
input[type=range].mc-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #27272a; /* Dark grey track */
    border-radius: 3px;
    border: 1px solid #09090b;
}

/* Webkit Thumb */
input[type=range].mc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #3b82f6; /* Stracti Blue */
    border: 2px solid #09090b; /* Contrast border */
    margin-top: -6px; /* Centers thumb vertically on the track */
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4); /* Soft glow */
    transition: transform 0.1s ease, background 0.1s;
}

/* Hover & Focus States */
input[type=range].mc-range:focus {
    outline: none;
}

input[type=range].mc-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #60a5fa; /* Lighter blue on hover */
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

/* Firefox Track */
input[type=range].mc-range::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #27272a;
    border-radius: 3px;
    border: 1px solid #09090b;
}

/* Firefox Thumb */
input[type=range].mc-range::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border: 2px solid #09090b;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    transition: transform 0.1s ease;
}

input[type=range].mc-range::-moz-range-thumb:hover {
    transform: scale(1.15);
}

/* --- Expanded Form Layout --- */
.mc-form-container.expanded {
    max-width: 600px; /* Wider for 2-column layout */
    padding: 30px 40px;
    height: 100%;
    overflow-y: auto; /* Allow scrolling inside form */
    display: flex;
    flex-direction: column;
}

.mc-form-section-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #3b82f6;
    font-weight: 700;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #1a1a1c;
    letter-spacing: 0.5px;
}

.mc-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.mc-form-row .mc-input-group {
    flex: 1;
}

/* Input Icons */
.mc-input-wrapper {
    position: relative;
}

.mc-input.monospace {
    font-family: monospace;
    letter-spacing: 1px;
    padding-right: 30px;
    color: #10b981; /* Green text for keys */
    background: #0c0c0e;
}

.input-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #52525b;
    font-size: 12px;
}

.val-blue { color: #3b82f6; font-weight: 700; }

/* Sticky Actions Footer */
.mc-form-actions.sticky-footer {
    margin-top: auto;
    padding-top: 20px;
    background: #09090b; /* Cover scrolling content behind it */
    position: sticky;
    bottom: 0;
}

/* Toggle Switch (Reusing previous style if needed, ensured here) */
.mc-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #1a1a1c;
    color: #d4d4d8;
    font-size: 12px;
    margin-bottom: 10px;
}

.st-toggle {
    width: 32px; height: 16px; background: #1a1a1c; border-radius: 10px; position: relative; cursor: pointer;
}
.st-toggle::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; background: #3f3f46; border-radius: 50%; transition: 0.2s;
}
.st-toggle.on { background: rgba(59, 130, 246, 0.2); }
.st-toggle.on::after { left: 19px; background: #3b82f6; }