/* Dashboard Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #000000;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(to right, #155724 0%, #1e7e34 50%, #28a745 100%);
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #ffd700;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.company-logo {
    height: 45px;
    width: auto;
}

.header-title h1 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.3px;
}

.header-title h2 {
    font-size: 11px;
    font-weight: 400;
    margin: 2px 0 0 0;
    opacity: 0.95;
    color: #fff8dc;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 450px;
}

.header-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-filter-group label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.header-filter-select {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-filter-select[multiple] {
    min-height: 32px;
    max-height: 32px;
    overflow-y: auto;
}

.header-filter-select:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-filter-select option {
    background-color: #28a745;
    color: white;
    padding: 4px 6px;
}

.header-filter-select option:checked {
    background-color: #1e7e34;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.projection-info {
    font-size: 10px;
    opacity: 0.9;
    font-style: italic;
}

.export-controls {
    display: flex;
    gap: 12px;
    align-self: flex-end;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.export-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Dashboard Content */
.dashboard-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 8px;
    padding: 8px;
    background-color: #000000;
}

/* Left Column - Metrics and Charts */
.dashboard-left-column {
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Top Metrics Cards */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.metric-card {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 80px;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.metric-card.metric-secondary {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.metric-card.metric-highlight {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.metric-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 0;
    position: relative;
}

.metric-icon svg {
    stroke: white;
    fill: none;
}

.metric-icon img {
    display: block;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.metric-content {
    flex: 1;
    text-align: left;
}

.metric-label {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
}

.metric-value-large {
    font-size: 20px;
    font-weight: 700;
}

/* Chart Panel */
.chart-panel {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.chart-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-bottom: 2px solid #1e7e34;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Block Info specific gradient - Blue */
.block-info-panel .chart-header {
    background: linear-gradient(to right, #0056b3 0%, #007bff 50%, #4da3ff 100%);
    border-bottom: 2px solid #0056b3;
}

/* Planting Info specific gradient - Green */
.planting-panel .chart-header {
    background: linear-gradient(to right, #1e7e34 0%, #28a745 50%, #5fce7d 100%);
    border-bottom: 2px solid #1e7e34;
}

/* Infrastructure Info specific gradient - Orange */
.infrastructure-panel .chart-header {
    background: linear-gradient(to right, #d55b0e 0%, #fd7e14 50%, #ff9f4d 100%);
    border-bottom: 2px solid #d55b0e;
}

.chart-content {
    padding: 15px;
    overflow-y: auto;
    position: relative;
}

/* Block Info Panel */
.block-info-panel {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.block-info-content {
    padding: 12px 15px;
}

.block-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.block-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.block-info-label {
    color: #6c757d;
    font-weight: 500;
}

.block-info-value {
    color: #28a745;
    font-weight: 600;
    font-size: 11px;
}

/* Planting Info Panel */
.planting-panel {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.planting-content {
    padding: 12px 15px;
}

.planting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.planting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    padding: 2px 0;
}

.planting-icon {
    flex-shrink: 0;
    width: 20px;
    height: 12px;
}

.planting-label {
    flex: 1;
    color: #495057;
}

.planting-value {
    font-weight: 600;
    color: #28a745;
}

/* Infrastructure Panel */
.infrastructure-panel {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.infrastructure-content {
    padding: 12px 15px;
}

.infrastructure-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.infrastructure-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.infrastructure-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    padding: 2px 0;
}

.infrastructure-icon {
    flex-shrink: 0;
    width: 20px;
    height: 3px;
}

.infrastructure-icon.circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #333;
}

.infrastructure-icon.rect {
    width: 12px;
    height: 12px;
    border: 1px solid #333;
}

.infrastructure-icon.pentagon {
    width: 12px;
    height: 12px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    position: relative;
}

.infrastructure-label {
    flex: 1;
    color: #495057;
}

.infrastructure-value {
    font-weight: 600;
    color: #28a745;
}

.chart-container-small {
    position: relative;
    height: 100%;
    min-height: 250px;
}

.chart-container-small canvas {
    max-height: 100%;
}

/* Map Container */
.dashboard-map-container {
    flex: 1;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.dashboard-map {
    height: 100%;
    width: 100%;
}

/* Hidden panel elements (for export only) */
.panel-title,
.info-detail-grid,
.info-detail-item,
.detail-label,
.detail-value {
    display: none;
}

/* Leaflet Control Adjustments */
.leaflet-control-zoom {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 34px !important;
    background: white !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
}

.leaflet-control-zoom a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    border-bottom: 1px solid #e8e8e8 !important;
    background-color: transparent !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s !important;
    color: #555 !important;
}

.leaflet-control-zoom-in {
    background-image: none !important;
    margin-bottom: 0 !important;
}

.leaflet-control-zoom-in::before {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.leaflet-control-zoom-out {
    background-image: none !important;
}

.leaflet-control-zoom-out::before {
    content: '−';
    font-size: 22px;
    font-weight: 300;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.leaflet-control-zoom a:hover {
    background-color: #f0f4ff !important;
    color: #1a56db !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

/* Fullscreen Control */
.leaflet-control-fullscreen {
    position: absolute !important;
    top: 88px !important; /* 10 + 68(zoom) + 10(gap) = 88px */
    right: 10px !important;
    left: auto !important;
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.leaflet-control-fullscreen a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    border: none !important;
    background-color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    color: #555 !important;
}

.leaflet-control-fullscreen a:hover {
    background-color: #f0f4ff !important;
    color: #1a56db !important;
}

.leaflet-control-fullscreen svg {
    color: inherit;
}

/* Fullscreen Mode Styles */
.dashboard-container.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background-color: #000000 !important;
}

.dashboard-container.fullscreen-mode .dashboard-header {
    display: none !important;
}

.dashboard-container.fullscreen-mode .dashboard-left-column {
    display: none !important;
}

.dashboard-container.fullscreen-mode .dashboard-main {
    width: 100% !important;
    height: 100% !important;
}

.dashboard-container.fullscreen-mode .dashboard-map-container {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
}

.dashboard-container.fullscreen-mode .dashboard-map {
    width: 100% !important;
    height: 100% !important;
}

/* Map Tools Group Card (3D + Split + Path) */
.map-tools-group {
    position: absolute;
    top: 176px; /* 88(fullscreen) + 34 + 10(gap) + 34(layer) + 10(gap) = 176px */
    right: 10px;
    width: 34px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1001;
}

/* When in 3D mode, shift group down to clear MapLibre controls */
.map-tools-group.in-3d-mode {
    top: 212px !important;
}

/* 3D Toggle Button */
.toggle-3d-button {
    width: 34px;
    height: 34px;
    background-color: transparent;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s;
    flex-shrink: 0;
    color: #555;
}

.toggle-3d-button:hover {
    background-color: #f0f4ff;
    color: #1a56db;
}

.toggle-3d-button svg {
    pointer-events: none;
}

/* Split View Toggle Button */
.toggle-split-view-button {
    width: 34px;
    height: 34px;
    background-color: transparent;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s;
    flex-shrink: 0;
    color: #555;
}

.toggle-split-view-button:hover {
    background-color: #f0f4ff;
    color: #1a56db;
}

.toggle-split-view-button.active {
    background-color: #1a56db;
    color: white;
}

.toggle-split-view-button.active svg {
    stroke: white;
}

.toggle-split-view-button svg {
    pointer-events: none;
}

/* Path Profile Toggle Button */
.toggle-path-profile-button {
    width: 34px;
    height: 34px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s;
    flex-shrink: 0;
    color: #555;
}

.toggle-path-profile-button:hover {
    background-color: #f0f4ff;
    color: #1a56db;
}

.toggle-path-profile-button.active {
    background-color: #1a56db;
    color: white;
}

.toggle-path-profile-button.active svg {
    stroke: white;
}

.toggle-path-profile-button svg {
    pointer-events: none;
}

/* Path Profile Panel */
.path-profile-panel {
    position: absolute;
    bottom: 20px;
    left: 10px;
    right: 10px;
    width: auto;
    height: auto;
    min-height: 280px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    overflow: visible;
}

.path-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.path-profile-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.close-profile-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 1;
    transition: color 0.2s;
}

.close-profile-btn:hover {
    color: #000;
}

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

.profile-measure-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: white;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.profile-measure-btn:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

.profile-measure-btn.active {
    background: #2563eb;
    border-color: #1d4ed8;
    color: white;
}

.profile-measure-btn.active svg {
    stroke: white;
}

.profile-measure-status {
    padding: 5px 16px;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    font-size: 11px;
    color: #1d4ed8;
    font-style: italic;
}

/* A / B markers shown on the map during profile measurement */
.profile-measure-map-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid white;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    pointer-events: none;
}

.path-profile-content {
    padding: 10px 16px 12px;
}

.path-profile-content canvas {
    width: 100% !important;
    height: 200px !important;
    margin-bottom: 12px;
}

.profile-info {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    color: #666;
}

.profile-info span {
    font-weight: 500;
}

/* Resize handles for all 4 sides */
.profile-resize-handle-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    cursor: ns-resize;
    z-index: 10;
}

.profile-resize-handle-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    cursor: ns-resize;
    z-index: 10;
}

.profile-resize-handle-left {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    z-index: 10;
}

.profile-resize-handle-right {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    z-index: 10;
}

.profile-resize-handle-corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #999 50%);
    border-bottom-right-radius: 8px;
    z-index: 11;
}

/* Split View Layout */
.dashboard-map-container.split-view {
    display: flex !important;
    gap: 0 !important;
    position: relative !important;
}

.dashboard-map-container.split-view .dashboard-map {
    flex: 0 0 50%;
    display: block !important;
    position: relative !important;
    overflow: hidden;
}

.dashboard-map-container.split-view .dashboard-map-3d {
    flex: 1 1 auto;
    display: block !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    overflow: hidden;
}

/* Resizable Divider */
.split-view-divider {
    width: 5px;
    background: #ddd;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
    z-index: 1000;
}

.split-view-divider:hover {
    background: #4CAF50;
}

.split-view-divider.dragging {
    background: #4CAF50;
}

/* 3D Map Container */
.dashboard-map-3d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Maplibre GL styles override */
.maplibregl-ctrl-top-right {
    top: 10px !important;
    right: 10px !important;
}

/* MapLibre NavigationControl — match 2D Leaflet zoom style */
.maplibregl-ctrl-group {
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    margin-bottom: 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: white !important;
}

.maplibregl-ctrl-group button {
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    color: #555 !important;
    border: none !important;
    transition: background-color 0.15s !important;
}

.maplibregl-ctrl-group button + button {
    border-top: 1px solid #e8e8e8 !important;
    margin-top: 0 !important;
}

.maplibregl-ctrl-group button:hover {
    background: #f0f4ff !important;
}

/* Tint compass arrow to match 2D neutral tone */
.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
    filter: grayscale(1) brightness(0.5) !important;
}

/* Fullscreen control — match 2D style */
.fullscreen-control-3d {
    margin-bottom: 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
}

.fullscreen-control-3d button {
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    color: #555 !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
}

.fullscreen-control-3d button:hover {
    background: #f0f4ff !important;
    color: #1a56db !important;
}

/* 3D Layer Control Container */
.layer-control-3d-container {
    margin-bottom: 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: flex-start !important;
    box-sizing: border-box !important;
    gap: 0 !important;
    width: 34px !important;
    height: 34px !important;
}

/* 3D Layer Control Toggle Button */
.layer-control-3d-toggle {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    background: white !important;
    color: #555 !important;
    cursor: pointer !important;
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    border-radius: 8px !important;
    transition: background 0.15s, color 0.15s;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    line-height: 0 !important;
    z-index: 2 !important;
}

.layer-control-3d-toggle:hover {
    background: #f0f4ff !important;
    color: #1a56db !important;
}

.layer-control-3d-toggle svg {
    width: 17px !important;
    height: 17px !important;
    display: block !important;
    pointer-events: none;
}

/* 3D Layer Control Panel */
.layer-control-3d-panel {
    position: absolute !important;
    top: 0 !important;
    right: 42px !important;
    max-width: 200px;
    overflow-y: auto;
    transition: max-width 0.3s ease, opacity 0.3s ease;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 1;
    z-index: 1 !important;
}

.layer-control-3d-panel.collapsed {
    max-width: 0;
    overflow: hidden;
    padding: 0 !important;
    opacity: 0;
}

.layer-control-3d-content {
    padding: 10px;
    min-width: 180px;
}

.layer-control-3d-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.layer-control-3d-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
    font-size: 11px;
    color: #333;
}

.layer-control-3d-item input[type="checkbox"],
.layer-control-3d-item input[type="radio"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.layer-control-3d-item label {
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.layer-control-3d-separator {
    height: 1px;
    background-color: #ddd;
    margin: 8px 0;
}

/* Layer Control */
.leaflet-control.layer-control-container,
.leaflet-control.layer-control-container.leaflet-bar {
    position: absolute !important;
    top: 132px !important; /* 88(fullscreen) + 34 + 10(gap) = 132px */
    right: 10px !important;
    left: auto !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: flex-start !important;
    gap: 0 !important;
    z-index: 1000 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    overflow: visible !important;
    border-radius: 8px !important;
    background: white !important;
}

/* Restore white box styling for layer control */
.layer-control-container .leaflet-bar {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.layer-control-container .leaflet-bar a {
    background: transparent !important;
    border-radius: 0 !important;
}

.leaflet-control.layer-control-container {
    position: absolute !important;
    top: 132px !important; /* 88(fullscreen) + 34 + 10(gap) = 132px */
    right: 10px !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    border-radius: 8px !important;
    overflow: visible !important;
    background: white !important;
}

.layer-control-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    background: white !important;
    cursor: pointer;
    text-decoration: none;
    color: #555;
    border: none !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    transition: background 0.15s, color 0.15s;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    box-sizing: border-box !important;
    line-height: 34px !important;
}

.layer-control-toggle:hover {
    background: #f0f4ff !important;
    color: #1a56db !important;
}

.layer-control-toggle svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.layer-control-panel {
    position: absolute !important;
    right: 38px !important;
    top: 0 !important;
    max-width: 200px;
    overflow-y: auto;
    transition: max-width 0.3s ease, opacity 0.3s ease;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 1;
    margin: 0 !important;
}

.layer-control-panel.collapsed {
    max-width: 0;
    overflow: hidden;
    padding: 0 !important;
    opacity: 0;
    display: none;
}

.layer-control-content {
    padding: 8px;
    min-width: 150px;
}

.layer-control-section {
    margin-bottom: 10px;
}

.layer-control-section:last-child {
    margin-bottom: 0;
}

.layer-control-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-control-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    user-select: none;
    border-radius: 3px;
    transition: background 0.2s;
}

.layer-control-item:hover {
    background: #f4f4f4;
}

.layer-control-item input[type="checkbox"],
.layer-control-item input[type="radio"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.layer-control-item span {
    flex: 1;
}

/* Coordinates Display */
.leaflet-control-coordinates {
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    font-size: 11px;
    font-family: monospace;
    color: #333;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.coordinates-display {
    white-space: nowrap;
}

/* Search and Measure Combined Container */
.search-measure-container {
    margin-top: 10px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

/* 3D Search and Measure Container */
.search-measure-container-3d {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.search-control {
    flex: 0 0 auto;
}

.measure-control-inline {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 4px;
}

.measure-button-wrapper {
    flex: 0 0 auto;
    margin-left: 0 !important;
}

/* Restore white box for measure button */
.measure-button-wrapper.leaflet-bar {
    background: white !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.22) !important;
    border: none !important;
    overflow: hidden !important;
}

.measure-button-wrapper.leaflet-bar a {
    background: white !important;
    border-radius: 8px !important;
    border: none !important;
}

.measure-toggle-inline {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px;
    height: 34px;
    background: white !important;
    cursor: pointer;
    text-decoration: none;
    color: #555;
    border: none !important;
    box-shadow: none !important;
    transition: background 0.15s, color 0.15s;
    padding: 0 !important;
}

.measure-toggle-inline:hover {
    background: #f0f4ff !important;
    color: #1a56db !important;
}

.measure-toggle-inline.active {
    background: #1a56db !important;
    color: white !important;
}

.measure-toggle-inline svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

/* Inline Measure Panel */
.measure-panel-inline {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 180px;
    transition: max-width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-width: 200px;
    opacity: 1;
    overflow: hidden;
}

.measure-panel-inline.collapsed {
    max-width: 0;
    padding: 0;
    opacity: 0;
    display: none;
}

.measure-control-wrapper {
    margin-top: 10px;
}

.search-container {
    position: relative;
    background: white;
    border-radius: 4px;
}

.search-input {
    width: 200px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}

.search-input:focus {
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 2px;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f4f4f4;
}

.search-no-results {
    padding: 8px 12px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* Measure Tool */
.measure-control-container {
    display: none !important; /* Hide original measure control, using inline version */
}

.measure-control-wrapper {
    display: block !important;
}

.measure-toggle {
    display: none !important; /* Hide original toggle button, use inline one instead */
}

.measure-panel {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 180px;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 300px;
    opacity: 1;
    overflow: hidden;
}

.measure-panel.collapsed {
    max-height: 0;
    padding: 0;
    opacity: 0;
    display: none;
}

.measure-modes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.measure-mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.measure-mode-btn:hover {
    background: #f4f4f4;
    border-color: #28a745;
}

.measure-mode-btn.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.measure-mode-btn.active svg {
    stroke: white;
}

.measure-mode-btn svg {
    flex-shrink: 0;
}

.measure-actions {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.measure-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

.measure-action-btn:hover {
    background: #f4f4f4;
    border-color: #007bff;
}

.measure-action-btn svg {
    width: 12px;
    height: 12px;
}

.measure-info {
    font-size: 11px;
    color: #666;
    text-align: center;
    padding: 4px;
    background: #f8f9fa;
    border-radius: 3px;
    font-weight: 500;
}

.measure-point-marker {
    background: transparent;
}

.measure-point-icon {
    width: 12px;
    height: 12px;
    background: #ff0000;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.measure-popup {
    font-size: 12px;
}

.measure-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border-radius: 4px;
    padding: 2px;
}

.measure-popup .leaflet-popup-content {
    margin: 6px 10px;
}

.measure-popup .leaflet-popup-tip {
    background: rgba(255, 0, 0, 0.9);
}

/* Road Labels */
.road-label-pin {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}
.road-label {
    position: absolute;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    color: #fff;
    font-size: 7px;
    font-weight: 700;
    padding: 1px 4px;
    line-height: 1.4;
    pointer-events: none;
    transform-origin: center center;
}

/* 3D Block Labels (HTML markers in MapLibre) */
.block-label-3d {
    background: transparent;
    border: none;
    font-weight: bold;
    font-size: 9px;
    color: #000;
    pointer-events: none;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px  1px 0 white,
        1px  1px 0 white,
        0    -1px 0 white,
        0     1px 0 white,
        -1px  0   0 white,
        1px   0   0 white;
}

/* Block Labels */
.block-label {
    background: transparent;
    border: none;
    font-weight: bold;
    font-size: 8px;
    color: black;
    text-shadow:
        -0.5px -0.5px 0 white,
        0.5px -0.5px 0 white,
        -0.5px 0.5px 0 white,
        0.5px 0.5px 0 white;
}

/* Leaflet Popup */
.leaflet-popup-content {
    font-size: 11px;
    min-width: 180px;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    color: #28a745;
    font-size: 12px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 4px;
}

.popup-info {
    margin: 4px 0;
    font-size: 10px;
}

/* Loader */
.loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 35px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    font-size: 13px;
    font-weight: 600;
    color: #28a745;
}

.loader.active {
    display: block;
}

.loader::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 12px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
.dashboard-left-column::-webkit-scrollbar,
.dashboard-info-panel::-webkit-scrollbar,
.chart-content::-webkit-scrollbar {
    width: 5px;
}

.dashboard-left-column::-webkit-scrollbar-track,
.dashboard-info-panel::-webkit-scrollbar-track,
.chart-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.dashboard-left-column::-webkit-scrollbar-thumb,
.dashboard-info-panel::-webkit-scrollbar-thumb,
.chart-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.dashboard-left-column::-webkit-scrollbar-thumb:hover,
.dashboard-info-panel::-webkit-scrollbar-thumb:hover,
.chart-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Hidden Legend Elements */
.legend-grid,
.info-item,
.legend-color,
.legend-circle,
.legend-line,
.legend-shape,
.value {
    display: none;
}

/* Responsive Design */

/* Large Desktop (1600px and above) - Default styles */

/* Medium Desktop (1200px - 1600px) */
@media (max-width: 1600px) {
    .dashboard-left-column {
        width: 320px;
    }

    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-filter-select {
        min-width: 120px;
    }
}

/* Small Desktop / Large Tablet Landscape (992px - 1200px) */
@media (max-width: 1200px) {
    .dashboard-left-column {
        width: 280px;
    }

    .header-title h1 {
        font-size: 13px;
    }

    .header-title h2 {
        font-size: 10px;
    }

    .header-filter-select {
        min-width: 100px;
        font-size: 10px;
    }

    .metric-value {
        font-size: 16px;
    }

    .metric-value-large {
        font-size: 18px;
    }
}

/* Tablet Landscape (768px - 992px) */
@media (max-width: 992px) {
    .dashboard-header {
        flex-wrap: wrap;
        padding: 10px 15px;
        gap: 10px;
    }

    .header-left {
        flex: 1 1 100%;
        justify-content: center;
    }

    .header-right {
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-filters {
        flex-wrap: wrap;
        justify-content: center;
    }

    .export-controls {
        justify-content: center;
    }

    .dashboard-main {
        flex-direction: column;
        gap: 8px;
    }

    .dashboard-left-column {
        width: 100%;
        max-height: none;
        flex-direction: column;
        overflow-y: auto;
        flex-shrink: 0;
    }

    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Keep panels fully visible on tablet - no scrolling needed */
    .block-info-panel,
    .planting-panel,
    .infrastructure-panel {
        display: flex;
        max-height: none;
        overflow: visible;
    }

    .dashboard-map-container {
        min-height: 400px;
    }
}

/* Tablet Portrait (600px - 768px) */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 8px 12px;
    }

    .company-logo {
        height: 35px;
    }

    .header-title h1 {
        font-size: 12px;
    }

    .header-title h2 {
        font-size: 9px;
    }

    .header-filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 100px;
    }

    .header-filter-select {
        min-width: 0;
        width: 100%;
        font-size: 10px;
        padding: 5px 8px;
    }

    .export-btn {
        flex: 1;
        justify-content: center;
        padding: 5px 10px;
        font-size: 9px;
    }

    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .metric-card {
        min-height: 70px;
        padding: 10px;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
    }

    .metric-icon img {
        width: 28px !important;
        height: 28px !important;
    }

    .metric-label {
        font-size: 8px;
    }

    .metric-value {
        font-size: 14px;
    }

    .metric-value-large {
        font-size: 16px;
    }

    .chart-title {
        font-size: 11px;
    }

    .block-info-item,
    .planting-item,
    .infrastructure-item {
        font-size: 9px;
    }

    /* Adjust map controls for tablet */
    .leaflet-control-zoom a,
    .toggle-3d-button,
    .toggle-split-view-button,
    .toggle-path-profile-button {
        width: 34px !important;
        height: 34px !important;
    }

    /* Split view adjustment */
    .dashboard-map-container.split-view {
        flex-direction: column !important;
    }

    .dashboard-map-container.split-view .dashboard-map,
    .dashboard-map-container.split-view .dashboard-map-3d {
        flex: 1 1 50%;
        min-height: 250px;
    }

    .split-view-divider {
        width: 100%;
        height: 5px;
        cursor: row-resize;
    }
}

/* Mobile Landscape / Large Phone (480px - 600px) */
@media (max-width: 600px) {
    .dashboard-header {
        padding: 6px 10px;
    }

    .company-logo {
        height: 30px;
    }

    .header-title h1 {
        font-size: 11px;
    }

    .header-title h2 {
        display: none; /* Hide subtitle on small screens */
    }

    .header-filter-group {
        flex: 1 1 100%;
    }

    .header-filter-group label {
        font-size: 8px;
    }

    .metrics-row {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .metric-card {
        min-height: 65px;
        padding: 8px;
        gap: 6px;
    }

    .metric-icon {
        width: 32px;
        height: 32px;
    }

    .metric-icon img {
        width: 24px !important;
        height: 24px !important;
    }

    .metric-label {
        font-size: 7px;
        margin-bottom: 2px;
    }

    .metric-value {
        font-size: 12px;
    }

    .metric-value-large {
        font-size: 14px;
    }

    .chart-header {
        padding: 8px 12px;
    }

    .chart-title {
        font-size: 10px;
    }

    .chart-content {
        padding: 10px;
    }

    .block-info-grid,
    .planting-grid,
    .infrastructure-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .block-info-item,
    .planting-item,
    .infrastructure-item {
        font-size: 8px;
    }

    /* Make panels scrollable on mobile - show all info but in scrollable container */
    .block-info-panel,
    .planting-panel,
    .infrastructure-panel {
        max-height: 180px;
    }

    /* Ensure content scrolls properly */
    .block-info-content,
    .planting-content,
    .infrastructure-content {
        max-height: 150px;
    }

    .dashboard-map-container {
        min-height: 350px;
    }

    /* Adjust controls for mobile */
    .leaflet-control-zoom {
        top: 5px !important;
        right: 5px !important;
    }

    .leaflet-control-fullscreen {
        top: 83px !important; /* 5 + 68 + 10 */
        right: 5px !important;
    }

    .leaflet-control.layer-control-container {
        top: 127px !important; /* 83 + 34 + 10 */
        right: 5px !important;
    }

    .map-tools-group {
        top: 171px !important; /* 127 + 34 + 10 */
        right: 5px !important;
    }

    .map-tools-group.in-3d-mode {
        top: 192px !important;
    }

    .search-measure-container {
        flex-direction: column;
        gap: 8px;
    }

    .search-input {
        width: 150px;
        font-size: 11px;
        padding: 6px 10px;
    }

    .path-profile-panel {
        bottom: 10px;
        min-height: 220px;
    }

    .path-profile-content canvas {
        height: 150px !important;
    }

    .profile-info {
        flex-direction: column;
        gap: 8px;
        font-size: 11px;
    }
}

/* Mobile Portrait (320px - 480px) */
@media (max-width: 480px) {
    .dashboard-header {
        padding: 5px 8px;
        gap: 8px;
    }

    .company-logo {
        height: 28px;
    }

    .header-title h1 {
        font-size: 10px;
        letter-spacing: 0.2px;
    }

    .header-filters {
        width: 100%;
    }

    .header-filter-group {
        flex: 1 1 100%;
    }

    .export-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .export-btn {
        font-size: 8px;
        padding: 4px 8px;
    }

    .export-btn svg {
        width: 12px;
        height: 12px;
    }

    .dashboard-main {
        padding: 5px;
        gap: 5px;
    }

    .metrics-row {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }

    .metric-card {
        min-height: 60px;
        padding: 6px;
        gap: 4px;
    }

    .metric-icon {
        width: 28px;
        height: 28px;
    }

    .metric-icon img {
        width: 20px !important;
        height: 20px !important;
    }

    .metric-label {
        font-size: 7px;
        margin-bottom: 1px;
    }

    .metric-value {
        font-size: 11px;
    }

    .metric-value-large {
        font-size: 13px;
    }

    .chart-header {
        padding: 6px 10px;
    }

    .chart-title {
        font-size: 9px;
    }

    .chart-content {
        padding: 8px;
    }

    .block-info-item {
        padding: 4px 6px;
        font-size: 7px;
    }

    .block-info-value {
        font-size: 8px;
    }

    .planting-item,
    .infrastructure-item {
        font-size: 7px;
        padding: 1px 0;
    }

    .planting-icon,
    .infrastructure-icon {
        width: 16px;
        height: 10px;
    }

    .dashboard-map-container {
        min-height: 300px;
        border-radius: 4px;
    }

    /* Simplify controls for very small screens */
    .leaflet-control-zoom a,
    .toggle-3d-button,
    .toggle-split-view-button,
    .toggle-path-profile-button,
    .layer-control-toggle {
        width: 30px !important;
        height: 30px !important;
    }

    .leaflet-control-zoom {
        width: 30px !important;
    }

    .map-tools-group {
        width: 30px !important;
    }

    .leaflet-control-zoom a::before {
        font-size: 18px;
    }

    /* Hide split view on very small screens */
    .toggle-split-view-button {
        display: none !important;
    }

    /* Optimize path profile for mobile */
    .path-profile-panel {
        bottom: 5px;
        left: 5px;
        right: 5px;
        min-height: 200px;
    }

    .path-profile-header h3 {
        font-size: 14px;
    }

    .path-profile-content {
        padding: 12px;
    }

    .path-profile-content canvas {
        height: 120px !important;
    }

    .profile-info {
        font-size: 10px;
    }

    /* Measure and search controls */
    .search-input {
        width: 100%;
        font-size: 10px;
    }

    .measure-panel-inline,
    .layer-control-panel {
        min-width: 140px;
        font-size: 10px;
    }

    .measure-mode-btn,
    .measure-action-btn {
        font-size: 9px;
        padding: 4px 6px;
    }

    /* Optimize popup for mobile */
    .leaflet-popup-content {
        min-width: 150px;
        font-size: 10px;
    }

    .leaflet-popup-content h4 {
        font-size: 11px;
    }

    .popup-info {
        font-size: 9px;
    }
}

/* Very Small Mobile (below 320px) */
@media (max-width: 320px) {
    .dashboard-header {
        padding: 4px 6px;
    }

    .company-logo {
        height: 24px;
    }

    .header-title h1 {
        font-size: 9px;
    }

    .metrics-row {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 55px;
        padding: 5px;
    }

    .export-btn {
        font-size: 7px;
        padding: 3px 6px;
    }

    .dashboard-map-container {
        min-height: 250px;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .dashboard-header {
        padding: 4px 8px;
    }

    .company-logo {
        height: 25px;
    }

    .header-title h1 {
        font-size: 10px;
    }

    .header-title h2 {
        display: none;
    }

    .dashboard-left-column {
        max-height: 120px;
        overflow-y: auto;
    }

    .metrics-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .metric-card {
        min-height: 50px;
        padding: 5px;
    }

    .block-info-panel,
    .planting-panel,
    .infrastructure-panel {
        max-height: 100px;
    }

    .dashboard-map-container {
        min-height: 200px;
    }

    .path-profile-panel {
        max-height: 60%;
    }
}

/* Print styles */
@media print {
    .dashboard-header {
        break-after: avoid;
    }

    .export-controls,
    .map-tools-group,
    .leaflet-control-zoom,
    .leaflet-control-fullscreen,
    .layer-control-container {
        display: none !important;
    }

    .dashboard-main {
        display: block;
    }

    .dashboard-left-column,
    .dashboard-map-container {
        width: 100%;
        page-break-inside: avoid;
    }

    .metric-card {
        page-break-inside: avoid;
    }
}

/* Elevation Legend Styles */
.elevation-legend {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 200px;
}

.elevation-legend .legend-title {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
    color: #333;
    text-align: center;
}

.elevation-legend .legend-gradient {
    height: 20px;
    background: linear-gradient(to right,
        rgb(0, 0, 128),        /* Dark blue (lowest) */
        rgb(0, 128, 255),      /* Blue */
        rgb(0, 204, 204),      /* Cyan */
        rgb(0, 255, 0),        /* Green */
        rgb(255, 255, 0),      /* Yellow */
        rgb(255, 128, 0),      /* Orange */
        rgb(128, 0, 0)         /* Dark red (highest) */
    );
    border-radius: 4px;
    margin-bottom: 6px;
    border: 1px solid #ccc;
}

.elevation-legend .legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
}

.elevation-legend .legend-label-min,
.elevation-legend .legend-label-max {
    white-space: nowrap;
}

/* ============================================================
   INFRASTRUCTURE MODE
   ============================================================ */

/* Estate/Infra panel content wrappers */
.panel-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Mode tab switcher */
.panel-mode-tabs {
    display: flex;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
}

.panel-tab {
    flex: 1;
    padding: 7px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

.panel-tab.active {
    background: white;
    color: #1a3a5c;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.panel-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.65);
    color: #444;
}

/* Infra filters panel */
.infra-filters-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 12px;
    flex-shrink: 0;
}

.infra-filter-row {
    display: flex;
    gap: 8px;
}

.infra-filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.infra-filter-group label {
    font-size: 10px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.infra-filter-select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 11px;
    color: #333;
    background: #fafafa;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.infra-filter-select:focus {
    border-color: #1a56db;
    background: white;
}

/* Infra stat card */
.infra-stat-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 12px;
    border-left: 4px solid #ccc;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-shrink: 0;
}

.infra-stat-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #1a3a5c;
    letter-spacing: 0.2px;
}

.infra-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 8px;
}

.infra-stat-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.infra-stat-label {
    font-size: 9px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.infra-stat-value {
    font-size: 13px;
    font-weight: 700;
    color: #1a3a5c;
}

/* Infra legend panel */
.infra-legend-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.infra-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.infra-legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11px;
    color: #333;
}

.infra-legend-line {
    width: 28px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Infra stats side-by-side row */
.infra-stats-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.infra-half {
    flex: 1;
    min-width: 0;
}

/* Infra bar chart */
/* Gap between MR and CR sections */
.infra-road-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.infra-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

/* Each bar group: label above, then flex row of [track | pct] */
.infra-bar-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.infra-bar-label {
    font-size: 9px;
    font-weight: 600;
    color: #777;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Row wrapping the track + optional percentage */
.infra-bar-row-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.infra-bar-track {
    flex: 1;
    height: 20px;
    background: #ebebeb;
    border-radius: 4px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.infra-bar-fill {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 2px;
    transition: width 0.35s ease;
    overflow: hidden;
}

.infra-bar-text {
    font-size: 9px;
    font-weight: 700;
    color: white;
    padding-right: 6px;
    white-space: nowrap;
}

/* Value shown to the right inside the track when bar is narrow */
.infra-bar-val-below {
    font-size: 8.5px;
    font-weight: 600;
    white-space: nowrap;
    padding-left: 5px;
}

/* Percentage shown after the bar track (activity rows only) */
.infra-bar-pct {
    font-size: 9px;
    font-weight: 700;
    color: #555;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Bridge summary card */
.infra-bridge-card {
    margin-top: 10px;
}

.infra-bridge-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}

.infra-bridge-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.infra-bridge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.25);
    flex-shrink: 0;
}

.infra-bridge-label {
    flex: 1;
    font-size: 10px;
    color: #444;
}

.infra-bridge-count {
    font-size: 12px;
    font-weight: 700;
    color: #1a3a5c;
    min-width: 24px;
    text-align: right;
}

.infra-bridge-total {
    font-size: 10px;
    font-weight: 400;
    color: #888;
}

/* Infra popup styles */
.infra-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 180px;
}

.infra-popup-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a3a5c;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.infra-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    padding: 2px 0;
    color: #444;
}

.infra-popup-row span:first-child {
    color: #888;
    font-weight: 600;
}
.infra-popup-row span:last-child {
    font-weight: 600;
    color: #1a3a5c;
    text-align: right;
}
