﻿:root {
    --bg-page:       #ffffff;
    --bg-surface:    #f8fafc;
    --bg-panel:      #ffffff;
    --bg-panel-hd:   #f1f5f9;
    --accent:        #0066cc;
    --accent-dark:   #003d99;
    --accent-glow:   rgba(0, 102, 204, 0.1);
    --text-primary:  #1a202c;
    --text-secondary:#374151;
    --text-muted:    #6b7280;
    --border:        #e5e7eb;
    --success:       #16a34a;
    --danger:        #dc2626;
    --warning:       #ea580c;
}

body {
    background: var(--bg-page);
    font-family: 'Open Sans', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 10px;
    color: var(--text-primary);
}

.banner-section {
    width: 100%;
    height: 150px;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--accent-glow);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dashboard-container {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.header {
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 12px 15px;
    margin-bottom: 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    position: relative;
    overflow: visible;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section {
    flex: 1;
}

.main-grid {
    display: block;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    margin-bottom: 15px;
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
}

.panel-header h2 {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-body {
    padding: 15px;
}

.btn {
    background: var(--accent-dark);
    color: #fff;
    border: none;
    padding: 8px 12px;
    margin: 5px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn:hover {
    background: inherit;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-success {
    background: #16a34a;
    color: #fff;
    border: none;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 4px;
}

.btn-success:hover {
    background: #15803d;
    color: #fff;
    border: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-danger {
    background: #3b0a0a;
    color: var(--danger);
    border: 1px solid #7f1d1d;
}

.btn-danger:hover {
    background: #250505;
    color: var(--danger);
    border-color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary {
    background: #1d4ed8;
    color: #fff;
    border: none;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 4px;
}

.btn-primary:hover {
    background: #1e40af;
    border: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

.btn-warning {
    background: #3b1f04;
    color: var(--warning);
    border: 1px solid #78350f;
}

.btn-warning:hover {
    background: #261302;
    color: var(--warning);
    border-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-accent {
    background: #1d4ed8;
    color: #fff;
    border: none;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.03em;
    border-radius: 4px;
}

.btn-accent:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

.button-row {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.button-row button {
    flex: 1;
}

.btn-toggle-lb {
    background: #16a34a;
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.03em;
    padding: 10px 18px;
    border-radius: 4px;
    flex: 1;
    transition: 0.2s;
}

.btn-toggle-lb:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-toggle-lb.lb-active {
    background: #dc2626;
    color: #fff;
}

.btn-toggle-lb.lb-active:hover {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-add-worker {
    background: #3b82f6;
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.03em;
    padding: 10px 18px;
    border-radius: 4px;
    flex: 1;
    transition: 0.2s;
}

.btn-add-worker:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.controls-row {
    align-items: center;
}



.control-section {
    margin-bottom: 15px;
}

.control-section h3 {
    font-size: 13px;
    margin: 5px 0;
    color: var(--text-secondary);
}

.metrics-container {
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 16px 12px;
    text-align: left;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); 
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--bg-panel);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.metric-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    opacity: 0.5;
}

.metric-header {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    font-family: var(--font-main);
}

.metric-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-main);
    letter-spacing: -0.02em;
}

.metric-subtext {
    font-size: 15px;
    color: var(--success);
    margin-top: 4px;
    font-weight: 600;
    font-family: var(--font-main);
}

.circuit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.circuit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.circuit-status {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.panel-header {
    background: var(--bg-panel-hd);
    padding: 10px 14px;
    font-weight: bold;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    font-weight: normal;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.input-wrapper {
    margin-bottom: 10px;
}

.form-input {
    width: 100%;
    height: 100px;
    padding: 8px;
    border: 1px solid var(--border);
    font-family: monospace;
    font-size: 13px;
    background: #2a3f5f;
    color: #d0d8e0;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

.form-input::placeholder {
    color: #8a98b0;
    opacity: 0.6;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0066cc;
    box-shadow: 0 0 12px rgba(0, 102, 204, 0.5);
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    border: none;
    transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0066cc;
    box-shadow: 0 0 12px rgba(0, 102, 204, 0.5);
    transform: scale(1.2);
}

.output-section {
    margin-top: 15px;
}

.output-header {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.btn-small {
    background: var(--bg-panel-hd);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    border-radius: 3px;
}

.btn-small:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.terminal {
    background: #030810;
    color: #4ade80;
    border: 1px solid var(--border);
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    border-radius: 4px;
}

#lb-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    font-weight: 500;
}

#lb-status.ready {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

#health-indicator, #load-distribution {
    font-weight: 500;
    color: var(--text-primary);
}

.info-panel {
    background: var(--bg-panel);
}

.info-panel .panel-header {
    background: var(--bg-panel-hd);
    border-bottom: 1px solid var(--border);
}

.info-panel .panel-body {
    background: var(--bg-panel);
}

code {
    background: #f1f5f9;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-circular {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    flex: 0 0 auto !important;
    margin: 5px;
}

.btn-circular:hover {
    transform: scale(1.1);
}

.button-row .btn-circular {
    flex: 0 0 40px !important;
}

#stop-lb.btn-circular {
    background: #3b0a0a;
    color: var(--danger);
    border: 2px solid #7f1d1d;
}

#stop-lb.btn-circular:hover {
    background: #991b1b;
    color: #fff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

#remove-worker.btn-circular {
    background: #3b1f04;
    color: var(--warning);
    border: 2px solid #78350f;
}

#remove-worker.btn-circular:hover {
    background: #92400e;
    color: #fff;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* Horizontal Bar Indicators */
.hbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hbar-label {
    font-size: 16px;
    color: #374151;
    width: 130px;
    flex-shrink: 0;
    white-space: nowrap;
}

.hbar-track {
    flex: 0.5;
    height: 7px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.hbar-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: #22c55e;
    transition: width 0.5s ease;
}

/* 0-29% green (low usage = good), 30-69% orange (medium), 70-100% red (high usage = bad) */
.hbar-fill.low    { background: #22c55e; }
.hbar-fill.medium { background: #f59e0b; }
.hbar-fill.high   { background: #ef4444; }

.hbar-percent {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    width: 40px;
    text-align: right;
    flex-shrink: 0;
}

.tuning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.tuning-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 4px;
}

.tuning-section h3 {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tuning-input {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tuning-input label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.tuning-input input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    cursor: pointer;
}

.tuning-input input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: all 0.2s;
}

.tuning-input input[type="range"]::-webkit-slider-thumb:hover {
    background: #0066cc;
    box-shadow: 0 0 12px rgba(0, 102, 204, 0.5);
    transform: scale(1.2);
}

.tuning-input input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    border: none;
    transition: all 0.2s;
}

.tuning-input input[type="range"]::-moz-range-thumb:hover {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 102, 204, 0.1);
    border: none;
    transition: all 0.2s;
}

.tuning-value {
    font-size: 11px;
    color: var(--accent);
    font-weight: bold;
    min-width: 30px;
    text-align: right;
}

.btn-secondary {
    background: #f8fafc;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: var(--accent);
    color: var(--text-primary);
}

.tuning-toggle-btn {
    background: transparent;
    border: 2px solid #0066cc;
    color: #0066cc;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.tuning-toggle-btn:hover {
    background: rgba(30, 144, 255, 0.1);
    box-shadow: 0 0 12px rgba(30, 144, 255, 0.4);
    transform: scale(1.05);
}

.tuning-toggle-btn:active {
    transform: scale(0.95);
}

.tuning-side-panel {
    position: absolute;
    top: 100%;
    left: 10px;
    width: 360px;
    max-height: 75vh;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: none;
    margin-top: 8px;
}

.info-side-panel {
    left: auto;
    right: 10px;
}

.info-toggle-btn {
    background: transparent;
    border: 2px solid #0066cc;
    color: #0066cc;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-style: normal;
}

.info-toggle-btn:hover {
    background: rgba(30, 144, 255, 0.1);
    box-shadow: 0 0 12px rgba(30, 144, 255, 0.4);
    transform: scale(1.05);
}

.info-toggle-btn:active {
    transform: scale(0.95);
}

.tuning-side-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.tuning-panel-header {
    position: relative;
    background: #F1F5F9;
    border-bottom: 1px solid #E2E8F0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.tuning-panel-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1E293B;
}

.tuning-panel-close-btn {
    background: transparent;
    border: none;
    color: #64748B;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tuning-panel-close-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1E293B;
}

.tuning-panel-content {
    padding: 12px 16px;
    color: #1E293B;
    max-height: 60vh;
    overflow-y: auto;
}

.tuning-panel-content .tuning-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.tuning-panel-content .tuning-section {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    padding: 10px 12px;
    border-radius: 6px;
}

.tuning-panel-content .tuning-section h3 {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.tuning-panel-content .tuning-input {
    margin-bottom: 8px;
}

.tuning-panel-content .tuning-input label {
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
}

.tuning-panel-content .tuning-input input[type="range"] {
    width: 100%;
    height: 5px;
    background: #E2E8F0;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
}

.tuning-panel-content .tuning-input input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1E293B;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(30, 45, 59, 0.2);
}

.tuning-panel-content .tuning-input input[type="range"]::-webkit-slider-thumb:hover {
    background: #0f172a;
    box-shadow: 0 4px 10px rgba(30, 45, 59, 0.3);
    transform: scale(1.2);
}

.tuning-panel-content .tuning-input input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1E293B;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(30, 45, 59, 0.2);
}

.tuning-panel-content .tuning-input input[type="range"]::-moz-range-thumb:hover {
    background: #0f172a;
    box-shadow: 0 4px 10px rgba(30, 45, 59, 0.3);
    transform: scale(1.2);
}

.tuning-panel-content .tuning-value {
    font-size: 12px;
    color: #1E293B;
    font-weight: 600;
    float: right;
}

.tuning-side-panel::-webkit-scrollbar {
    width: 6px;
}

.tuning-side-panel::-webkit-scrollbar-track {
    background: #F1F5F9;
}

.tuning-side-panel::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.tuning-side-panel::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}
