body {
    margin: 0;
    padding: 0;
    font-family: 'Work Sans', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 25px;
    background: linear-gradient(to bottom, #1facda, #4D80C3);
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 80px;
    margin-right: 10px;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    color: white;
    font-family: 'Work Sans', sans-serif;
    letter-spacing: 1px;
    margin: 0;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 5px;
    align-items: center;
}

.lang-btn {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: 'Work Sans', sans-serif;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.8);
}

.lang-btn.active {
    background: white;
    color: #0E69B5;
    border-color: white;
}

.search-bar {
    display: flex;
    position: relative;
}

.search-bar input {
    border: none;
    padding: 10px;
    font-size: 16px;
    width: 250px;
    transition: width 0.3s ease-in-out;
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    background-color: #fff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.search-bar button {
    border: none;
    background-color: #0E69B5;
    color: white;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 16px;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    transition: background-color 0.3s ease-in-out;
}

.search-bar button:hover {
    box-shadow: none;
    background-color: #4D80C3;
}

.search-bar button i {
    color: white;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-top: 5px;
    z-index: 1000;
    display: none;
}

.search-results-dropdown.visible {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

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

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

.search-result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.search-result-details {
    font-size: 13px;
    color: #666;
}

.search-loading {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-error {
    padding: 15px;
    text-align: center;
    color: #d9534f;
    background-color: #f8d7da;
    border-radius: 4px;
    margin: 5px;
}

.search-no-results {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.main-container {
    display: flex;
    flex: 1;
    background-color: #f4f4f4;
}

.sidebar {
    width: auto;
    background-color: #0E69B5;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

#toolbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;
    background-color: #0E69B5;
    flex: 1;
}

#toolbar button {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
    border: none;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    text-align: center;
    color: #B5D6F4;
    font-size: x-large;
}

#toolbar button:hover {
    background: #0E69B5;
    color: white;
}

#toolbar button.active {
    background-color: #4D80C3;
    color: white;
}

#toolbar #disclaimer-btn {
    margin-top: auto;
}

.floating-control {
    position: absolute;
    top: 100px;
    right: 20px;
    z-index: 1001;
    display: flex;
    gap: 5px;
}

.floating-control button {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background-color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    line-height: 0; /* remove extra space below image */
}

.floating-control button img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.floating-control button:hover {
    background-color: #f0f0f0;
}

.floating-control button.selected {
    border-color: #0E69B5;
}

#draw-toolbar {
    top: 170px;
    right: 20px;
    display: grid;
    grid-template-columns: repeat(2, 40px);
    grid-gap: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#draw-toolbar button {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 18px;
}

#draw-toolbar button.active {
    background-color: #0E69B5;
    color: white;
}

#draw-toolbar button.color-picker {
    padding: 2px;
    position: relative;
}

#measure-toolbar {
    top: 240px;
    right: 20px;
    display: grid;
    grid-template-columns: repeat(2, 40px);
    grid-gap: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#measure-toolbar button {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 18px;
}

#measure-toolbar button.active {
    background-color: #0E69B5;
    color: white;
}

#text-toolbar {
    top: 310px;
    right: 20px;
    display: grid;
    grid-template-columns: repeat(2, 40px);
    grid-gap: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#text-toolbar button {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 18px;
}

#text-toolbar button.active {
    background-color: #0E69B5;
    color: white;
}

#text-toolbar button.color-picker {
    padding: 2px;
    position: relative;
}

/* ===== LOCATE BY COORDINATES PANEL ===== */

#locate-toolbar {
    top: 170px;
    right: 20px;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    min-width: 200px;
    max-width: 240px;
}

.locate-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.locate-field label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.locate-field input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    color: #333;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    /* Hide spinner arrows */
    -moz-appearance: textfield;
    appearance: textfield;
}

.locate-field input[type="number"]::-webkit-inner-spin-button,
.locate-field input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.locate-field input[type="number"]:focus {
    border-color: #4D80C3;
}

.locate-marker-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    user-select: none;
}

.locate-marker-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #4D80C3;
}

.locate-actions {
    display: flex;
    gap: 6px;
}

.locate-btn-primary,
.locate-btn-secondary {
    flex: 1;
    padding: 11px 4px !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: none !important;
}

.locate-btn-primary {
    background-color: #4D80C3 !important;
    color: #ffffff !important;
}

.locate-btn-primary:hover {
    background-color: #3a6aa8 !important;
}

.locate-btn-secondary {
    background-color: #e9ecef !important;
    color: #495057 !important;
}

.locate-btn-secondary:hover {
    background-color: #d0d5db !important;
}

.locate-error {
    font-size: 12px;
    color: #d9534f;
    background-color: #f8d7da;
    border-radius: 4px;
    padding: 6px 8px;
    line-height: 1.4;
}

/* ===== END LOCATE BY COORDINATES PANEL ===== */

/* Disabled state for toolbar buttons */
#draw-toolbar button:disabled,
#measure-toolbar button:disabled,
#text-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #e0e0e0;
    color: #999;
}

/* Active mode indicator - blue left border on toolbar */
#draw-toolbar.mode-active,
#measure-toolbar.mode-active,
#text-toolbar.mode-active {
    border-left: 4px solid #0E69B5;
}

#text-font-size-popup {
    position: absolute;
    top: 390px;
    right: 20px;
    z-index: 1001;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 10px;
    min-width: 200px;
}

.font-size-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.font-size-label {
    font-size: 14px;
    color: #333;
    text-align: center;
}

.font-size-label strong {
    color: #0E69B5;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.font-size-control i {
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.font-size-control i:hover {
    color: #0E69B5;
}

#text-font-size {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 2px;
}

#text-font-size::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #0E69B5;
    cursor: pointer;
    border-radius: 50%;
}

#text-font-size::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0E69B5;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

#stroke-width-popup {
    position: absolute;
    top: 250px;
    right: 20px;
    z-index: 1001;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 10px;
    min-width: 200px;
}

.stroke-width-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stroke-width-label {
    font-size: 14px;
    color: #333;
    text-align: center;
}

.stroke-width-label strong {
    color: #0E69B5;
}

.stroke-width-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stroke-width-control i {
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.stroke-width-control i:hover {
    color: #0E69B5;
}

#stroke-width {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 2px;
}

#stroke-width::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #0E69B5;
    cursor: pointer;
    border-radius: 50%;
}

#stroke-width::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0E69B5;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.content-container {
    display: flex;
    flex: 1;
}

#layer-switcher {
    position: absolute;
    left: 70px; /* sidebar width + padding */
    width: 300px;
    height: calc(100% - 82px);
    background: white;
    z-index: 1000;
    display: none; /* Initially hidden */
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
}

#layer-switcher-header {
    background-color: #DDD8D8;
    border-bottom: 1px solid #ccc;
    padding: 5%;
}

#layer-filter {
    width: 100%;
    padding: 8px;
    margin: 0;
    border: none;
    border-radius: 5px;
    box-sizing: border-box;
}

#layer-list {
    overflow-y: auto;
    padding: 10px;
    background-color: #F0F0F0;
    flex-grow: 1;
}

.layer-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #818181;
}

.layer-header {
    display: flex;
    align-items: center;
    width: 100%;
}

.legend {
    margin-top: 10px;
}

.layer-item:hover {
    background-color: #f0f0f0;
}

.dragging {
    opacity: 0.5;
}

.layer-item i {
    margin-right: 10px;
}

.layer-icon img {
    margin-right: 10px;
    width: 20px;
    height: 20px;
}

.layer-icon svg {
    stroke: #818181;
    fill: #818181;
}

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

.layer-item input[type="checkbox"] {
    margin-left: 10px;
}

.move-layer-button {
    background: transparent;
    border: none;
    cursor: pointer;
}

.move-layer-button i {
    color: #818181;
}

#map {
    flex: 1;
    height: 100%;
}

.ol-popup {
    position: absolute;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    border-radius: 10px;
    bottom: 12px;
    left: -50px;
    min-width: 280px;
}

.ol-popup:after, .ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
}

.ol-popup:before {
    border-top-color: #cccccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
}

.ol-popup-closer {
    text-decoration: none;
    color: white;
    font-size: 20px;
}


#popup-content {
    padding: 15px;
}

#popup-content table {
    width: 100%;
    border-collapse: collapse;
}

#popup-content th, #popup-content td {
    padding: 5px;
    border: 1px solid #ddd;
    text-align: left;
}

#popup-content th {
    background-color: #f2f2f2;
}

#popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #0E69B5;
    color: white;
    padding: 5px 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    margin: 0px -1px 0px -1px;
    min-height: 30px;
}

#popup-title {
    font-weight: bold;
    flex-grow: 1;
}

.search-bar input::-webkit-input-placeholder {
    color: #ccc;
}

.search-bar input::-moz-placeholder {
    color: #ccc;
}

.search-bar input:-ms-input-placeholder {
    color: #ccc;
}

.search-bar input:-moz-placeholder {
    color: #ccc;
}

.ol-scale-bar {
    background: rgba(0, 60, 136, 0.0);
    border-radius: 4px;
    bottom: 40px;
    left: auto !important;
    padding: 2px;
    position: absolute;
    right: 25px !important;
}

.ol-custom-overviewmap,
.ol-custom-overviewmap.ol-uncollapsible {
    bottom: 90px !important;
    right: 25px !important;
    left: auto !important;
    top: auto !important;
}

.ol-custom-overviewmap .ol-overviewmap-map {
    width: 200px;
    height: 150px;
    border: 1px solid #0E69B5;
}

.ol-custom-overviewmap button {
    z-index: 1;
}

.ol-scale-line-inner {
    font-family: 'Work Sans', sans-serif;
}

.tooltip {
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    opacity: 0.9;
    white-space: nowrap;
    font-size: 12px;
}

.tooltip-measure {
    opacity: 1;
    font-weight: bold;
}

.tooltip-static {
    background-color: #0E69B5;
    color: white;
    border: 1px solid white;
}

.tooltip-measure:before,
.tooltip-static:before {
    border-top: 6px solid rgba(0, 0, 0, 0.7);
    border-right: 6px solid transparent;
    border-left: 6px solid transparent;
    content: "";
    position: absolute;
    bottom: -6px;
    margin-left: -7px;
    left: 50%;
}

.tooltip-static:before {
    border-top-color: #0E69B5;
}

/* Disclaimer Popup Styles */
.disclaimer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.disclaimer-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

#disclaimer-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #0E69B5;
    color: white;
    padding: 12px 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

#disclaimer-popup-title {
    font-weight: bold;
    font-size: 18px;
}

#disclaimer-popup-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
    line-height: 1.6;
    color: #333;
}

#disclaimer-popup-content p {
    margin: 0 0 15px 0;
}

/* Upload Layer Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.modal-backdrop.show {
    display: block;
}

.upload-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 400px;
    max-width: 90vw;
}

.upload-modal.show {
    display: block;
}

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

.upload-modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.upload-modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.upload-modal-header .close-btn:hover {
    color: #333;
}

.upload-modal-body {
    padding: 20px;
}

.supported-formats {
    margin-bottom: 20px;
    color: #666;
}

.supported-formats label {
    font-weight: 500;
    margin-right: 5px;
}

.file-upload-group {
    margin-bottom: 20px;
}

.btn-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-upload:hover {
    border-color: #4285F4;
    color: #4285F4;
}

.info-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #FFF8E1;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9rem;
}

/* User uploaded layer styling in layer list */
.layer-item.user-uploaded .layer-icon {
    color: #4285F4;
}

.layer-item.user-uploaded .layer-icon i {
    color: #4285F4;
}

.layer-item .delete-layer-btn {
    display: none;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.9rem;
    margin-right: 5px;
}

.layer-item.user-uploaded .delete-layer-btn {
    display: inline-block;
}

.layer-item .delete-layer-btn:hover {
    color: #a71d2a;
}