html,
body{

margin:0;
padding:0;
height:100%;

font-family:Arial,Helvetica,sans-serif;

}

#toolbar{

width:320px;

height:100vh;

display:flex;

flex-direction:column;

align-items:stretch;

gap:16px;

padding:20px;

box-sizing:border-box;

background:#0B1720;

box-shadow:-2px 0 14px rgba(0,0,0,.45);

z-index:999;

position:fixed;

right:0;

top:0;

overflow-y:auto;

}

#sidebarTitle h1{

margin:0;

color:#EAF6FF;

font-size:24px;

letter-spacing:.5px;

}

#sidebarTitle p{

margin:6px 0 0;

color:#81D4FA;

font-size:13px;

}

#startBtn{

width:100%;

padding:12px 20px;

font-size:16px;

cursor:pointer;

color:#EAF6FF;

background:#1565C0;

border:1px solid #4FC3F7;

border-radius:8px;

font-weight:bold;

box-shadow:0 0 12px rgba(79,195,247,.35);

}

#startBtn:hover{

background:#1976D2;

}

#statsPanel{

margin-left:0;

display:flex;

flex-direction:column;

align-items:stretch;

gap:10px;

color:#D6ECFF;

font-size:12px;

}

#statsPanel span{

padding:5px 8px;

background:rgba(255,255,255,.08);

border:1px solid rgba(79,195,247,.25);

border-radius:6px;

}

#map{

height:100vh;

width:calc(100vw - 320px);

background:#10212B;

}

.leaflet-tile-pane{

filter:saturate(.65) brightness(.78) contrast(1.1);

}

/* Node */

.node-label{

width:32px;
height:32px;

border-radius:50%;

background:#0D47A1;

color:white;

display:flex;

justify-content:center;

align-items:center;

font-weight:bold;

font-size:13px;

border:2px solid white;

box-shadow:0 0 6px rgba(0,0,0,.4);

}

.traffic-lane.lane-flowing{

animation:laneFlow 2.4s linear infinite;

}

.traffic-lane.lane-queued{

animation:none;

}

.traffic-lane.lane-stopped{

animation:none;

filter:drop-shadow(0 0 4px rgba(207,216,220,.55));

}

.traffic-lane.lane-idle{

animation:none;

}

@keyframes laneFlow{

from{stroke-dashoffset:0;}

to{stroke-dashoffset:-52;}

}

/* Popup */

.leaflet-popup-content{

font-size:14px;

line-height:1.5;

}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip{

background:#101D26;

color:#EAF6FF;

box-shadow:0 3px 16px rgba(0,0,0,.45);

}

.node-circle{
    width:28px;
    height:28px;
    border-radius:50%;
    background:white;
    border:2px solid black;
    text-align:center;
    line-height:24px;
    font-weight:bold;
    font-size:14px;
}

/* ─── Controller Panel ────────────────────────────────────────────────────── */

#controllerPanel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(79,195,247,0.2);
    border-radius: 10px;
    padding: 12px;
}

.ctrl-panel-title {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #81D4FA;
    margin-bottom: 4px;
}

.ctrl-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.ctrl-toggle:hover {
    background: rgba(255,255,255,0.06);
}

.ctrl-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ctrl-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.ctrl-name {
    font-size: 12px;
    font-weight: bold;
    color: #EAF6FF;
    white-space: nowrap;
}

.ctrl-desc {
    font-size: 10px;
    color: #78909C;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle switch */
.ctrl-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #263238;
    border: 1px solid #37474F;
    position: relative;
    flex-shrink: 0;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
    cursor: pointer;
}

.ctrl-knob {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #546E7A;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s, background 0.25s;
}

/* ON states — colour coded per controller */
#ctrl-ai .ctrl-switch.ctrl-on {
    background: #0D47A1;
    border-color: #4FC3F7;
    box-shadow: 0 0 8px rgba(79,195,247,0.45);
}
#ctrl-ai .ctrl-switch.ctrl-on .ctrl-knob {
    background: #4FC3F7;
    transform: translateX(20px);
}

#ctrl-heuristic .ctrl-switch.ctrl-on {
    background: #E65100;
    border-color: #FFAB40;
    box-shadow: 0 0 8px rgba(255,171,64,0.45);
}
#ctrl-heuristic .ctrl-switch.ctrl-on .ctrl-knob {
    background: #FFAB40;
    transform: translateX(20px);
}

#ctrl-rules .ctrl-switch.ctrl-on {
    background: #1B5E20;
    border-color: #69F0AE;
    box-shadow: 0 0 8px rgba(105,240,174,0.45);
}
#ctrl-rules .ctrl-switch.ctrl-on .ctrl-knob {
    background: #69F0AE;
    transform: translateX(20px);
}

/* Warning */
.ctrl-warning {
    font-size: 10px;
    color: #FFD54F;
    background: rgba(255,213,79,0.1);
    border: 1px solid rgba(255,213,79,0.3);
    border-radius: 6px;
    padding: 6px 8px;
    line-height: 1.4;
}

/* ─── AI Reasoning Panel ──────────────────────────────────────────────────── */

#aiReasoningPanel {
    margin-top: auto;
    background: rgba(13, 71, 161, 0.18);
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reasoning-title {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: #4FC3F7;
    display: flex;
    align-items: center;
    gap: 7px;
}

.reasoning-pulse {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4FC3F7;
    animation: reasoningBlink 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes reasoningBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.25; transform: scale(0.7); }
}

.reasoning-body {
    font-size: 11px;
    color: #B0BEC5;
    line-height: 1.65;
    word-break: break-word;
}

.reasoning-body strong {
    color: #E1F5FE;
}

.reasoning-inactive {
    color: #546E7A;
    font-style: italic;
}

.reasoning-title--node {
    justify-content: space-between;
    color: #80DEEA;
}

.reasoning-clear-btn {
    background: none;
    border: 1px solid rgba(128, 222, 234, 0.3);
    border-radius: 4px;
    color: #80DEEA;
    font-size: 11px;
    padding: 1px 6px;
    cursor: pointer;
    line-height: 1.4;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.reasoning-clear-btn:hover {
    background: rgba(128, 222, 234, 0.12);
    border-color: rgba(128, 222, 234, 0.6);
}

.reasoning-hint {
    font-size: 9.5px;
    color: #37474F;
    text-align: center;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* ─── Network View Panel ──────────────────────────────────────────────────── */

#networkViewPanel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(79,195,247,0.2);
    border-radius: 10px;
    padding: 12px;
}

.net-view-options {
    display: flex;
    gap: 8px;
}

.net-view-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(79,195,247,0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    color: #78909C;
    text-align: center;
}

.net-view-btn:hover {
    background: rgba(79,195,247,0.08);
    border-color: rgba(79,195,247,0.4);
    color: #B0BEC5;
}

.net-view-btn.net-view-active {
    background: rgba(13,71,161,0.45);
    border-color: #4FC3F7;
    box-shadow: 0 0 10px rgba(79,195,247,0.35);
    color: #E1F5FE;
}

.net-view-icon {
    font-size: 20px;
    line-height: 1;
}

.net-view-label {
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.net-view-sub {
    font-size: 9px;
    opacity: 0.7;
    white-space: nowrap;
}

.net-view-info {
    font-size: 10px;
    color: #80DEEA;
    background: rgba(0,188,212,0.08);
    border: 1px solid rgba(0,188,212,0.25);
    border-radius: 6px;
    padding: 6px 10px;
    line-height: 1.5;
    text-align: center;
}

.net-view-info strong {
    color: #E0F7FA;
    letter-spacing: 0.5px;
}

