/* Reset and base styles */
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Main layout */
body {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: 100vh;
}

/* Sidebar styles */
#sidebar {
    width: 320px;
    min-width: 320px;
    max-width: 320px; /* Ensure sidebar never exceeds this width */
    height: 100%;
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: absolute;
    z-index: 1000;
    left: 0;
    top: 0;
    box-sizing: border-box; /* Include border in width calculations */
}

#sidebar-scrollable-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    height: 0; /* Flexbox trick for overflow */
    box-sizing: border-box; /* Include padding and border in width calculations */
}

/* Ensure all elements within sidebar respect container width */
#sidebar * {
    max-width: 100%;
    box-sizing: border-box;
}

#sidebar.collapsed {
    transform: translateX(-320px);
}

#toggle-sidebar {
    position: fixed;
    background-color: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    top: 10px;
    transition: left 0.3s ease;
    left: 10px;
}

#sidebar:not(.collapsed) ~ #map-container #toggle-sidebar {
    left: 330px;
}

#toggle-sidebar:hover {
    background-color: #f4f4f4;
}

#toggle-sidebar i {
    color: #666;
    font-size: 16px;
}

.sidebar-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #2193b0, #6dd5ed);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-avatars {
    display: flex;
    align-items: center;
    margin-left: 6px;
    flex-shrink: 0; /* Prevent avatars from shrinking */
}

.header-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    object-fit: cover;
    margin-left: -14px; /* Increased negative margin for more overlap */
    transition: transform 0.2s ease, z-index 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-avatar:first-child {
    margin-left: 0; /* No negative margin for the first avatar */
    z-index: 1; /* First avatar on top */
}

.header-avatar:nth-child(2) {
    z-index: 2; /* Second avatar slightly behind first */
}

.header-avatar:nth-child(3) {
    z-index: 3; /* Third avatar behind both */
}

.header-avatar:hover {
    transform: scale(1.1);
    z-index: 10;
}

.accordion-section {
    border-bottom: 1px solid #dee2e6;
}

.accordion-header {
    padding: 12px 15px;
    background-color: #e9ecef;
    border: none;
    width: 100%;
    text-align: left;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.accordion-header input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.accordion-header label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1;
    cursor: pointer;
    font-weight: 600;
}

.accordion-header label span {
    /* Style for the text part of the label if needed */
}

.accordion-header label i.fas {
    margin-left: auto;
}

.accordion-header:hover {
    background-color: #dee2e6;
}

.accordion-content {
    padding: 15px;
    display: none;
    box-sizing: border-box; /* Include padding in width calculations */
}

.accordion-content.active {
    display: block;
}

.control-group {
    margin-bottom: 12px;
    box-sizing: border-box; /* Include padding and border in width calculations */
    max-width: 100%; /* Prevent overflow */
}

.control-group-title {
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

.btn {
    padding: 6px 12px;
    margin: 3px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box; /* Include padding and border in width calculations */
    max-width: 100%; /* Prevent buttons from exceeding container width */
}

.btn:hover {
    background-color: #0069d9;
}

.btn-action {
    background-color: #007bff;
    width: 100%;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    width: 100%;
    display: none; /* Hidden by default */
}

.btn-danger:hover {
    background-color: #bd2130;
}

/* Show danger buttons when debug mode is enabled */
body.debug-mode .btn-danger {
    display: inline-block;
}

.btn-info {
    background-color: #17a2b8;
    width: 100%;
}

.btn-info:hover {
    background-color: #138496;
}

.btn.disabled, 
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
}

.checkbox-group label {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.info-subsection {
    margin-bottom: 15px;
}

.info-subsection h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #495057;
}

.info-subsection p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6c757d;
}

.status-bar {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    color: #495057;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
}

.status-bar:hover {
    background-color: #e9ecef;
}

.status-bar.expanded {
    border-radius: 4px 4px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.status-bar.status-highlight {
    animation: highlight-status 1.5s ease-out;
}

.status-log-expanded {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1100;
}

.status-log-entry {
    padding: 6px 12px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.4;
}

.status-log-entry:last-child {
    border-bottom: none;
}

.status-log-entry:hover {
    background-color: #f8f9fa;
}

.status-log-entry.current-status {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
    padding-left: 9px;
}

.status-log-entry.current-status:hover {
    background-color: #e1f5fe;
}

.status-log-time {
    color: #6c757d;
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
    min-width: 60px;
}

.status-log-message {
    color: #495057;
    flex-grow: 1;
    word-break: break-word;
}

@keyframes highlight-status {
    0% {
        background-color: #f8f9fa; /* Original color */
    }
    25% {
        background-color: #c8e6c9; /* Light Green highlight color */
        box-shadow: 0 0 8px rgba(76, 175, 80, 0.7); /* Subtle green glow */
    }
    100% {
        background-color: #f8f9fa; /* Back to original */
    }
}

.share-proposal-container {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}

.total-spent-container {
    display: flex;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.total-spent-label {
    font-weight: 600;
    color: #495057;
}

.total-spent-value {
    font-weight: 700;
    color: #28a745; /* Success/Money green color */
}

/* Shared style for all info panels */
.info-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: none;
    overflow-y: auto;
    z-index: 1000;
}

.info-panel.visible {
    display: block;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.close-button:hover {
    color: #333;
}

/* Progress bar */
.progress-container {
    margin-top: 10px;
    display: none;
}

.progress-bar {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #007bff;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* Button groups */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box; /* Include padding and border in width calculations */
    max-width: 100%; /* Prevent overflow */
}

/* Force buttons in groups to fill container width */
.btn-group .btn {
    width: 100%;
}

/* 2x2 Grid layout for specific button groups */
.btn-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
}

.btn-grid-2x2 .btn {
    width: 100%;
    box-sizing: border-box;
}

/* Block item styling */
.block-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.block-item:hover {
    background-color: #f5f5f5;
}

.block-item.active {
    background-color: #e3f2fd;
}

.road-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.road-checkbox input {
    margin-right: 8px;
}

/* Base class for all parcel info buttons */
.parcel-info-btn {
    font-size: 0.9em;
    padding: 2px 8px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

/* Individual button colors */
.visualize-button {
    background-color: #4CAF50;
}

.neighbors-button {
    background-color: #2196F3;
}

.neighbors-button.active {
    background-color: #f44336;
}

.vertices-button {
    background-color: #9C27B0;
}

.vertices-button.active {
    background-color: #f44336;
}

.measure-road-button {
    background-color: #933513;
}

.vertex-marker {
    fill: #9C27B0;
    stroke: white;
    stroke-width: 1;
    opacity: 0.8;
    cursor: pointer;
    transition: r 0.2s ease;
}

.vertex-marker:hover {
    fill: #7B1FA2;
    r: 6;
}

.metric-group {
    margin-bottom: 12px;
}

.metric-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 3px;
}

.metric-value {
    color: #212529;
}

/* New coordinates control */
.coordinates-control {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
    font-size: 12px;
    font-family: monospace;
    line-height: 1.4;
}

/* Blocks list styling */
#blocks-list-container {
    display: none; /* Hidden by default */
    position: fixed;
    top: 60px;
    right: 30px;
    max-height: 70vh;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
    z-index: 2000;
    /* Width intentionally not set to allow flexible sizing */
}

#blocks-list-container .blocks-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 0 12px;
}

#blocks-list-container .blocks-list-header span {
    font-weight: bold;
    font-size: 1.1em;
}

#blocks-list-container .blocks-list-close {
    background: none;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#blocks-list-container .blocks-list-close:hover {
    background-color: #f5f5f5;
    color: #333;
}

#blocks-content {
    padding: 8px 12px 12px 12px;
}

/* Update map container to be full width */
#map-container {
    flex: 1;
    height: 100%;
    position: relative;
    width: 100%;
}

/* Map positioning */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Add CSS for zoom control positioning */
.leaflet-top.leaflet-left {
    transition: left 0.3s ease;
    left: 30px;
}

#sidebar:not(.collapsed) ~ #map-container .leaflet-top.leaflet-left {
    left: 350px;
}

#controls {
    padding: 10px;
    background: #f8f9fa;
    position: relative;
}

/* 
Parcel info panel should be in the bottom right corner of the map, 
with a width of 300px, and a height of half of the map height minus 5px.
*/
#parcel-info-panel {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 300px;
    height: calc(70vh - 20px);
    max-height: calc(80vh - 5px);
    display: none;
    overflow: hidden;
}

#parcel-info-panel.visible {
    display: flex;
    flex-direction: column;
}

/* 
Road info panel should be in the bottom right corner of the map, 
with a width of 300px, and a height of half of the map height minus 5px.
*/
#road-info-panel {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 300px;
    height: calc(70vh - 20px);
    max-height: calc(80vh - 5px);
    overflow-y: auto;
    display: none;
}

#road-info-panel.visible {
    display: block;
}

#road-info-panel h3 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 30px;
}

#road-info-panel .metric-group {
    margin-bottom: 12px;
}

#road-info-panel .metric-label {
    font-weight: 500;
    color: #666;
    margin-bottom: 2px;
}

#road-info-panel .metric-value {
    color: #333;
    margin-left: 8px;
}

#road-info-panel .close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}

#road-info-panel .close-button:hover {
    color: #333;
}

/* Parcel info panel now uses .panel-header structure */

#parcel-info-panel .metric-group {
    margin-bottom: 12px;
}

#parcel-info-panel .metric-label {
    font-weight: 500;
    color: #666;
    margin-bottom: 2px;
}

#parcel-info-panel .metric-value {
    color: #333;
    margin-left: 8px;
}

/* Parcel Info Panel Tabs */
.parcel-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin: 0;
    background: rgba(248, 249, 250, 0.5);
    flex-shrink: 0;
}

.parcel-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.parcel-tab-btn:hover {
    background-color: #f8f9fa;
    color: #333;
}

.parcel-tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: #f8f9fa;
}

.parcel-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

.parcel-tab-content.active {
    display: flex;
}

/* Parcel info body now uses .panel-body structure */

.tools-section {
    padding: 10px 0;
}

/* Proposals tab content styling */
#proposals-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#proposals-content .metric-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#proposals-content .metric-value {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.parcel-layer {
    fill: rgba(255, 0, 0, 0.2);
    stroke: red;
    stroke-width: 1;
}

.parcel-layer.road {
    fill: rgba(128, 128, 128, 0.2);
    stroke: #666;
}

.parcel-layer:hover {
    fill: rgba(255, 0, 0, 0.4);
    stroke-width: 2;
}

.parcel-layer.road:hover {
    fill: rgba(128, 128, 128, 0.4);
}

.parcel-layer.selected {
    fill: rgba(255, 51, 0, 0.4);
    stroke: #ff3300;
    stroke-width: 4;
    stroke-opacity: 1;
}

.parcel-layer.multi-selected {
    fill: rgba(255, 152, 0, 0.6);
    stroke: #f57c00;
    stroke-width: 3;
}

.road-name-tooltip {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 3px;
    color: white;
    font-weight: bold;
    padding: 2px 6px;
    white-space: nowrap;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.road-parcel {
    stroke-dasharray: none;
    stroke-opacity: 1;
}

.road-legend {
    font-size: 13px;
    margin-top: 6px;
}

.legend-swatch {
    display: inline-block;
    width: 18px;
    height: 12px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 2px;
    border: 1px solid #888;
}


.building-layer {
    fill: rgba(0, 0, 255, 0.2);
    stroke: blue;
    stroke-width: 1;
}

.building-layer:hover {
    fill: rgba(0, 0, 255, 0.4);
    stroke-width: 2;
}

.layer-toggle {
    margin-right: 10px;
}

.centerline {
    stroke: yellow;
    stroke-width: 3;
    stroke-dasharray: 10, 5;
}

.width-line {
    stroke: orange;
    stroke-width: 1;
}

.coordinates {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    pointer-events: none;
}

/* Animation Modal Styles */
#animation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

#animation-container {
    position: relative;
    width: 80%;
    height: 80%;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#animation-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#animation-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

#animation-map {
    flex-grow: 1;
    width: 100%;
}

#animation-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #666;
    cursor: pointer;
}

#animation-close:hover {
    color: #333;
}

#animation-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1001;
}

#animation-progress {
    background-color: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    align-items: center;
}

#animation-step {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    min-width: 300px;
}

#animation-buttons {
    display: flex;
    gap: 5px;
}

.animation-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
}

.animation-button:hover {
    background-color: #0069d9;
}

.animation-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Animation Elements */
.boundary-point {
    fill: red;
    r: 3;
}

.sample-point {
    fill: blue;
    r: 3;
}

.opposite-point {
    fill: green;
    r: 3;
}

.midpoint {
    fill: yellow;
    r: 3;
}

.search-line {
    stroke: rgba(100, 100, 100, 0.3);
    stroke-width: 1;
    stroke-dasharray: 2, 2;
}

.width-line-animation {
    stroke: orange;
    stroke-width: 2;
}

.centerline-segment {
    stroke: yellow;
    stroke-width: 3;
}

.final-centerline {
    stroke: yellow;
    stroke-width: 3;
    stroke-dasharray: 10, 5;
}

.visualize-button:hover {
    background-color: #0056b3;
}

.visualize-button:active {
    background-color: #004085;
}

.progress-container {
    display: none;
    margin-top: 10px;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #007bff;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

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

.button-group button {
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.button-group button:hover {
    background-color: #0056b3;
}

.button-group button:active {
    background-color: #004085;
}

/* Block styles */
.blocks-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.block-rectangle {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    color: #495057;
}

.block-rectangle:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.block-rectangle.active {
    background-color: #007bff;
    border-color: #0056b3;
    color: white;
}

.blocks-list {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
    min-width: 200px;
}

.blocks-list h3 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 30px;
}

.blocks-list .close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}

.blocks-list .close-button:hover {
    color: #333;
}

.block-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.block-item:hover {
    background-color: #f8f9fa;
}

.block-item.active {
    background-color: #007bff;
    color: white;
}

.block-count {
    color: #666;
    font-size: 12px;
}

.block-item.active .block-count {
    color: rgba(255, 255, 255, 0.8);
}

/* 
Block info panel should be in the top right corner of the map, 
with a width of 300px, and a height of up to half of the map height minus 5px.
*/
#block-info-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    max-height: calc(45vh - 5px);
    display: none;
}

#block-info-panel.visible {
    display: block;
}

#block-info-panel h3 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    color: #333;
}

#block-info-panel .close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}

#block-info-panel .close-button:hover {
    color: #333;
}

#block-info-panel .metric-group {
    margin-bottom: 12px;
}

#block-info-panel .metric-label {
    font-weight: 500;
    color: #666;
    margin-bottom: 2px;
}

#block-info-panel .metric-value {
    color: #333;
    margin-left: 8px;
}

#block-parcels-list {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
}

.parcel-item, .proposal-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.parcel-item:last-child, .proposal-item:last-child {
    margin-bottom: 0;
}

.parcel-item:hover, .proposal-item:hover {
    background: #e9ecef;
    border-left-color: #007bff;
    transform: translateX(2px);
}

.parcel-item.has-proposals {
    border-left-color: #ffc107;
    background: #fff8e1;
}

.parcel-item.has-proposals:hover {
    background: #fff3c4;
    border-left-color: #ff9800;
}

.parcel-proposal-count {
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

.parcel-item.high-proposals {
    border-left-color: #dc3545;
    background: #ffebee;
}

.parcel-item.high-proposals:hover {
    background: #ffcdd2;
    border-left-color: #c62828;
}

.parcel-item.high-proposals .parcel-proposal-count {
    color: #d32f2f;
    font-weight: 600;
}

/* Selected parcel animation */
@keyframes selectedParcelBorder {
    0% {
        stroke-width: 2;
        stroke-opacity: 1;
    }

    50% {
        stroke-width: 4;
        stroke-opacity: 0.7;
    }

    100% {
        stroke-width: 2;
        stroke-opacity: 1;
    }
}

.selected-parcel {
    animation: selectedParcelBorder 1.5s ease-in-out infinite;
    stroke: #ff3300;
    stroke-width: 2;
}

/* Measurement tool styles */
#measureButton.active {
    background-color: #dc3545;
    border-color: #dc3545;
}

.measurement-line {
    stroke: #ff3300;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    stroke-linecap: round;
}

.measurement-marker {
    fill: #ff3300;
    stroke: white;
    stroke-width: 1;
}

.measurement-label {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ff3300;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    color: #333;
}

/* Blockify Modal Styles */
#blockify-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#blockify-container {
    position: relative;
    width: 90%;
    height: 90%;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

#blockify-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid #dee2e6;
}

#blockify-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#blockify-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

#blockify-map {
    flex-grow: 1;
    width: 100%;
}

#blockify-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #666;
    cursor: pointer;
}

#blockify-close:hover {
    color: #333;
}

#blockify-controls {
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#blockify-info {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
    min-height: 20px;
}

#blockify-buttons {
    display: flex;
    gap: 10px;
}

.blockify-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
}

.blockify-button:hover {
    background-color: #0069d9;
}

.blockify-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Blockify Sidebar Styles */
#blockify-sidebar {
    width: 300px;
    background-color: #f8f9fa;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#blockify-sidebar h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    font-size: 16px;
    color: #333;
}

.parameter-group {
    margin-bottom: 20px;
}

.parameter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.parameter-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #f8f9fa;
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
}

.parameter-group select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #e9ecef;
}

.algorithm-description {
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    margin-bottom: 15px;
    font-style: italic;
}

.parameter-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.parameter-hint {
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.parameter-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    line-height: 1.5;
}

.parameter-info p {
    margin: 0 0 10px 0;
}

.parameter-info p:last-child {
    margin-bottom: 0;
} 

/* Add CSS for tabs in the Road Analysis panel */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.tab-btn {
    background-color: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background-color: #f0f0f0;
}

.tab-btn.active {
    border-bottom: 2px solid #007bff;
    color: #007bff;
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 10px 0;
}

.tab-content.active {
    display: block;
}

/* Road Analysis Panel */
#road-analysis-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1001; /* Ensure it's above other panels */
}

.visualization-controls {
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Segment list styles */
#segments-list {
    max-height: 300px;
    overflow-y: auto;
}

.segment-item {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.segment-item:hover {
    background-color: #f0f0f0;
    cursor: pointer;
}

.segment-item.selected {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.segment-metrics {
    margin-top: 8px;
}

/* Analyze Road button style */
.analyze-button {
    background-color: #a3a728;
}

.analyze-button:hover {
    background-color: #218838;
}

/* Parcel Info Panel Button Rows */
.parcel-info-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.button-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 6px;
}
.button-row-1, .button-row-2 {
    justify-content: flex-start;
}

/* Make the buttons smaller and more compact in the parcel info panel */
#parcel-info-panel .parcel-info-btn,
#parcel-info-panel .visualize-button,
#parcel-info-panel .neighbors-button,
#parcel-info-panel .vertices-button,
#parcel-info-panel .analyze-button,
#parcel-info-panel .measure-road-button,
#parcel-info-panel .split-button {
    padding: 6px 8px;
    font-size: 12px;
    width: calc(50% - 4px);
    flex: 0 0 calc(50% - 4px);
    text-align: center;
    box-sizing: border-box;
    margin-left: 0; /* Override the margin from base class for panel buttons */
}

#parcel-info-panel .button-row button:last-child {
    margin-right: 0;
}

.crosshairs-cursor,
.crosshairs-cursor * {
    cursor: crosshair !important;
}

.btn.active-black-border {
    background-color: #0056b3; /* Slightly darker base */
    box-shadow: inset 2px 2px 5px #003366, /* Deeper, darker top-left shadow */
                inset -2px -2px 4px #007fff; /* Stronger, lighter bottom-right highlight */
    border: none; /* Ensures no border */
    transform: translateY(1px); /* Slight downward shift */
    /* color: white; */
}

/* Proposal system styles */
.btn-proposal {
    background-color: #ffd700 !important; /* Gold background */
    color: #000 !important; /* Black text */
    border: 2px solid #000 !important; /* Black border */
    font-weight: bold;
    width: 100%;
}

.btn-proposal:hover {
    background-color: #ffed4e !important; /* Lighter gold on hover */
    border-color: #333 !important;
}

.btn-proposal:disabled {
    background-color: #f0f0f0 !important;
    color: #999 !important;
    border-color: #ccc !important;
}

.btn-accept-proposal {
    background-color: #28a745 !important; /* Green background */
    color: white !important;
    border: 1px solid #28a745 !important;
    font-weight: 600;
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
}

.btn-accept-proposal:hover:not(:disabled) {
    background-color: #218838 !important;
    border-color: #1e7e34 !important;
}

.btn-accept-proposal:disabled {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed;
    opacity: 0.65;
}

.btn-reject-proposal {
    background-color: #dc3545 !important; /* Red background */
    color: white !important;
    border: 1px solid #dc3545 !important;
    font-weight: 600;
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
}

.btn-reject-proposal:hover:not(:disabled) {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
}

.proposal-actions {
    margin-top: 15px;
}

.proposal-acceptance-status {
    margin-top: 15px;
}

.acceptance-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.acceptance-circles {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.acceptance-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
    transition: all 0.2s ease;
    cursor: help;
}

.acceptance-circle.accepted {
    background-color: #28a745;
    border-color: #1e7e34;
}

.acceptance-circle.pending {
    background-color: #6c757d;
    border-color: #495057;
}

.acceptance-circle:hover {
    transform: scale(1.2);
}

.acceptance-summary {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Proposal modal styles */
.proposal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2100;
}

.proposal-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.proposal-modal-header {
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.proposal-modal-header h2 {
    margin: 0;
    color: #333;
}

.proposal-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.proposal-modal-close:hover {
    color: #333;
    background-color: #f5f5f5;
    border-radius: 50%;
}

.proposal-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.proposal-modal-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #eee;
    flex-direction: row;
}

.proposal-modal-footer .btn {
    flex: 1 1 50%;
    max-width: 50%;
    margin: 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.proposal-summary {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.proposal-summary h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.proposal-summary p {
    margin: 5px 0;
}

.parcel-list {
    max-height: 120px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.4;
}

/* Proposal list modal styles */
.proposal-list-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
}

.proposal-list-modal-content {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 400px;
    max-height: 80vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.proposal-list-modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.proposal-list-modal-header h2 {
    margin: 0;
    color: #333;
}

.proposal-list-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.proposal-list-modal-close:hover {
    color: #333;
    background-color: #f5f5f5;
    border-radius: 50%;
}

.proposal-list-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
}

.proposal-tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.proposal-tab-btn:hover {
    background-color: #e9ecef;
    color: #333;
}

.proposal-tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: white;
}

.proposal-list-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.proposal-tab-content {
    display: none;
    padding: 20px;
}

.proposal-tab-content.active {
    display: block;
}

.empty-proposals {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    margin: 0;
}

.proposal-list-item {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.proposal-list-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.proposal-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
}

.proposal-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.proposal-list-title {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.proposal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proposal-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: background-color 0.2s;
}

.proposal-delete-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #b02a37;
}

.proposal-status-indicator {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.proposal-status-indicator.active {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.proposal-status-indicator.executed {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.proposal-list-meta {
    font-size: 13px;
    color: #666;
}

/* Multi-parcel selection styles */
.selected-parcels-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
}

.selected-parcel-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.selected-parcel-item:last-child {
    border-bottom: none;
}

.selected-parcel-item .parcel-number {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.selected-parcel-item .parcel-details {
    color: #666;
    font-size: 12px;
}

/* Proposal info styles */
.proposal-info h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.proposal-list {
    margin-top: 10px;
}

.proposal-item {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.proposal-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.proposal-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.proposal-meta {
    font-size: 12px;
    color: #666;
}

.proposals-container {
    max-height: 300px;
    overflow-y: auto;
}

/* Ensure parcel info content is properly styled */
#parcel-info-content {
    margin-top: 15px;
}

/* Active buttons for multi-select */
.btn.active {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

.proposal-summary .summary-stats {
    margin-bottom: 15px;
}

.proposal-summary .summary-stats p {
    margin: 5px 0;
}

.proposal-summary .parcel-list h4 {
    margin: 10px 0 8px 0;
    color: #333;
    font-size: 14px;
}

.proposal-parcel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.proposal-parcel-item:last-child {
    border-bottom: none;
}

.proposal-parcel-item .parcel-number {
    font-weight: 600;
    color: #333;
}

.proposal-parcel-item .parcel-area {
    color: #666;
    font-size: 12px;
}

/* Proposal info panel styles */
.proposal-info {
    font-size: 14px;
}

.proposal-header {
    margin-bottom: 15px;
}

.proposal-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.proposal-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.proposal-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-left: 10px;
}

.proposal-status.active {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.proposal-status.executed {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.proposal-hash {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

.proposal-parcels-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 8px;
}

.proposal-parcels-list .proposal-parcel-item {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.proposal-parcels-list .proposal-parcel-item:last-child {
    border-bottom: none;
}

.proposal-parcels-list .parcel-number {
    font-weight: 600;
    color: #333;
}

.proposal-parcels-list .parcel-details {
    color: #666;
    font-size: 12px;
}



/* Username display styles */
.username-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: white;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    min-width: unset; /* overrides earlier min-width */
    max-width: fit-content; /* allow bubble to grow only as needed */
    width: fit-content; /* explicit so the element shrinks to its content */
}

.username-display i {
    color: #007bff;
    font-size: 13px;
}

/* Welcome modal styles */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.welcome-modal-content h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.welcome-modal-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.welcome-modal .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.welcome-modal .form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.welcome-modal .form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.welcome-modal .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.welcome-modal .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Game section styles */
.game-status .metric-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.game-status .metric-label {
    font-weight: 500;
    color: #555;
}

.game-status .metric-value {
    font-weight: 600;
    color: #333;
}

/* Turn interval slider */
.slider-group {
    margin-bottom: 12px;
}

.slider-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

#turn-interval-value {
    font-weight: 600;
    color: #007bff;
}

#turn-interval-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

#turn-interval-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#turn-interval-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Turn progress bar */
.turn-progress {
    margin-top: 12px;
}

.turn-progress-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.turn-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.turn-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
    transition: width 0.1s ease-out;
    border-radius: 4px;
}

.turn-progress-time {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* Game Log Modal */
.game-log-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.game-log-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.game-log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0 24px;
    border-bottom: 1px solid #dee2e6;
}

.game-log-modal-header h2 {
    margin: 0;
    color: #333;
}

.game-log-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-log-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.game-log-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-log-content {
    flex: 1; /* Take up remaining space in the modal body */
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    background-color: #f8f9fa;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 4px;
    color: #333;
}

.no-logs {
    text-align: center;
    color: #666;
    font-style: italic;
    font-family: inherit;
}

/* Game log clickable links */
.log-entry .agent-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted #007bff;
}

.log-entry .agent-link:hover {
    color: #0056b3;
    text-decoration: none;
    border-bottom: 1px solid #0056b3;
}

.log-entry .proposal-link {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    border-bottom: 1px dotted #28a745;
}

.log-entry .proposal-link:hover {
    color: #1e7e34;
    text-decoration: none;
    border-bottom: 1px solid #1e7e34;
}

.log-entry .parcel-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted #dc3545;
}

.log-entry .parcel-link:hover {
    color: #c82333;
    text-decoration: none;
    border-bottom: 1px solid #c82333;
}

.game-log-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
}

/* Proposal Info Modal */
.proposal-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2001;
}

.proposal-info-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.proposal-info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0 24px;
    border-bottom: 1px solid #dee2e6;
}

.proposal-info-modal-header h2 {
    margin: 0;
    color: #333;
}

.proposal-info-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.proposal-info-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.proposal-info-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

.proposal-details .metric-group {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 0;
}

.proposal-details .metric-label {
    font-weight: 500;
    color: #555;
    min-width: 140px;
}

.proposal-details .metric-value {
    color: #333;
    flex: 1;
    text-align: right;
}

.proposal-parcels {
    margin-top: 20px;
}

.proposal-parcels h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 16px;
}

.proposal-parcels-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
}

.proposal-parcel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f1f1;
}

.proposal-parcel-item:last-child {
    border-bottom: none;
}

.proposal-parcel-item.accepted {
    background-color: #f8fff8;
}

.proposal-parcel-item.pending {
    background-color: #fffbf0;
}

.proposal-parcel-item .parcel-number {
    font-weight: 500;
}

.proposal-parcel-item .parcel-details {
    font-size: 13px;
    color: #666;
}

.status-accepted {
    color: #28a745;
    font-weight: 500;
    margin-left: 8px;
}

.status-pending {
    color: #ffc107;
    font-weight: 500;
    margin-left: 8px;
}

.proposal-info-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
}

/* Author with avatar styling */
.author-with-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.author-avatar {
    flex-shrink: 0;
    border: 2px solid #007bff !important;
    object-fit: cover;
}

/* Agents Statistics Modal */
.agents-stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.agents-stats-modal-content {
    background: white;
    border-radius: 8px;
    width: 95%;
    max-width: 1000px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.agents-stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0 24px;
    border-bottom: 1px solid #dee2e6;
}

.agents-stats-modal-header h2 {
    margin: 0;
    color: #333;
}

.agents-stats-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agents-stats-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.agents-stats-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.agents-stats-table-container {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1; /* Take up remaining space in the modal body */
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.agents-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.agents-stats-table th {
    background-color: #f8f9fa;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
}

.agents-stats-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.agents-stats-table tr:hover {
    background-color: #f8f9fa;
}

.agent-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.agent-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.agents-stats-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
}

/* Agent Dialog Modal */
.agent-dialog-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.agent-dialog-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.agent-dialog-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #dee2e6;
}

.agent-header-info {
    display: flex;
    align-items: center;
}

.agent-details h2 {
    margin: 0 0 4px 0;
    color: #333;
}

.agent-id {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

.agent-dialog-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-dialog-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.agent-dialog-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

.agent-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 6px;
}

.parcels-list, .proposals-list {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.parcel-item, .proposal-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #dee2e6;
}

.parcel-item:last-child, .proposal-item:last-child {
    margin-bottom: 0;
}

.parcel-item:hover, .proposal-item:hover {
    background: #e9ecef;
    border-color: #007bff;
}

/* Simplified parcel styling - no colored borders or backgrounds */
.parcel-proposal-count {
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

/* Proposal items can have colored left borders when proposal color is available */
.proposal-item.has-color {
    border-left: 3px solid var(--proposal-color, #007bff);
}

.proposal-item.has-color:hover {
    border-left-color: var(--proposal-color, #007bff);
}

/* Unseen proposal styling */
.proposal-item.unseen-proposal {
    background-color: #f0f8ff;
    border-left: 3px solid #007bff;
    font-weight: 600;
}

.proposal-item.unseen-proposal:hover {
    background-color: #e6f3ff;
}

.unseen-indicator {
    color: #007bff;
    font-weight: bold;
    margin-right: 6px;
    font-size: 12px;
}

.wallet-list {
    max-height: 80px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.wallet-address {
    padding: 6px 12px;
    font-family: monospace;
    font-size: 12px;
    border-bottom: 1px solid #dee2e6;
}

.wallet-address:last-child {
    border-bottom: none;
}

.empty-list {
    padding: 12px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.more-items {
    padding: 6px 12px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 13px;
}



/* Parcel owner display in parcel info panel */
.parcel-owner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

/* Removed hover animation for parcel owner */

.owner-name {
    color: #007bff;
    font-weight: 500;
}

/* Ephemeral Messages */
#ephemeral-message-container {
    position: absolute; /* Relative to map-container */
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001; /* Above map controls, below modals */
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none; /* Allow clicks to pass through the container itself */
}

.ephemeral-message {
    background: rgba(29, 113, 184, 0.95); /* Bluish background */
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 20px; /* Pill shape */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, padding 0.4s ease, margin 0.4s ease;
    pointer-events: all; /* Re-enable pointer events for the message itself */
    white-space: nowrap;
}

.ephemeral-message.visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 50px; /* Should be enough for one line of text */
    margin: 0 0 10px 0; /* Creates space between stacked messages */
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Parcel Info Panel Layout */
.parcel-info-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.parcel-info-body {
    flex: 1;
    overflow-y: auto;
    padding-top: 10px;
}

.button-row-3 {
    justify-content: center;
}

.button-row-3 .parcel-info-btn {
    width: 100% !important;
    flex: 1;
}

/* Agent Log Section in Agent Details */
.agent-log-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.agent-log-content {
    max-height: 100%;
}

.agent-log-entry {
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
    line-height: 1.4;
    color: #495057;
}

.agent-log-entry:last-child {
    border-bottom: none;
}

.agent-log-entry:hover {
    background-color: #e9ecef;
}

.empty-log {
    padding: 16px 12px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 13px;
}

.agent-log-more {
    padding: 8px 12px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 12px;
    border-top: 1px solid #dee2e6;
    background-color: #f1f3f4;
}

/* Ensure agent log links work the same as game log links */
.agent-log-entry .agent-link-clickable {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

.agent-log-entry .agent-link-clickable:hover {
    color: #0056b3;
    text-decoration: underline;
}

.agent-log-entry .proposal-link-clickable {
    color: #28a745;
    text-decoration: none;
    cursor: pointer;
}

.agent-log-entry .proposal-link-clickable:hover {
    color: #1e7e34;
    text-decoration: underline;
}

.agent-log-entry .parcel-link-clickable {
    color: #dc3545;
    text-decoration: none;
    cursor: pointer;
}

.agent-log-entry .parcel-link-clickable:hover {
    color: #c82333;
    text-decoration: underline;
}

/* Avatar selection styles */
.avatar-selection {
    margin-bottom: 15px;
}

.selected-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: #f8f9fa;
    transition: all 0.3s;
}

.selected-avatar:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.selected-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-selection-hint {
    font-size: 13px;
    color: #666;
}

.avatar-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.avatar-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.avatar-option:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.avatar-option.selected {
    border-color: #007bff;
    background: #e3f2fd;
}

.avatar-option img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-option.used {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.avatar-option.used::after {
    content: "In Use";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 2px;
    pointer-events: none;
}

.avatar-option.used:hover {
    border-color: #ccc;
    background: #f5f5f5;
}

/* Takeover section styles */
.takeover-section {
    margin: 15px 0;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
}

.takeover-section p {
    margin-bottom: 12px;
    color: #856404;
}

.takeover-buttons {
    display: flex;
    gap: 10px;
}

.takeover-buttons .btn {
    flex: 1;
}

/* Logout modal styles */
.logout-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.logout-options .btn {
    width: 100%;
    text-align: center;
}

/* Username display with avatar */
.username-display {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s;
    max-width: 200px;
}

.username-display:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.username-display .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
}

.username-display i.fas {
    color: #666;
    font-size: 16px;
}

.username-display span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification badge for username display */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Agent dialog user-specific styles */
.agent-header-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.user-label {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.logout-button {
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-button:hover {
    background: #c82333 !important;
    transform: translateY(-1px);
}

/* Agent list item user indicator */
.agent-stats-table .user-agent-row {
    background: #f8f9ff;
    border-left: 3px solid #007bff;
}

.agent-stats-table .user-agent-indicator {
    color: #007bff;
    font-weight: 600;
    font-size: 11px;
}

/* Game log user action styling */
.log-entry.user-action {
    background: #f8f9ff;
    border-left: 3px solid #007bff;
    padding-left: 12px;
}

/* Proposal list in parcel info panel */
.parcel-proposals-list {
    height: 100%;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
}

.parcel-proposals-list .proposal-item {
    cursor: pointer;
    padding: 8px;
    margin: 4px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.parcel-proposals-list .proposal-item:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.parcel-proposals-list .proposal-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.parcel-proposals-list .proposal-item-title {
    color: #007bff;
    font-weight: bold;
    font-size: 14px;
}

.parcel-proposals-list .proposal-item-status {
    font-size: 12px;
    font-weight: bold;
}

.parcel-proposals-list .proposal-item-status.executed {
    color: #28a745;
}

.parcel-proposals-list .proposal-item-status.rejected {
    color: #dc3545;
}

.parcel-proposals-list .proposal-item-status.active {
    color: #007bff;
}

.parcel-proposals-list .proposal-item-details {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.parcel-proposals-list .proposal-item-actions {
    margin-top: 8px;
    text-align: right;
}

.parcel-proposals-list .btn-sm {
    font-size: 11px;
    padding: 2px 6px;
    margin-right: 4px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.parcel-proposals-list .btn-sm:last-child {
    margin-right: 0;
}

.parcel-proposals-list .btn-sm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.parcel-proposals-list .btn-success {
    background-color: #28a745;
    color: white;
}

.parcel-proposals-list .btn-success:hover:not(:disabled) {
    background-color: #218838;
}

.parcel-proposals-list .btn-danger {
    background-color: #dc3545;
    color: white;
}

.parcel-proposals-list .btn-danger:hover:not(:disabled) {
    background-color: #c82333;
}

.parcel-proposals-list .btn-info {
    background-color: #17a2b8;
    color: white;
}

.parcel-proposals-list .btn-info:hover {
    background-color: #138496;
}

/* Proposal details parcel list styling */
.proposal-parcel-item:hover {
    background-color: #f0f8ff !important;
    border-color: #007bff !important;
}

/* Proposal Details Panel */
#proposal-details-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.85); /* semi-transparent to reveal map underneath */
    backdrop-filter: blur(3px); /* subtle blur for readability */
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    display: none;
}

#proposal-details-panel.visible {
    display: flex;
    flex-direction: column;
}

/* Proposal details panel now uses .panel-header and .panel-body structure */

/* -------------------- Mobile layout tweaks -------------------- */
@media (max-width: 768px) {
    /* Stack layout vertically so map fills screen and sidebar overlays */
    body {
        flex-direction: column;
    }

    /* Off-canvas sidebar */
    #sidebar {
        width: 250px;
        min-width: 250px;
        max-width: 250px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-250px); /* hidden by default, moved off-screen */
        transition: transform 0.3s ease;
    }

    /* When sidebar is expanded (not collapsed) */
    #sidebar:not(.collapsed) {
        transform: translateX(0);
}

    /* Adjust collapsed state translation to match new width */
    #sidebar.collapsed {
        transform: translateX(-250px);
    }

    /* Toggle button always in view */
    #toggle-sidebar {
        left: 10px !important;
        top: 10px;
    }

    /* Move toggle button when sidebar is open to avoid overlap */
    #sidebar:not(.collapsed) ~ #map-container #toggle-sidebar {
        left: 260px !important; /* sidebar width + margin */
    }
}

/* -------------------- Typography scale -------------------- */
html {
    font-size: 16px; /* consistent rem baseline */
    line-height: 1.5;
    -webkit-text-size-adjust: 100%; /* prevent iOS text boost */
}

h1 {
    font-size: clamp(1.4rem, 5vw, 2rem);
}

h2 {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
}

h3 {
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
}

/* Responsive width for info panels */
#proposal-details-panel,
#parcel-info-panel,
#block-info-panel,
#road-info-panel,
#road-analysis-panel {
    width: min(90vw, 350px);
}

/* Enhance close button tap target */
.close-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Mobile panel as bottom sheet */
@media (max-width: 768px) {
    .info-panel {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0;
        width: 100% !important; /* Use 100% instead of 100vw to avoid overflow */
        max-width: 100% !important;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
        box-sizing: border-box; /* Include padding in width calculation */
    }

    .info-panel .close-button {
        top: 12px;
        right: 12px;
    }
}

/* Panel header and body structure */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px 8px 0 0;
    flex-shrink: 0; /* prevent header from shrinking */
}

.panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Mobile panel padding adjustments */
@media (max-width: 768px) {
    .panel-header {
        padding: 12px 15px; /* Reduce padding on mobile */
    }
    
    .panel-body {
        padding: 15px; /* Equal left/right padding, less than desktop */
    }
    
    /* Parcel tabs also need consistent padding */
    .parcel-tabs {
        padding: 0 15px; /* Match panel body padding */
        margin: 0;
        background: rgba(248, 249, 250, 0.5);
        flex-shrink: 0;
    }
}

/* Update info-panel to use flexbox layout when visible */
.info-panel {
    display: none; /* keep original hidden state */
}

.info-panel.visible {
    display: flex;
    flex-direction: column;
}

/* -------------------- Touch interactions -------------------- */
/* Disable text selection and callouts on interactive elements */
.btn, .close-button, .parcel-tab-btn, .tab-btn, .accordion-header, 
.block-item, .parcel-item, .proposal-item, .agent-link, .proposal-link {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Larger tap targets for mobile */
@media (max-width: 768px) {
    /* Buttons get minimum 44px height */
    .btn, .parcel-info-btn, .parcel-tab-btn, .tab-btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Accordion headers more touch-friendly */
    .accordion-header {
        min-height: 48px;
        padding: 12px 15px;
    }
    
    /* List items easier to tap */
    .parcel-item, .proposal-item, .block-item {
        min-height: 48px;
        padding: 12px 15px;
    }
    
    /* Form inputs larger */
    .form-group input, .form-group select {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Checkbox/radio larger touch areas */
    .checkbox-group label, .road-checkbox label {
        min-height: 44px;
        padding: 12px 8px;
        display: flex;
        align-items: center;
    }
    
    /* Slider controls more touch-friendly */
    #turn-interval-slider {
        height: 8px;
        -webkit-appearance: none;
    }
    
    #turn-interval-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
        -webkit-appearance: none;
    }
    
    /* Tab buttons in panels */
    .parcel-tab-btn, .proposal-tab-btn {
        padding: 14px 12px;
        font-size: 15px;
    }
    
    /* Sidebar content mobile optimizations */
    .sidebar-header {
        padding: 8px 12px; /* Reduce padding for more space */
    }
    
    .sidebar-header h2 {
        font-size: 0; /* Hide original text */
        line-height: 1.3;
        position: relative;
        max-width: 140px; /* Limit width to allow space for avatars */
    }
    
    /* Show truncated title using pseudo-element */
    .sidebar-header h2::after {
        content: "Consensus...";
        font-size: 1.0rem; /* Restore font size for pseudo-element */
        display: inline;
        vertical-align: middle;
    }
    
    /* Reduce logo size and margin */
    .sidebar-header h2 img {
        height: 24px !important; /* Smaller logo */
        margin-right: 6px !important; /* Less spacing */
    }
    
    /* Reduce spacing between header elements */
    .header-avatars {
        margin-left: 4px; /* Reduce margin */
    }
    
    /* Make avatars slightly smaller */
    .header-avatar {
        width: 20px;
        height: 20px;
        margin-left: -12px; /* Less overlap */
    }
    
    /* Button groups stack vertically with better spacing */
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Force equal width buttons in groups */
    .btn-group .btn {
        width: 100%;
    }
    
    .btn-grid-2x2 {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Control groups more compact */
    .control-group {
        padding: 12px 0;
    }
    
    .control-group-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    /* Metric groups more readable */
    .metric-group {
        padding: 8px 0;
    }
    
    .metric-label {
        font-size: 0.85rem;
    }
    
    .metric-value {
        font-size: 0.9rem;
        font-weight: 600;
    }
}

/* Touch feedback for interactive elements */
.btn:active, .close-button:active, .parcel-tab-btn:active, 
.tab-btn:active, .accordion-header:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Prevent double-tap zoom on buttons */
.btn, .close-button, .parcel-tab-btn, .tab-btn {
    touch-action: manipulation;
}

/* -------------------- Mobile modal improvements -------------------- */
@media (max-width: 768px) {
    /* Full-screen modals on mobile */
    .proposal-modal, .proposal-list-modal, .game-log-modal, 
    .agents-stats-modal, .agent-dialog-modal, .proposal-info-modal {
        padding: 0;
    }
    
    .proposal-modal-content, .proposal-list-modal-content, 
    .game-log-modal-content, .agents-stats-modal-content, 
    .agent-dialog-modal-content, .proposal-info-modal-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw;
        height: 100vh; /* Fallback for browsers without dvh support */
        height: 100dvh; /* Use dynamic viewport height that excludes browser UI */
        max-width: 100vw;
        max-height: 100vh; /* Fallback for browsers without dvh support */
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        /* Use safe area insets for proper positioning */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Modal bodies should scroll */
    .proposal-modal-body, .proposal-list-modal-body, 
    .game-log-modal-body, .agents-stats-modal-body, 
    .agent-dialog-modal-body, .proposal-info-modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
    }
    
    /* Modal headers fixed */
    .proposal-modal-header, .proposal-list-modal-header, 
    .game-log-modal-header, .agents-stats-modal-header, 
    .agent-dialog-modal-header, .proposal-info-modal-header {
        flex-shrink: 0;
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
        /* Adjust for safe area padding - reduce top padding since container handles it */
        padding-top: 10px;
    }
    
    /* Remove specific modal adjustments - now handled by safe area insets above */
    
    .agent-dialog-modal-header {
        padding: 10px 15px 15px 15px; /* Consistent with other modal headers */
    }
    
    .agent-dialog-modal-header .agent-header-info {
        flex: 1;
        min-width: 0; /* Allow text to wrap */
    }
    
    .agent-dialog-modal-header .agent-avatar-large {
        width: 50px !important;
        height: 50px !important;
        margin-right: 12px !important;
    }
    
    .agent-dialog-modal-header h2 {
        font-size: 1.3rem;
        line-height: 1.3;
        margin: 0 0 4px 0;
    }
    
    .agent-dialog-modal-close {
        min-width: 44px;
        min-height: 44px;
        font-size: 20px;
    }
    
    /* Modal footers fixed */
    .proposal-modal-footer, .game-log-modal-footer, 
    .agents-stats-modal-footer, .proposal-info-modal-footer {
        flex-shrink: 0;
        padding: 15px 20px;
        border-top: 1px solid #eee;
    }
    
        /* Username display mobile positioning */
    .username-display {
        top: 60px; /* Move below toggle button to avoid overlap */
    }
    
    /* When sidebar is collapsed, move username bubble back to top */
    #sidebar.collapsed ~ #map-container .username-display {
        top: 10px;
    }
    
    /* Map controls mobile positioning */
    .leaflet-top.leaflet-left {
        top: 60px !important; /* Below toggle button */
        left: 10px !important;
    }
    
    /* When sidebar is open, move map controls */
    #sidebar:not(.collapsed) ~ #map-container .leaflet-top.leaflet-left {
        left: 260px !important; /* sidebar width + margin */
    }
    
    /* Leaflet control buttons larger for touch */
    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 20px !important;
    }
    
    /* Attribution more compact */
    .leaflet-control-attribution {
        font-size: 10px !important;
        padding: 2px 5px !important;
    }
    
    /* Ephemeral messages mobile responsiveness */
    #ephemeral-message-container {
        left: 15px;
        right: 15px;
        transform: none;
        width: auto;
        max-width: calc(100vw - 30px);
    }
    
    .ephemeral-message {
        white-space: normal; /* Allow text wrapping */
        word-wrap: break-word;
        word-break: break-word;
        max-width: 100%;
        text-align: center;
        font-size: 13px;
        padding: 10px 14px; /* Reduce padding for tighter appearance */
        line-height: 1.3; /* Tighter line spacing */
        border-radius: 16px; /* Slightly less rounded for mobile */
    }
    
    .ephemeral-message.visible {
        max-height: 80px; /* Limit maximum height to prevent excessive thickness */
        min-height: auto; /* Remove minimum height override */
        padding-top: 10px; /* Override desktop transition padding */
        padding-bottom: 10px; /* Override desktop transition padding */
    }
}