/* ATLAS - Advanced Tallahassee Live Automated Signals */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f5f5f5;
}

/* WIP disclaimer banner */
#wip-banner {
    background: #ff8f00;
    color: #1a1a1a;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    line-height: 28px;
    height: 28px;
    position: relative;
    z-index: 999;
}
#wip-banner span {
    vertical-align: middle;
}
#wip-banner-dismiss {
    position: absolute;
    right: 8px;
    top: 0;
    background: none;
    border: none;
    color: #1a1a1a;
    font-size: 18px;
    line-height: 28px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.6;
}
#wip-banner-dismiss:hover {
    opacity: 1;
}

header {
    background-color: #1a237e;
    color: white;
    height: 56px;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    align-items: center;
}

.header-link {
    color: white;
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(255,255,255,0.15);
    transition: background 0.2s;
}

.header-link:hover {
    background: rgba(255,255,255,0.25);
}

.header-link.active {
    background: #d32f2f;
    color: white;
}

.header-link.active:hover {
    background: #b71c1c;
}

.header-refresh-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 4px;
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

.header-refresh-btn:hover {
    background: rgba(255,255,255,0.25);
}

.header-refresh-btn:active {
    transform: scale(0.95);
}

/* Hamburger menu */
.header-menu-wrapper {
    position: relative;
}
.header-menu-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 4px;
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}
.header-menu-btn:hover {
    background: rgba(255,255,255,0.25);
}
.header-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    min-width: 200px;
    z-index: 10000;
    overflow: hidden;
}
.header-menu-dropdown.hidden {
    display: none;
}
.header-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.header-menu-item:hover {
    background: #f0f0f0;
}
.header-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}
.header-menu-logout {
    color: #d32f2f;
    font-weight: 500;
}

#ws-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-connected {
    background-color: #4caf50;
    color: white;
}

.status-disconnected {
    background-color: #f44336;
    color: white;
}

.status-connecting {
    background-color: #ff9800;
    color: white;
}

#intersection-count {
    font-size: 0.875rem;
    opacity: 0.9;
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.3s ease, min-width 0.3s ease;
}

/* Collapsed sidebar state */
#sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: visible;
}

#sidebar.collapsed > *:not(.sidebar-expand-btn) {
    display: none;
}

/* Expand button shown when sidebar is collapsed */
.sidebar-expand-btn {
    display: none;
    position: absolute;
    top: 250px;  /* Below Leaflet drawing tools */
    right: -40px;
    width: 36px;
    height: 36px;
    background: #1a237e;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 1001;
    font-size: 16px;
    box-shadow: 2px 0 6px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.sidebar-expand-btn:hover {
    background: #283593;
}

#sidebar.collapsed .sidebar-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* List View - fills sidebar by default */
#list-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#list-view.hidden {
    display: none;
}

#list-view h2 {
    padding: 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-size: 1.125rem;
    color: #333;
    flex-shrink: 0;
    margin: 0;
}

#list-view #intersection-search {
    width: 100%;
    padding: 1rem;
    border: none;
    border-bottom: 2px solid #ddd;
    font-size: 20px;
    outline: none;
    flex-shrink: 0;
    background: #fafafa;
    box-sizing: border-box;
}

#list-view #intersection-search:focus {
    background: #fff8e1;
    border-bottom-color: #1a237e;
}

#list-view #intersection-search::placeholder {
    color: #999;
}

#list-view #intersection-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
}

/* Detail View - overlays sidebar with slide animation */
#selected-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#selected-info:not(.hidden) {
    transform: translateX(0);
}

/* Back button header */
.detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 2px solid #ddd;
    background: #f8f8f8;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.back-button {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #2196f3;
    font-weight: 600;
    border-radius: 4px;
    transition: background 0.2s;
}

.back-button:hover {
    background: #e3f2fd;
}

.back-arrow {
    font-size: 1.5rem;
    line-height: 1;
}

#detail-intersection-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    text-align: center;
    line-height: 1.3;
}

#detail-intersection-name span {
    display: block;
}

/* Meta info section */
.detail-meta {
    padding: 1rem;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.meta-row {
    display: flex;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.meta-row:last-child {
    margin-bottom: 0;
}

.meta-label {
    font-weight: 600;
    color: #666;
    min-width: 70px;
}

/* Badges section */
.detail-badges {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.detail-badges:empty {
    display: none;
}

.detail-badges .badge {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Signal states, detector calls, and TIM in detail view */
#selected-info .signal-states,
#selected-info .detector-calls,
#selected-info .tim-messages {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

#selected-info .signal-states {
    background: #e0e0e0;
}

#selected-info .detector-calls {
    background: #f5f5f5;
}

#selected-info .tim-messages {
    background: #ff9800;
}

/* Larger h4 headings for Signal States, Phase Calls, and Traveler Information */
#selected-info .signal-states h4,
#selected-info .detector-calls h4,
#selected-info .tim-messages h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Regular h4 for other sections */
#selected-info h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.tim-message {
    font-size: 1.1rem;
    line-height: 1.5;
    color: #333;
    font-weight: 700;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tim-message::before {
    content: "🚧";
    font-size: 1.3rem;
    flex-shrink: 0;
}

.no-data {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}


#intersection-list li {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#intersection-list li * {
    pointer-events: none;
}

#intersection-list li:hover {
    background-color: #f0f0f0;
}

#intersection-list li.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #1a237e;
}

.intersection-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.intersection-name {
    font-weight: 500;
    font-size: 1.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.intersection-id {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.125rem;
}

.intersection-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-map {
    background-color: #2196f3;
    color: white;
}

.badge-spat {
    background-color: #4caf50;
    color: white;
}

.badge-tim {
    background-color: #ff9800;
    color: white;
}

.badge-calls {
    background-color: #607d8b;
    color: white;
}

.badge-error {
    background-color: #f44336;
    color: white;
}

/* Stale intersection styling */
#intersection-list li.stale {
    background-color: #f5f5f5;
    opacity: 0.7;
}

#intersection-list li.stale .intersection-name {
    color: #999;
}

#intersection-list li.stale .intersection-id {
    color: #bbb;
}

#selected-info.hidden {
    display: none;
}

#selected-info h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

#selected-info h4 {
    font-size: 0.875rem;
    color: #888;
    margin: 1rem 0 0.5rem;
    text-transform: uppercase;
}

#intersection-details {
    font-size: 1rem;
    color: #333;
}

.source-toggle {
    cursor: pointer;
    margin-top: 0.5rem;
    padding: 0.25rem 0;
}

.source-toggle:hover {
    color: #1a237e;
}

.toggle-icon {
    font-size: 0.875rem;
    color: #666;
    margin-left: 0.25rem;
}

.source-details {
    display: none;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #f0f0f0;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.925rem;
}

.source-toggle.expanded .toggle-icon {
    display: none;
}

.source-toggle.expanded .source-details {
    display: block;
}

.signal-states {
    margin-top: 1rem;
}

#signal-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.signal-row {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.signal-row.overlap-row {
    border-top: 1px dashed #444;
    padding-top: 8px;
    margin-top: 4px;
}

.signal-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.4rem;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 0.85rem;
    border-left: 3px solid #ccc;
    flex: 1;
    min-width: 0;
}

.signal-group.signal-stop-And-Remain,
.signal-group.signal-stop-Then-Proceed {
    border-left-color: #f44336;
    background: #ffebee;
}

.signal-group.signal-permissive-Movement-Allowed,
.signal-group.signal-protected-Movement-Allowed {
    border-left-color: #4caf50;
    background: #e8f5e9;
}

.signal-group.signal-pre-Movement,
.signal-group.signal-permissive-clearance,
.signal-group.signal-protected-clearance {
    border-left-color: #ffeb3b;
    background: #fffde7;
}

.signal-info {
    display: flex;
    flex-direction: column;
}

.signal-sg {
    font-weight: 600;
    font-size: 0.8rem;
}

.signal-state {
    font-size: 0.75rem;
    color: #666;
}

.signal-countdown {
    font-size: 0.875rem;
    font-weight: 700;
    color: #333;
}

.signal-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.signal-green, .signal-permissive-Movement-Allowed {
    background-color: #4caf50;
}

.signal-yellow, .signal-permissive-clearance {
    background-color: #ffeb3b;
}

.signal-red, .signal-stop-And-Remain {
    background-color: #f44336;
}

.signal-dark, .signal-unavailable {
    background-color: #9e9e9e;
}

.signal-flashing-yellow, .signal-caution-Conflicting-Traffic {
    background-color: #ffeb3b;
    animation: flash 0.5s infinite;
}

.signal-flashing-red, .signal-stop-Then-Proceed {
    background-color: #f44336;
    animation: flash 0.5s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* FYA (Flashing Yellow Arrow) animation for map elements */
@keyframes fya-flash {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.2; }
}

/* FYA flashing class for SVG paths (Leaflet polylines) */
.fya-flash {
    animation: fya-flash 1s step-end infinite;
}

/* FYA flashing for arrow markers */
.leaflet-marker-icon.fya-flash,
.lane-arrow.fya-flash > div,
.curve-arrow.fya-flash > div {
    animation: fya-flash 1s step-end infinite;
}

/* Pedestrian signal head indicators on crosswalks */
.ped-signal-indicator {
    pointer-events: none;
}
.ped-signal-head {
    width: 20px;
    height: 26px;
    background: #111;
    border-radius: 3px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Walk icon (white walking person) - hidden by default */
.ped-walk-icon {
    display: none;
    width: 14px;
    height: 18px;
    color: #ffffff;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.5));
}
[data-ped-state="walk"] .ped-walk-icon {
    display: block;
}

/* Hand icon (orange raised hand) - hidden by default */
.ped-hand-icon {
    display: none;
    width: 12px;
    height: 12px;
    color: #ff6600;
    filter: drop-shadow(0 0 4px rgba(255,102,0,0.5));
}
[data-ped-state="dont-walk"] .ped-hand-icon,
[data-ped-state="ped-clearance"] .ped-hand-icon {
    display: block;
}

/* Countdown number - only visible during clearance */
.ped-countdown {
    display: none;
    font-size: 8px;
    font-weight: 700;
    color: #ff6600;
    font-family: 'Courier New', monospace;
    line-height: 1;
    text-shadow: 0 0 3px rgba(255,102,0,0.5);
}
[data-ped-state="ped-clearance"] .ped-countdown {
    display: block;
}

/* Flashing during ped clearance */
[data-ped-state="ped-clearance"] .ped-hand-icon,
[data-ped-state="ped-clearance"] .ped-countdown {
    animation: ped-flash 1s step-end infinite;
}
@keyframes ped-flash {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
}

/* Steady dont-walk glow */
[data-ped-state="dont-walk"] .ped-hand-icon {
    filter: drop-shadow(0 0 6px rgba(255,102,0,0.7));
}

#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Dual Map Mode - FDOT DEPOT comparison view */
.dual-map-mode #map-container {
    display: flex;
    flex-direction: row;
}

.dual-map-mode #map {
    width: 50%;
    height: 100%;
    border-right: 2px solid #1a237e;
}

.dual-map-mode #depot-map {
    width: 50%;
    height: 100%;
}

.map-panel {
    position: relative;
}

.map-label-overlay {
    position: absolute;
    top: 10px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.atlas-label {
    left: 10px;
    background: rgba(26, 35, 126, 0.9);
    color: white;
}

.depot-label {
    right: 10px;
    background: rgba(255, 152, 0, 0.9);
    color: white;
}

/* TSC/RSU Dual Map Mode - Split screen comparison view */
.tsc-rsu-dual-mode #map-container {
    display: flex;
    flex-direction: row;
}

.tsc-rsu-dual-mode #map {
    width: 50%;
    height: 100%;
    border-right: 2px solid #4CAF50;
}

.tsc-rsu-dual-mode #rsu-map {
    width: 50%;
    height: 100%;
}

.tsc-rsu-label-overlay {
    position: absolute;
    top: 10px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    color: white;
}

.tsc-label {
    left: 10px;
    background: rgba(76, 175, 80, 0.9);
}

.rsu-label {
    right: 10px;
    background: rgba(255, 152, 0, 0.9);
}

/* FDOT DEPOT Toggle Button */
.depot-toggle-container {
    display: flex;
    align-items: center;
}

.depot-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.depot-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 20px;
    transition: background-color 0.3s;
    margin-right: 8px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.depot-toggle input:checked + .toggle-slider {
    background-color: #ff9800;
}

.depot-toggle input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

.toggle-label {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

footer {
    background: #333;
    color: #999;
    padding: 0.5rem 2rem;
    font-size: 0.75rem;
    text-align: center;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
}

.leaflet-popup-content {
    margin: 0.75rem;
}

.popup-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.popup-info {
    font-size: 0.875rem;
    color: #666;
}

/* Lane styles in popup */
.lane-info {
    margin: 0.25rem 0;
    padding: 0.25rem;
    background: #f5f5f5;
    border-radius: 2px;
}

/* Right Sidebar - Message Stream */
#right-sidebar {
    width: 350px;
    background: white;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

#right-sidebar.hidden {
    width: 0;
    border-left: none;
}

#right-sidebar .sidebar-header {
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-title {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

#right-sidebar .sidebar-header h3 {
    font-size: 1.125rem;
    color: #333;
    margin: 0;
}

#stream-intersection-name {
    font-size: 0.875rem;
    color: #666;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#btn-close-sidebar {
    background: none;
    border: 1px solid #999;
    color: #666;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

#btn-close-sidebar:hover {
    background: #f44336;
    border-color: #f44336;
    color: white;
}

#btn-pause-stream {
    padding: 0.375rem 0.75rem;
    border: 1px solid #1a237e;
    background: white;
    color: #1a237e;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

#btn-pause-stream:hover {
    background: #1a237e;
    color: white;
}

#btn-pause-stream.paused {
    background: #f44336;
    border-color: #f44336;
    color: white;
}

.connector-toggle {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

.connector-toggle .toggle-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #ccc;
    background: white;
    color: #666;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.connector-toggle .toggle-btn:hover {
    background: #e8e8e8;
}

.connector-toggle .toggle-btn.active {
    background: #2196F3;
    border-color: #2196F3;
    color: white;
}

.connector-toggle .toggle-btn[data-connector="TSC"].active {
    background: #4CAF50;
    border-color: #4CAF50;
}

.connector-toggle .toggle-btn[data-connector="RSU"].active {
    background: #FF9800;
    border-color: #FF9800;
}

.flow-stats {
    padding: 0.75rem 1rem;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.stat-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a237e;
    display: inline-block;
    min-width: 1.25rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.stat-unit {
    font-size: 0.85rem;
    color: #999;
}

.stat-separator {
    margin: 0 0.5rem;
    color: #ccc;
}

#packet-list {
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
}

.packet-header {
    padding: 0.375rem 0.75rem;
    border-bottom: 2px solid #ddd;
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    background: #f5f5f5;
    text-transform: uppercase;
}

.packet-header span {
    text-align: center;
}

.packet-header span:nth-child(1) {
    flex: 0 0 50px;
    text-align: left;
}

.packet-header span:nth-child(2),
.packet-header span:nth-child(3) {
    flex: 0 0 100px;
}

.packet-header span:nth-child(4) {
    flex: 1;
    text-align: left;
    padding-left: 0.5rem;
}

.packet-item {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.8rem;
}

.packet-item:hover {
    background: #f5f5f5;
}

.packet-item.selected {
    background: #e3f2fd;
}

.packet-type {
    flex: 0 0 50px;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
}

.packet-type.map {
    background: #2196f3;
    color: white;
}

.packet-type.spat {
    background: #4caf50;
    color: white;
}

.packet-type.tim {
    background: #ff9800;
    color: white;
}

.packet-msg-time,
.packet-server-time {
    flex: 0 0 100px;
    text-align: center;
    color: #666;
    font-family: monospace;
    font-size: 0.75rem;
}

.packet-size {
    flex: 1;
    text-align: left;
    padding-left: 0.5rem;
    color: #999;
    font-size: 0.75rem;
}

#packet-detail {
    border-top: 2px solid #1a237e;
    display: flex;
    flex-direction: column;
    max-height: 50%;
    flex-shrink: 0;
}

#packet-detail.hidden {
    display: none;
}

.detail-header {
    padding: 0.5rem 1rem;
    background: #1a237e;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#detail-title {
    font-size: 0.925rem;
    font-weight: 500;
}

#btn-close-detail {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
}

.detail-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
}

.tab-btn.active {
    background: white;
    color: #1a237e;
    border-bottom: 2px solid #1a237e;
}

.detail-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

.detail-view {
    display: none;
    margin: 0;
    padding: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    background: #fafafa;
    min-height: 100px;
    overflow: auto;
}

.detail-view.active {
    display: block;
}

#packet-hex {
    font-family: monospace;
    color: #666;
}
/* Detector Calls Table Styles */
.calls-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.calls-row {
    display: table-row;
}

.calls-cell {
    display: table-cell;
    text-align: center;
    padding: 6px 4px;
    border: 1px solid #ccc;
}

.calls-header {
    font-weight: bold;
    background: #e0e0e0;
}

.call-active {
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.1rem;
}

.call-inactive {
    color: #ccc;
    font-size: 1.1rem;
}

.calls-dir {
    font-size: 0.75rem;
    color: #666;
    background: #f5f5f5;
}

/* ========== MAP Builder Modal Styles ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    right: 0;
    top: 56px; /* Below header */
    width: 500px;
    height: calc(100vh - 56px);
    background: transparent;
    overflow: visible;
}

.modal.active {
    display: block;
}

/* Collapse toggle button */
.modal-collapse-btn {
    position: fixed;
    right: 500px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: #1a237e;
    border: none;
    border-radius: 8px 0 0 8px;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease, background 0.2s;
    z-index: 10001;
}

.modal.active .modal-collapse-btn {
    display: flex;
}

.modal-collapse-btn:hover {
    background: #283593;
}

.modal-collapse-btn svg {
    transition: transform 0.3s;
}

/* Collapsed state */
.modal.collapsed {
    width: 0;
}

.modal.collapsed .modal-content {
    display: none;
}

.modal.collapsed .modal-collapse-btn {
    right: 0;
}

.modal.collapsed .modal-collapse-btn svg {
    transform: rotate(180deg);
}

/* Smooth width transition */
.modal {
    transition: width 0.3s ease;
}

.modal-content {
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: #1a237e;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    flex: 1;
}

/* Collapse button in header */
.modal-collapse-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    width: 28px;
    height: 28px;
    margin-right: 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-collapse-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-collapse-header-btn svg {
    transition: transform 0.2s;
}

/* Expand tab when collapsed */
.modal-expand-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 80px;
    background: #1a237e;
    border: none;
    border-radius: 8px 0 0 8px;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: 500;
}

.modal-expand-tab:hover {
    background: #283593;
}

.modal.collapsed ~ .modal-expand-tab,
.modal-expand-tab.visible {
    display: flex;
}

.step-indicator {
    font-size: 14px;
    opacity: 0.9;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.builder-step {
    display: block;
}

.builder-step.hidden {
    display: none;
}

.builder-step h3 {
    margin-top: 0;
    color: #1a237e;
    font-size: 18px;
}

.builder-step label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 500;
    color: #333;
}

.builder-step input[type="text"],
.builder-step input[type="number"],
.builder-step select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.builder-step input[type="text"]:focus,
.builder-step input[type="number"]:focus,
.builder-step select:focus {
    outline: none;
    border-color: #1a237e;
    box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.1);
}

/* Inline form row for side-by-side fields */
.form-row-inline {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.form-row-inline .form-field {
    flex: 1;
}

.form-row-inline .form-field label {
    margin-top: 0;
}

/* Speed Limits Section (CTI 4501) */
.speed-limits-section {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.speed-limits-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.speed-limits-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.speed-field {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speed-field label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.speed-field input {
    width: 50px;
    text-align: center;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.field-hint {
    font-size: 11px;
    color: #888;
    display: block;
    margin-top: 2px;
}

.info-display {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
}

.info-display p {
    margin: 6px 0;
}

.help-text {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.success-text {
    color: #4CAF50;
    font-weight: 500;
}

.info-text {
    color: #666;
    font-style: italic;
}

/* Phase Data Display (Step 2) */
#phase-data-display {
    margin-top: 16px;
}

.phase-data-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}

.phase-data-notice.success {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.phase-data-notice.warning {
    background: #fff3e0;
    border: 1px solid #ff9800;
    color: #e65100;
}

.phase-data-notice .notice-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.phase-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.phase-data-table th,
.phase-data-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.phase-data-table th {
    background: #f0f0f0;
    font-weight: 600;
    color: #333;
}

.phase-data-table tr:last-child td {
    border-bottom: none;
}

.phase-data-table tbody tr:hover {
    background: #f5f5f5;
}

/* Phase reference boxes for Steps 4 and 6 */
.phase-reference-box {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.phase-reference-box h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #2e7d32;
}

.phase-data-table.compact {
    font-size: 11px;
}

.phase-data-table.compact th,
.phase-data-table.compact td {
    padding: 4px 8px;
}

.lanes-container,
.crosswalks-container {
    margin: 12px 0;
}

.lanes-container ul,
.crosswalks-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.lanes-container li,
.crosswalks-container li {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.lanes-container li:last-child,
.crosswalks-container li:last-child {
    border-bottom: none;
}

.lane-config-form,
.crosswalk-config-form {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
}

.lane-config-form:hover,
.crosswalk-config-form:hover {
    border-color: #1a237e;
    background: #f0f4ff;
}

.lane-config-form.highlighted,
.crosswalk-config-form.highlighted {
    border-color: #ffcc00;
    background: #fffef0;
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

.lane-config-form.flash,
.crosswalk-config-form.flash {
    animation: flash-highlight 0.6s ease-out;
}

@keyframes flash-highlight {
    0%, 50% { background: #ffeb3b; }
    100% { background: #fffef0; }
}

.lane-config-header,
.crosswalk-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.lane-config-form h4,
.crosswalk-config-form h4 {
    margin: 0;
    color: #1a237e;
}

.ped-phase-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    background: #9c27b0;
    color: white;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Lane ID and Signal Group side-by-side */
.lane-id-signal-row {
    display: flex;
    gap: 12px;
}

.lane-id-signal-row .lane-id-field,
.lane-id-signal-row .signal-group-field {
    flex: 1;
}

.lane-id-signal-row label {
    display: block;
    margin-bottom: 4px;
}

.lane-id-signal-row input {
    width: 100%;
    box-sizing: border-box;
}

/* Connector display in Step 5 lane config */
.connects-to-display {
    margin-top: 10px;
    padding: 8px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid #1a237e;
}

.connects-to-display label {
    font-weight: 600;
    color: #666;
    margin-right: 6px;
}

.connects-to-value {
    color: #1a237e;
    font-weight: 500;
}

.connects-to-content {
    margin-top: 6px;
}

.connects-to-none {
    color: #888;
    font-style: italic;
}

/* Connectors table in Step 5 */
.connectors-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 6px;
}

.connectors-table th,
.connectors-table td {
    padding: 4px 6px;
    text-align: left;
    border: 1px solid #ddd;
}

.connectors-table th {
    background: #e8eaf6;
    font-weight: 600;
    color: #1a237e;
}

.connectors-table td {
    background: white;
}

.connectors-table tr:hover td {
    background: #f5f5f5;
}

.connector-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.add-connector-btn,
.remove-connector-btn {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.add-connector-btn {
    background: #4caf50;
    color: white;
    border: none;
}

.add-connector-btn:hover {
    background: #43a047;
}

.remove-connector-btn {
    background: #f44336;
    color: white;
    border: none;
}

.remove-connector-btn:hover {
    background: #e53935;
}

/* Add connector form */
.add-connector-form {
    margin-top: 8px;
    padding: 8px;
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 4px;
}

.add-connector-form label {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
}

.add-connector-form select {
    width: 100%;
    padding: 4px;
    font-size: 11px;
    margin-bottom: 6px;
}

.add-connector-form-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.focus-lane-btn,
.focus-crosswalk-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: #e8eaf6;
    border: 1px solid #1a237e;
    border-radius: 4px;
    color: #1a237e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.focus-lane-btn:hover,
.focus-crosswalk-btn:hover {
    background: #1a237e;
    color: white;
}

.focus-icon {
    font-size: 14px;
}

/* Lane number labels on map */
.lane-label {
    background: none;
    border: none;
    z-index: 1000 !important;  /* Above Leaflet.PM edit vertices */
}

.lane-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 2px 8px;
    background: #1a237e;
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 14px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Compact number labels when zoomed out */
.lane-label.compact span {
    min-width: 20px;
    height: 20px;
    padding: 0;
    font-size: 11px;
    border-radius: 50%;
}

/* Crosswalk labels - purple to match crosswalk line color */
.lane-label.crosswalk-label span {
    background: #9c27b0;
}

/* Distance tooltip during lane drawing */
.drawing-distance-tooltip {
    position: fixed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.95);
    color: #1a237e;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 10000;
    white-space: nowrap;
    border: 1px solid #1a237e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Guided Lane Drawing UI */
.lane-drawing-prompt {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.lane-drawing-prompt .prompt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1565c0;
}

.lane-drawing-prompt .direction-icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1565c0;
    color: white;
    border-radius: 50%;
}

.lane-drawing-prompt .prompt-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.lane-drawing-prompt .sg-hint {
    color: #4caf50;
    font-weight: 500;
}

/* Lane Progress Indicator - Two Row Layout */
.lane-progress-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.lane-progress-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lane-progress-row .progress-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    width: 50px;
    flex-shrink: 0;
}

.lane-progress-row .progress-item {
    padding: 6px 12px;
    border-radius: 16px;
    background: #e0e0e0;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
    cursor: pointer;
}

.lane-progress-row .progress-item:hover {
    background: #bdbdbd;
    transform: scale(1.05);
}

.lane-progress-row .progress-item.active:hover,
.lane-progress-row .progress-item.completed:hover {
    transform: scale(1.05);
}

.lane-progress-row .progress-item.active {
    background: #1a237e;
    color: white;
}

.lane-progress-row .progress-item.completed {
    background: #4caf50;
    color: white;
}

/* Lane Drawing Navigation */
.lane-drawing-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.lane-drawing-nav .secondary-btn {
    flex: 1;
}

.lane-drawing-nav .primary-btn {
    flex: 2;
}

/* Lane list items with delete button */
.lane-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.lane-list-item span {
    flex: 1;
}

.lane-id-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    background: #1a237e;
    color: white;
    border-radius: 10px;
    margin-left: 8px;
}

.lane-id-badge.crosswalk-lane-id {
    background: #9c27b0;
}

.lane-length-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    background: #4caf50;
    color: white;
    border-radius: 10px;
    margin-left: 6px;
}

.delete-lane-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #f44336;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: background 0.2s;
}

.delete-lane-btn:hover {
    background: #d32f2f;
}

/* Current movement indicator */
.movement-indicator {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.movement-indicator .movement-item {
    padding: 4px 8px;
    border-radius: 4px;
    background: #f5f5f5;
    font-size: 10px;
    font-weight: 500;
    color: #999;
}

.movement-indicator .movement-item.active {
    background: #1565c0;
    color: white;
}

.movement-indicator .movement-item.completed {
    background: #c8e6c9;
    color: #2e7d32;
}

/* ==========================================
   Guided Crosswalk Drawing Styles
   ========================================== */

.crosswalk-drawing-prompt {
    background: #f3e5f5;  /* Light purple background */
    border: 1px solid #9c27b0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.crosswalk-drawing-prompt .prompt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #7b1fa2;
}

.crosswalk-drawing-prompt .prompt-header span:first-child {
    font-size: 24px;
}

.crosswalk-drawing-prompt .prompt-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.crosswalk-drawing-prompt .sg-hint {
    color: #4caf50;
    font-weight: 500;
}

.crosswalk-drawing-prompt .no-ped-warning {
    color: #d32f2f;
    font-weight: 600;
    font-size: 13px;
    margin: 0 0 8px 0;
}

/* Crosswalk Progress Indicator */
.crosswalk-progress {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.crosswalk-progress .progress-item {
    padding: 6px 12px;
    border-radius: 16px;
    background: #e0e0e0;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
    cursor: pointer;
}

.crosswalk-progress .progress-item:hover {
    background: #bdbdbd;
    transform: scale(1.05);
}

.crosswalk-progress .progress-item.active {
    background: #9c27b0;  /* Purple for crosswalks */
    color: white;
}

.crosswalk-progress .progress-item.completed {
    background: #4caf50;
    color: white;
}

/* Crosswalk Drawing Navigation */
.crosswalk-drawing-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.crosswalk-drawing-nav .secondary-btn {
    flex: 1;
}

.crosswalk-drawing-nav .primary-btn {
    flex: 2;
}

/* Crosswalk list items with delete button */
.crosswalk-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.crosswalk-list-item span {
    flex: 1;
}

.delete-crosswalk-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #f44336;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: background 0.2s;
}

.delete-crosswalk-btn:hover {
    background: #d32f2f;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

.output-display {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #e0e0e0;
    margin: 8px 0;
}

.save-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.primary-btn {
    background: #1a237e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #0d1642;
}

.primary-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.primary-btn.large {
    padding: 14px 32px;
    font-size: 16px;
}

.secondary-btn {
    background: white;
    color: #1a237e;
    border: 1px solid #1a237e;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f5f5f5;
}

.secondary-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.danger-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: #b71c1c;
}

/* Auto-Calculate Reference Point Section */
.auto-refpoint-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed #ddd;
}

.auto-refpoint-section button {
    width: 100%;
    margin-bottom: 4px;
}

#auto-calc-hint {
    margin-top: 4px;
    font-size: 12px;
}

/* Validation Report Styles */
.validation-report {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.validation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.validation-header h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.validation-score {
    font-size: 20px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 4px;
}

.validation-score.good {
    background: #28a745;
    color: white;
}

.validation-score.warn {
    background: #ffc107;
    color: #333;
}

.validation-score.bad {
    background: #dc3545;
    color: white;
}

.validation-errors,
.validation-warnings {
    font-size: 13px;
}

.validation-errors .error-item {
    color: #dc3545;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.validation-warnings .warning-item {
    color: #856404;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.validation-errors .error-icon,
.validation-warnings .warning-icon {
    flex-shrink: 0;
}

.validation-summary {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.validation-errors .success-item {
    color: #28a745;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

/* Connector Summary Table (Step 8) */
.connector-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.connector-summary h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #333;
}

.connector-summary .no-connectors {
    color: #666;
    font-style: italic;
    font-size: 12px;
}

.connector-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.connector-table th,
.connector-table td {
    padding: 5px 8px;
    border: 1px solid #ddd;
    text-align: left;
}

.connector-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.connector-table tr:nth-child(even) {
    background: #fafafa;
}

.connector-table tr:hover {
    background: #f0f7ff;
}

/* Encoding Options */
.encoding-options {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
}

.encoding-options label {
    font-weight: 500;
    margin-right: 8px;
}

.encoding-options select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.encoding-options .help-text {
    display: block;
    margin-top: 6px;
    font-size: 11px;
}

/* Info Button and Popup */
.info-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.info-btn:hover {
    opacity: 1;
}

.info-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.info-popup.hidden {
    display: none;
}

.info-popup-content {
    background: white;
    padding: 20px 24px;
    border-radius: 8px;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.info-popup-content h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 18px;
}

.info-popup-content h5 {
    margin: 16px 0 8px 0;
    color: #555;
    font-size: 14px;
}

.info-popup-content p {
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #444;
}

.info-popup-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.info-popup-close:hover {
    color: #333;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 8px 0;
}

.info-table td {
    padding: 4px 8px;
    border: 1px solid #ddd;
}

.info-table tr:nth-child(odd) {
    background: #f9f9f9;
}

.info-note {
    font-style: italic;
    color: #666 !important;
    font-size: 12px !important;
    margin-top: 12px !important;
}

/* Mobile responsive adjustments for modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 8px;
    }

    .output-display {
        font-size: 11px;
    }
}

/* ============================================================================
   MAP Builder Two-Panel Layout
   ============================================================================ */

/* MAP Builder Sidebar Panel (replaces Intersections list when builder is open) */
#maps-builder-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.maps-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a237e;
    color: white;
    user-select: none;
}

/* Collapse sidebar button */
.sidebar-collapse-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    transition: background 0.2s;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.25);
}

.maps-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.maps-panel-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.maps-panel-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.maps-list.collapsed {
    display: none;
}

.primary-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.new-map-btn {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
    white-space: nowrap;
}

.new-map-btn:hover {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
    transform: translateY(-1px);
}

.new-map-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(46, 125, 50, 0.3);
}

.maps-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.map-list-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.map-list-item:hover {
    border-color: #1a237e;
}

.map-list-item.selected {
    border-color: #1a237e;
    background: #e8eaf6;
}

.map-list-item .map-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-list-item .map-meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
}

.map-list-item .map-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.map-list-item .map-actions button {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.broadcast-badge {
    padding: 2px 6px;
    font-size: 9px;
    border-radius: 10px;
    background: #4caf50;
    color: white;
    font-weight: 600;
}

.broadcast-badge.inactive {
    background: #9e9e9e;
}

.maps-list-empty {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 12px;
}

.maps-list-empty p {
    margin: 8px 0;
}

/* Delete confirmation dialog */
.delete-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
}

.delete-confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10002;
    max-width: 320px;
}

.delete-confirm-dialog h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.delete-confirm-dialog p {
    margin: 8px 0;
    font-size: 14px;
}

/* Responsive adjustments for MAP Builder */
@media (max-width: 800px) {
    #maps-builder-view .maps-list {
        padding: 4px;
    }

    .map-list-item {
        padding: 8px;
    }
}

/* ==========================================
   Drawing Mode Toggle (Auto/Manual)
   ========================================== */

.drawing-mode-toggle {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
    border-radius: 8px;
    border: 1px solid #d0d7de;
}

.drawing-mode-toggle .toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 8px;
}

.toggle-buttons {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #3388ff;
}

.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: white;
    color: #3388ff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:first-child {
    border-right: 1px solid #3388ff;
}

.toggle-btn.active {
    background: #3388ff;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: #f0f7ff;
}

.drawing-mode-hint {
    font-size: 11px;
    color: #666;
    margin-top: 8px;
    margin-bottom: 0;
    text-align: center;
}

/* ==========================================
   Lane Simplification Controls (+/− buttons)
   ========================================== */

.lane-simplify-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f7ff;
    border: 1px solid #d0e3f7;
    border-radius: 6px;
    margin-top: 10px;
}

.lane-simplify-controls.hidden {
    display: none;
}

.simplify-label {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.simplify-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #3388ff;
    background: white;
    color: #3388ff;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
}

.simplify-btn:hover:not(:disabled) {
    background: #3388ff;
    color: white;
}

.simplify-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#simplify-count {
    font-size: 12px;
    color: #666;
    min-width: 45px;
    text-align: center;
    font-family: monospace;
}

/* ==========================================
   Synchro Approach Overlay (Top-left on map)
   ========================================== */

.synchro-approach-overlay {
    position: absolute;
    top: 10px;
    left: 60px; /* Clear Leaflet.PM toolbar */
    z-index: 1000;
    background: rgba(30, 30, 40, 0.95);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #e0e0e0;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.synchro-approach-overlay.hidden {
    display: none;
}

.synchro-overlay-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.synchro-overlay-header #synchro-overlay-direction {
    background: #4caf50;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
}

/* Direction-specific badge colors */
.synchro-approach-overlay.nb #synchro-overlay-direction { background: #4caf50; }
.synchro-approach-overlay.sb #synchro-overlay-direction { background: #f44336; }
.synchro-approach-overlay.eb #synchro-overlay-direction { background: #2196f3; }
.synchro-approach-overlay.wb #synchro-overlay-direction { background: #ff9800; }

.synchro-overlay-header #synchro-overlay-street {
    color: #ffeb3b;
    font-weight: bold;
    font-size: 13px;
}

.synchro-overlay-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Total lanes row */
.synchro-overlay-content .total-lanes {
    color: #aaa;
    font-size: 10px;
    margin-bottom: 6px;
}

/* Movement row - table-like layout */
.synchro-overlay-content .movement-row {
    display: flex;
    align-items: center;
    background: rgba(60, 60, 80, 0.5);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    border-left: 3px solid #3388ff;
}

/* Direction-specific left border colors for movement rows */
.synchro-approach-overlay.nb .movement-row { border-left-color: #4caf50; }
.synchro-approach-overlay.sb .movement-row { border-left-color: #f44336; }
.synchro-approach-overlay.eb .movement-row { border-left-color: #2196f3; }
.synchro-approach-overlay.wb .movement-row { border-left-color: #ff9800; }

.synchro-overlay-content .movement-badge {
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    min-width: 36px;
    text-align: center;
}

.synchro-overlay-content .lane-count {
    margin-left: 12px;
    color: #ccc;
    flex: 1;
}

.synchro-overlay-content .phase-badge {
    background: #1a237e;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
}

.synchro-overlay-content .perm-phase-badge {
    background: #2e7d32;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 4px;
}

/* Protected/Permissive badges for turn movements */
.synchro-overlay-content .protected-badge {
    background: #1565c0;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
}

.synchro-overlay-content .permissive-badge {
    background: #f9a825;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
}

.synchro-overlay-content .prot-perm-badge {
    background: linear-gradient(90deg, #1565c0 50%, #f9a825 50%);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* Phase numbers displayed after protection badges */
.synchro-overlay-content .phase-numbers {
    color: #90caf9;
    font-size: 10px;
    margin-left: 4px;
    font-weight: 500;
}

/* Storage/pocket info */
.synchro-overlay-content .storage-info {
    color: #4caf50;
    font-size: 10px;
    padding-left: 12px;
    margin-top: -2px;
    margin-bottom: 4px;
}

/* ==========================================
   Auto-Detect Lane Styles (legacy)
   ========================================== */

.auto-detect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-weight: 500;
    background: white;
    border: 1px solid #3388ff;
    color: #3388ff;
    transition: all 0.2s ease;
}

.auto-detect-btn:hover {
    background: #3388ff;
    color: white;
}

.auto-detect-hint {
    font-size: 11px;
    color: #666;
    margin-top: 8px;
    margin-bottom: 0;
    text-align: center;
}

/* Loading overlay */
.auto-detect-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
    backdrop-filter: blur(2px);
}

.auto-detect-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.auto-detect-loading p {
    font-size: 16px;
    font-weight: 500;
}

/* Error/success toast */
.auto-detect-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    background: #333;
    color: white;
    border-radius: 8px;
    z-index: 10001;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toast-fade-in 0.3s ease;
}

.auto-detect-toast.error {
    background: #d32f2f;
}

.auto-detect-toast.success {
    background: #388e3c;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes toast-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   Synchro Data Panel (MAP Builder Step 4)
   ============================================ */

.synchro-panel {
    margin-top: 15px;
    background: #1e1e28;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
}

.synchro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2a2a3a;
    cursor: pointer;
    user-select: none;
}

.synchro-title {
    color: #e0e0e0;
    font-weight: 600;
}

.synchro-status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #444;
    color: #888;
}

.synchro-status.found {
    background: #1b5e20;
    color: #81c784;
}

.synchro-status.error {
    background: #b71c1c;
    color: #ef9a9a;
}

.synchro-body {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.synchro-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

.synchro-content {
    padding: 10px;
    color: #ccc;
}

.synchro-hint {
    color: #888;
    font-style: italic;
    margin: 0;
}

.synchro-name {
    color: #ffeb3b;
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 12px;
}

.synchro-id {
    color: #4caf50;
    font-size: 10px;
    margin-bottom: 8px;
}

.synchro-approach {
    background: rgba(60, 60, 80, 0.5);
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    border-left: 3px solid #4caf50;
}

.synchro-approach.nb { border-left-color: #2196f3; }
.synchro-approach.sb { border-left-color: #ff9800; }
.synchro-approach.eb { border-left-color: #9c27b0; }
.synchro-approach.wb { border-left-color: #f44336; }

.synchro-approach-header {
    color: #fff;
    font-weight: bold;
}

.synchro-approach-street {
    color: #aaa;
    font-size: 10px;
}

.synchro-movement {
    padding: 2px 0 2px 10px;
    font-size: 10px;
    color: #bbb;
}

.synchro-phase {
    display: inline-block;
    background: #1a237e;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    font-size: 9px;
}

.synchro-perm-phase {
    display: inline-block;
    background: #2e7d32;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 2px;
    font-size: 9px;
}

.synchro-storage {
    color: #4caf50;
    margin-left: 4px;
}

/* ============================================
   Claude's MAP Builder Modal Styles
   ============================================ */

.maps-panel-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.claude-map-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.claude-map-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.claude-modal {
    z-index: 1001;
}

.claude-modal-content {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

.claude-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    position: relative;
    border-radius: 0;
}

.claude-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.claude-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.claude-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.claude-tab {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.claude-tab:hover {
    background: #ebebeb;
}

.claude-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.claude-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.claude-tab-content.hidden {
    display: none;
}

.claude-search-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.claude-search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.claude-count {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.claude-table-container {
    flex: 1;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.claude-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.claude-table th,
.claude-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.claude-table th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.claude-table tbody tr:hover {
    background: #f8f9fa;
}

.claude-table td.loading,
.claude-table td.empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.claude-table .action-btn {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 0.25rem;
}

.claude-table .action-btn.generate {
    background: #667eea;
    color: white;
}

.claude-table .action-btn.generate:hover {
    background: #5a6fd6;
}

.claude-table .action-btn.view {
    background: #2196F3;
    color: white;
}

.claude-table .action-btn.save {
    background: #4CAF50;
    color: white;
}

.claude-table .action-btn.delete {
    background: #f44336;
    color: white;
}

.claude-table .action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.claude-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.confidence-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.confidence-badge.high {
    background: #c8e6c9;
    color: #2e7d32;
}

.confidence-badge.medium {
    background: #fff9c4;
    color: #f57f17;
}

.confidence-badge.low {
    background: #ffcdd2;
    color: #c62828;
}

.claude-batch-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.claude-modal-footer {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
}

.claude-status {
    font-size: 0.9rem;
    color: #666;
    min-height: 1.5rem;
}

.claude-status.success {
    color: #2e7d32;
}

.claude-status.error {
    color: #c62828;
}

/* Loading Overlay */
.claude-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.claude-loading-overlay.hidden {
    display: none;
}

.claude-loading-content {
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
}

.claude-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.claude-loading-content p {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: #333;
}

.claude-loading-progress {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.claude-loading-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* Claude Build Steps */
.claude-build-steps {
    padding: 1rem;
}

.claude-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.claude-step {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #999;
    background: #e0e0e0;
    transition: all 0.3s;
}

.claude-step.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.claude-step.completed {
    background: #4CAF50;
    color: white;
}

.claude-step-arrow {
    color: #ccc;
    font-size: 1.2rem;
}

.claude-build-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.claude-build-step.active {
    display: block;
}

.claude-build-step h3 {
    margin: 0 0 1rem;
    color: #333;
    font-size: 1.2rem;
}

.claude-build-step p {
    color: #666;
    margin-bottom: 1rem;
}

.claude-selected-info,
.claude-point-info,
.claude-summary {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.claude-selected-info p,
.claude-point-info p,
.claude-summary p {
    margin: 0.5rem 0;
    color: #333;
}

.claude-hint {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.claude-generate-options {
    margin: 1rem 0;
}

.claude-generate-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.claude-offset-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid #e0e0e0;
}

.claude-offset-controls .offset-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
}

.claude-offset-controls .offset-slider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.claude-offset-controls .offset-slider label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #555;
}

.claude-offset-controls .offset-slider input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.claude-offset-controls .offset-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.claude-offset-controls .offset-slider span {
    min-width: 40px;
    text-align: right;
    font-family: monospace;
    font-size: 0.9rem;
    color: #333;
}

.claude-offset-controls .offset-hint {
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.5rem;
    font-style: italic;
}

.claude-generate-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.claude-build-nav {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-top: 1px solid #eee;
    margin-top: 1rem;
}

.claude-table .action-btn.select {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.claude-table .action-btn.select:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Claude map markers */
.claude-synchro-marker {
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.claude-center-marker {
    background: #4CAF50;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.claude-landmark-marker {
    background: #ff9800;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Leaflet.PM Undo Button */
.leaflet-pm-undo-control {
    margin-top: 10px !important;
}

.leaflet-pm-undo-control a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: white;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.leaflet-pm-undo-control a:hover {
    background-color: #f4f4f4;
}

.leaflet-pm-undo-control a.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.leaflet-pm-undo-control svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
