/* Modern map styling */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
}

/* Figma Style Header */
.figma-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    pointer-events: auto;
}

.figma-menu-bar {
    background: var(--figma-menu-overlay);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    height: 124px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 52px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.figma-logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.figma-logo {
    height: 85px;
    width: 93px;
}

.figma-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.figma-logo-title {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: var(--figma-primary-blue);
}

.figma-nav-menu {
    display: flex;
    gap: 100px;
    align-items: center;
}

.figma-nav-link {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 24px;
    color: var(--figma-primary-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

.figma-nav-link:hover {
    color: var(--figma-accent-blue);
}

.figma-nav-link-active {
    color: var(--figma-accent-blue);
}

.floating_options {
    z-index: 1000;
    pointer-events: none;
    position: absolute;
    left: 0px;
    display: flex;
}

.floating_left {
    left: 0;
}

#map {
    width: 100vw;
    height: 100vh;
    transition: filter 0.5s ease;
}

[data-theme="dark"] .leaflet-tile {
    filter: brightness(0.8) contrast(1.2) saturate(0.8);
}

.over_map_container {
    z-index: 1000;
    position: fixed;
    display: flex;
    flex-direction: column;
}
.floating_options_close_button {
    position: absolute;
    right: 5px;
    top: 5px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -ms-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
}

.floating_options_close_button:hover {
    background-color: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.floating_options_close_button h4 {
    margin: 0;
    font-size: 12px;
    line-height: 1;
}
.floating_options_closed_icon {
    display: flex;
    align-items: center;
    gap: 20px;
    height: auto;
    width: auto;
    background: linear-gradient(135deg, var(--figma-menu-cyan-start), var(--figma-menu-cyan-end));
    border-radius: 0 40px 40px 0;
    padding: 20px 30px;
    box-shadow: 0 4px 15px var(--shadow);
    backdrop-filter: blur(10px);
    opacity: 1;
    z-index: 1001;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
    -webkit-border-radius: 0 40px 40px 0;
    -moz-border-radius: 0 40px 40px 0;
    -ms-border-radius: 0 40px 40px 0;
    -o-border-radius: 0 40px 40px 0;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
}

.floating_options_closed_icon *{
    z-index: 1001;
}

/* Icon styling */
.floating_options_closed_icon .menu-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

/* Hide title by default (icon-only mode) */
.floating_options_closed_icon .menu-title {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 24px;
    color: var(--figma-menu-text);
    white-space: nowrap;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.3s ease;
}

/* Show title on hover - smooth transition - ONLY when menu is closed */
.floating_options:hover:not(.menu-open) .floating_options_closed_icon .menu-title {
    max-width: 500px;
    opacity: 1;
    transition: max-width 0.3s ease 0.1s, opacity 0.3s ease 0.1s;
}

.floating_options_closed_icon h3 {
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect - enhance shadow - ONLY when menu is closed */
.floating_options.floating_left:hover:not(.menu-open) .floating_options_closed_icon {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating_options_closed_icon.hidden {
    opacity: 0;
    z-index: -1;
    transform: translateX(-100%);
    pointer-events: none;
    -webkit-transform: translateX(-100%);
    -moz-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    -o-transform: translateX(-100%);
}

.floating_options_content {
    opacity: 0;
    z-index: -1;
    transform: translateX(-100%);
    transition: opacity 0.5s ease, z-index 0s linear 0.5s, max-height 0s linear 0.5s;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.95), rgba(38, 198, 218, 0.95));
    border-radius: 20px;
    box-shadow: 0 4px 15px var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
    position: absolute;
    padding: 20px;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: opacity 0.5s ease, z-index 0s linear 0.5s, max-height 0s linear 0.5s;
    -moz-transition: opacity 0.5s ease, z-index 0s linear 0.5s, max-height 0s linear 0.5s;
    -ms-transition: opacity 0.5s ease, z-index 0s linear 0.5s, max-height 0s linear 0.5s;
    -o-transition: opacity 0.5s ease, z-index 0s linear 0.5s, max-height 0s linear 0.5s;
}

.floating_options_content h3,
.floating_options_content h4,
.floating_options_content p,
.floating_options_content div {
    color: var(--figma-menu-text);
}

.floating_options_content label {
    color: var(--figma-menu-text);
}

/* Numerical results styling */
.numerical-results-container,
.numerical-results-container div {
    color: var(--figma-menu-text) !important;
}

.floating_options_content * {
    pointer-events: none;
}

.floating_options_content.visible {
    opacity: 1;
    z-index: 1001;
    transform: translateX(0);
    pointer-events: auto;
    max-height: 700px;
    overflow-y: auto;
    position: relative;
    scrollbar-width: none; /* Firefox - hide scrollbar */
    -ms-overflow-style: none; /* IE and Edge - hide scrollbar */
    transition: opacity 0.5s ease, z-index 0s linear 0s, max-height 0s linear 0s;
    -webkit-transition: opacity 0.5s ease, z-index 0s linear 0s, max-height 0s linear 0s;
    -moz-transition: opacity 0.5s ease, z-index 0s linear 0s, max-height 0s linear 0s;
    -ms-transition: opacity 0.5s ease, z-index 0s linear 0s, max-height 0s linear 0s;
    -o-transition: opacity 0.5s ease, z-index 0s linear 0s, max-height 0s linear 0s;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.floating_options_content.visible::-webkit-scrollbar {
    display: none;
}

.floating_options_content.visible * {
    z-index: 1001;
    pointer-events: auto;
}

/* Disable all transitions during drag operations to prevent conflicts */
.floating_options_content.dragging,
.floating_options_content.dragging * {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
}

/* Ensure dragged elements stay on top */
.floating_options_content.ui-draggable-dragging {
    z-index: 9999 !important;
}

#controllers_container {
    top: 20px;
    left: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.results_floating {
    right: 0px;
    left: unset;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.results_floating .floating_options_closed_icon {
    border-radius: 40px 0 0 40px;
    flex-direction: row-reverse;
    -webkit-border-radius: 40px 0 0 40px;
    -moz-border-radius: 40px 0 0 40px;
    -ms-border-radius: 40px 0 0 40px;
    -o-border-radius: 40px 0 0 40px;
}

/* Hover effect for right-side menus - enhance shadow - ONLY when menu is closed */
.floating_options.results_floating:hover:not(.menu-open) .floating_options_closed_icon {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.results_floating .floating_options_closed_icon h3 {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0;
    text-align: center;
    overflow: visible;
}


/* Legend is now part of floating menu system */
.legend-menu .floating_options_content {
    max-width: 450px;
    padding: 15px;
    margin-right: 30px;
}

/* Legend should not be draggable when closed */
.legend-menu:not(.menu-open) {
    pointer-events: none;
}

.legend-menu:not(.menu-open) .floating_options_closed_icon {
    pointer-events: auto;
}

/* When legend is open, add right margin */
.legend-menu.menu-open {
    right: 30px !important;
}

#legend_max_controls_container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.legend-colors-container {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    margin: 10px 0;
}

.legend {
    padding: 15px;
    border: none;
    border-radius: 12px;
    margin: 0;
}

.legend h4 {
    margin-top: 0;
    color: var(--figma-menu-text);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.legend p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 15px;
    margin-bottom: 5px;
}

.legend-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 5px;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 5px;
    box-sizing: border-box;
    box-shadow: 0 2px 4px var(--shadow);
}

.legend-editable-color {
    border: 2px solid var(--accent-color);
    cursor: pointer;
}

.legend-label {
    font-size: 12px;
    text-align: center;
    color: white;
}

input.legend-label {
    width: 35px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    padding: 2px 4px;
    text-align: center;
}

input[type="color"] {
    border: none;
    background: none;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #controllers_container {
        top: 10px;
        left: 10px;
    }
    
    
    #legend_container {
        bottom: 20px;
        right: 20px;
        max-width: 300px;
    }
    
    .options_panel {
        max-width: 280px;
    }
}

/* Spinner styles */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-secondary);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Distance measurement tool styles */
.distance-tooltip {
    background-color: rgba(255, 255, 255, 0.95) ;
    border: 2px solid #ff0000 ;
    border-radius: 6px ;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) ;
    font-weight: bold ;
    font-size: 14px ;
    color: #ff0000 ;
    padding: 6px 10px ;
    text-align: center ;
}

.distance-tooltip:before {
    display: none ;
}

/* Distance measurement button hover effect */
.leaflet-control-custom:hover {
    background-color: #f0f0f0 ;
    transform: scale(1.05);
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -ms-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
}