@import url('https://fonts.googleapis.com/css2?family=Wix+Madefor+Text:wght@400;500;600;700&display=swap');

:root {
    --ctrl-size: 44px;
    --ctrl-radius: 16px;
    --ctrl-bg: #fff;
    --ctrl-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
    --font-stack: 'Wix Madefor Text', system-ui, sans-serif;
    --ctrl-font: 16px/1.5 var(--font-stack);
    --font-color: #38353c;
    --dropdown-gap: 10px;
    --dropdown-font: 16px/1.25 var(--font-stack);

    /* Font Awesome duotone secondary opacity */
    --fa-secondary-opacity: 0.2;
}

html,
body { height: 100%; margin: 0; overflow: hidden; font-family: var(--font-stack);}

#gcm-map {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.leaflet-top.leaflet-right {
    top: 16px !important;
    right: 24px !important;
    display: flex;
    align-items: center;
    gap: 24px;
}

.leaflet-control-attribution {
    padding: 4px 8px;
    font-size: 14px;
    color: #1d1b20;
    border-radius: 8px;
}

.leaflet-control-attribution a {
    color: #1d1b20;
    text-decoration-line: underline;
}

.leaflet-control-attribution a:hover {
    color: #1d1b20;
    text-decoration-thickness: 0.13em;
}

.leaflet-bottom.leaflet-right,
.leaflet-bottom.leaflet-left { margin: 0 24px; }

.leaflet-right .leaflet-control,
.leaflet-left .leaflet-control { margin: 0; }

.leaflet-control-zoom {
    margin: 24px 0 !important;
}

.control-button,
.action-buttons-control.leaflet-bar a,
.layer-selector-control.leaflet-bar a.layer-toggle,
.leaflet-control-zoom a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ctrl-size);
    height: var(--ctrl-size);
    border-radius: var(--ctrl-radius);
    background: var(--ctrl-bg);
    cursor: pointer;
    fill: #38353c;
}

.action-buttons-control .control-button {
    border: 2px solid transparent !important;
}

.control-button:hover,
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background-color: #737373 !important;
    fill: #fff !important;
    span { color: #fff !important; }
}

.control-button:focus-visible,
.leaflet-control-zoom-in:focus-visible,
.leaflet-control-zoom-out:focus-visible {
    outline-color: #0369a1;
}

.action-buttons-control .control-button.open {
    border-color: #0369a1 !important;

    svg {
        fill: #0369a1;
    }
}

.action-buttons-control .control-button.open:hover {
    background-color: #737373 !important;

    svg {
        fill: #fff !important;
    }
    span { color: #fff !important; }
}

.action-buttons-control.leaflet-bar a,
.layer-selector-control.leaflet-bar a.layer-toggle { margin: 0 0 8px 0; }

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

.leaflet-control-zoom.leaflet-bar a {
    width: var(--ctrl-size) !important;
    height: var(--ctrl-size) !important;
    box-shadow: var(--ctrl-shadow);
}

.leaflet-control-zoom.leaflet-bar a:first-child {
    border-radius: var(--ctrl-radius) var(--ctrl-radius) 0 0 !important;
}

.leaflet-control-zoom.leaflet-bar a:last-child {
    border-radius: 0 0 var(--ctrl-radius) var(--ctrl-radius) !important;
}

.leaflet-touch .leaflet-control-zoom.leaflet-bar a,
.leaflet-control-zoom.leaflet-bar a { line-height: var(--ctrl-size); }

.leaflet-bar.action-buttons-control,
.leaflet-bar.layer-selector-control,
.leaflet-control-zoom.leaflet-bar {
    border: none;
    background: transparent;
    box-shadow: none;
}

.control-button,
.action-buttons-control.leaflet-bar a,
.layer-selector-control.leaflet-bar a.layer-toggle {
    border: none;
    box-shadow: var(--ctrl-shadow);
}

.control-button svg,
.layer-selector-control a.layer-toggle svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.layer-selector-control { position: relative; }

.layer-selector-control .dropdown-menu {
    position: absolute;
    top: 50%;
    right: calc(100% + var(--dropdown-gap));
    z-index: 2000;
    display: none;
    box-sizing: border-box;
    min-width: 9rem;
    max-width: 16rem;
    padding: 0.35rem 0;
    margin: 0;
    font: var(--dropdown-font);
    text-align: left;
    list-style: none;
    color: #212529;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.4rem;
    background-clip: padding-box;
    background-color: #fff;
    box-shadow: 0 0.4rem 0.8rem rgba(0, 0, 0, 0.12), 0 0.15rem 0.3rem rgba(0, 0, 0, 0.1);
    transform: translateY(-50%);
}

.layer-selector-control.open .dropdown-menu,
.layer-selector-control .dropdown-menu.show { display: block; }

.layer-selector-control .dropdown-menu a {
    display: block;
    clear: both;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    padding: 0.35rem 0.75rem;
    font-weight: 400;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    color: #212529;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.layer-selector-control .dropdown-menu a:hover,
.layer-selector-control .dropdown-menu a:focus {
    color: #16181b;
    background: #f2f4f6;
    outline: none;
}

.layer-selector-control .dropdown-menu a.active {
    font-weight: 600;
    text-decoration: none;
    color: #fff;
}

.layer-selector-control .dropdown-menu a.active:hover {
    background-color: #0064d1;
}

.action-buttons-control.leaflet-bar a:first-child {
    border-radius: var(--ctrl-radius) var(--ctrl-radius);
}

.action-buttons-control.leaflet-bar a:last-child {
    border-radius: var(--ctrl-radius) var(--ctrl-radius);
}

.action-buttons-control.leaflet-bar a:not(:first-child):not(:last-child) {
    border-radius: var(--ctrl-radius) var(--ctrl-radius);
}

#debug-info {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 5000;
    display: none;
    max-width: 360px;
    max-height: 45vh;
    padding: 8px 10px;
    margin: 0;
    overflow: auto;
    font: 12px/1.4 monospace;
    white-space: pre-wrap;
    color: #fff;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.gcm-side-panel {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 380px;
    height: 100%;
    padding: 8px 0;
    overflow: auto;
    border-right: 1px solid #e2e5e8;
    background: #fffffffa;
    box-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    transition: transform 0.3s ease-in-out;
}

.gcm-side-panel.collapsed {
    transform: translateX(-100%);
}

.gcm-side-panel header { margin: 0 0 12px 0; }

.gcm-side-panel .panel-content { flex: 1 1 auto; font: 14px/1.4 var(--font-stack); }

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.gcm-side-panel ~ #gcm-map {
    left: 380px;
    transition: left 0.3s ease-in-out;
}

.gcm-side-panel ~ #gcm-map.panel-collapsed {
    left: 0;
}

.panel-toggle-button {
    position: fixed;
    top: 16px;
    left: 380px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    padding: 13px 10px 13px 8px;
    font-weight: 500;
    text-align: center;
    color: #38353c;
    border: none;
    border-radius: 0 var(--ctrl-radius) var(--ctrl-radius) 0;
    background: var(--ctrl-bg);
    box-shadow: var(--ctrl-shadow);
    cursor: pointer;
    transition: left 0.3s ease-in-out, background-color 0.2s ease;
    gap: 4px;
}

.panel-toggle-button:hover {
    background-color: #f8f9fa;
}

.panel-toggle-button:active {
    background-color: #e9ecef;
}

.panel-toggle-button.panel-collapsed {
    left: 0;
}

.panel-toggle-button .panel-toggle-icon {
    display: block;
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    margin: 0 auto;
    fill: #38353c;
    transition: transform 0.3s ease;
}

.panel-toggle-icon.icon-expand { display: none; }
.panel-toggle-button.panel-collapsed .icon-collapse { display: none; }
.panel-toggle-button.panel-collapsed .icon-expand { display: block; }

.panel-toggle-button .toggle-text {
    font-size: 12px;
    line-height: 1.2;
}

.panel-tabs {
    display: flex;
    padding: 0;
    border-bottom: 1px solid #e3e5e5;
}

.panel-tab {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 10px 0 8px;
    font-weight: 500;
    text-align: center;
    color: var(--font-color);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    gap: 2px;
}

.panel-tab:hover,
.panel-tab:focus {
    background: #f5f5f5;
}

.panel-tab.active {
    position: relative;
}

.panel-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 37px;
    height: 3px;
    border-radius: 4px 4px 0 0;
    background-color: #222;
}

.panel-tab-icon {
    display: block;
    width: 25px;
    height: 25px;
    fill: var(--font-color);
}

.panel-tab-text {
    display: block;
    font-size: 14px;
    line-height: 20px;
}

.panel-pane {
    padding: 12px 16px;
}

.panel-pane.hidden {
    display: none;
}

@media (max-width: 1139px), (max-height: 599px) {
    body:not(.panel-js-inicialized) .gcm-side-panel { transform: translateX(-100%); }
    body:not(.panel-js-inicialized) #gcm-map { left: 0; }
    body:not(.panel-js-inicialized) .panel-toggle-button { left: 0; }
}

@media (orientation: portrait) {
    .gcm-side-panel {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 45vh;
        border-top: 1px solid #e2e5e8;
        border-right: none;
        transition: transform 0.3s ease-in-out;
    }

    .gcm-side-panel.collapsed {
        transform: translateY(100%);
    }

    .gcm-side-panel ~ #gcm-map {
        bottom: 45vh;
        left: 0;
        transition: bottom 0.3s ease-in-out;
    }

    .gcm-side-panel ~ #gcm-map.panel-collapsed {
        bottom: 0;
    }

    .panel-toggle-button {
        top: auto;
        bottom: 45vh;
        left: 50%;
        border-radius: var(--ctrl-radius) var(--ctrl-radius) 0 0;
        transform: translateX(-50%);
        transition: bottom 0.3s ease-in-out, background-color 0.2s ease;
    }

    .panel-toggle-button.panel-collapsed {
        bottom: 0;
        left: 50%;
    }

    .panel-toggle-button .panel-toggle-icon {
        transform: rotate(270deg);
        transform-origin: 50% 50%;
    }
}

@media (orientation: portrait) {
    body:not(.panel-js-inicialized) .gcm-side-panel { transform: translateY(100%); }
    body:not(.panel-js-inicialized) #gcm-map { bottom: 0; left: 0; }

    body:not(.panel-js-inicialized) .panel-toggle-button {
        top: auto;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 1139px), (max-height: 599px) {
    body:not(.panel-js-inicialized):not(.force-landscape) .gcm-side-panel { transform: translateX(-100%); }
}

/* Route Planner Styles */
.route-transport-options,
.route-waypoints,
.route-search,
.route-results {
    margin-bottom: 12px;
}

.route-results {
    border-top: 4px solid #e3e5e5;
}

.route-transport-options:first-child h3,
.route-waypoints:first-child h3,
.route-results:first-child h3 {
    padding-top: 0;
    border: none;
}

.route-transport-options h3,
.route-waypoints h3,
.route-results h3 {
    padding-top: 16px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--font-color);
}

.route-transport-options:first-child h3 {
    margin-top: 0;
}

.transport-buttons {
    display: flex;
    gap: 8px;
}

.transport-btn {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    font-weight: 500;
    font-size: 12px;
    color: var(--font-color);
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    background: white;
    outline: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 4px;
    outline-offset: 2px;
}

.transport-btn:hover {
    border-color: #bdbdbd;
    background: #f5f5f5;
}

.transport-btn:focus-visible {
    outline-color: #2196f3;
}

.transport-btn.active {
    color: #1976d2;
    border-color: #2196f3;
    background: #e3f2fd;
    fill: #1976d2;
}

.transport-icon {
    width: auto;
    height: 25px;
}

/* Waypoint inputs styling */
.waypoint-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.waypoint-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Waypoint items with remove button (intermediate waypoints) */
.waypoint-item[data-waypoint-index] {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.waypoint-item[data-waypoint-index] .waypoint-input-wrapper {
    flex: 1;
}

.waypoint-item:not(:first-child):not(:last-child) .route-autocomplete {
    width: calc(100% - 54px);
}

.waypoint-input-wrapper {
    position: relative;
}

.waypoint-floating-label {
    position: absolute;
    top: 50%;
    left: 57px;
    font-weight: 400;
    font-size: 16px;
    color: #737373;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
}

.waypoint-input:focus ~ .waypoint-floating-label,
.waypoint-input:not(:placeholder-shown) ~ .waypoint-floating-label {
    top: 6px;
    font-size: 14px;
    transform: translateY(0);
}

.waypoint-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: fit-content;
    height: 20px;
    border-radius: 12px;
}

.waypoint-icon {
    width: 20px;
    height: 20px;
    fill: #404040;
}

.waypoint-indicator.start .waypoint-icon {
    fill: #0369a1;
}

.waypoint-indicator.waypoint .waypoint-icon {
    fill: #404040;
}

.waypoint-indicator.end .waypoint-icon {
    fill: #be123c;
}

/* Waypoint remove button */
.waypoint-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
    border: none;
    border-radius: 22px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    fill: #38353c;
    outline-offset: 2px;
}

.waypoint-remove:hover {
    background: #737373;
    fill: #fff;
}

.waypoint-remove:focus-visible {
    outline-color: #0369a1;
}

.waypoint-remove .remove-icon {
    width: 20px;
    height: 20px;
}

.waypoint-input {
    box-sizing: border-box;
    width: 100%;
    height: 52px;
    padding: 25px 56px 7px 56px;
    font-size: 16px;
    font-family: var(--font-stack);
    color: #404040;
    border: 1px solid #737373;
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s ease;
}

/* Waypoint input states for autocomplete:
   - .has-autocomplete-value: Input has any text (user typing or selected)
   - .has-autocomplete-open: Autocomplete dropdown is currently open
   - .has-autocomplete-selected: Value was selected from autocomplete (text will be auto-selected on click)
*/
.waypoint-input.has-autocomplete-value {
    /* Ready for custom styling */
}

.waypoint-input.has-autocomplete-open {
    border-color: #0369a1; /* Highlight when autocomplete is open */
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    outline: none;
}

.waypoint-input.has-autocomplete-selected {
    /* Ready for custom styling */
}

.waypoint-input:focus {
    border-color: #0369a1;

    /* outline: 1px solid #0369A1; */
}

/* XXX
.waypoint-input::placeholder {
    font-style: italic;
    color: #9e9e9e;
} */

/* Disabled states for form elements during search */
.waypoint-input:disabled {
    opacity: 0.7;
    color: #9e9e9e;
    border-color: #e0e0e0;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.add-waypoint-btn:disabled,
.reverse-route-btn:disabled,
.reverse-order-btn:disabled,
.remove-waypoint:disabled,
.search-route-btn:disabled,
.transport-btn:disabled {
    opacity: 0.7;
    color: #9e9e9e;
    border-color: #e0e0e0;
    background-color: #f5f5f5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Disabled radio buttons */
input[type="radio"]:disabled + label {
    opacity: 0.7;
    color: #9e9e9e;
    cursor: not-allowed;
}

input[type="radio"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disabled toll toggle */
.toll-checkbox:disabled {
    cursor: not-allowed;
}

/* Route Autocomplete */
.route-autocomplete {
    position: absolute;
    top: 51px;
    z-index: 10;
    width: calc(100% - 2px);
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #0369a1;
    border-top: 1px solid #e3e5e5;
    border-radius: 0 0 8px 8px;
    background: #fff;
}

.route-autocomplete.hidden {
    display: none;
}

.route-autocomplete-help,
.route-autocomplete-loading,
.route-autocomplete-no-results {
    padding: 12px 16px;
    text-align: center;
    color: #666;
}

.route-autocomplete-help.hidden,
.route-autocomplete-loading.hidden,
.route-autocomplete-no-results.hidden {
    display: none;
}

.route-autocomplete-help p,
.route-autocomplete-loading p,
.route-autocomplete-no-results p {
    margin: 0;
    font-size: 14px;
}

.route-autocomplete-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.route-autocomplete-results {
    padding: 0;
    margin: 0;
    list-style: none;
}

.route-autocomplete-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    gap: 4px;
}

.route-autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.route-autocomplete-item:hover,
.route-autocomplete-item.focused {
    background-color: #f5f5f5;
}

.route-autocomplete-item:focus-visible {
    outline: 2px solid #0369a1;
    outline-offset: -3px;
}

.route-autocomplete-item-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.route-autocomplete-item-category {
    font-size: 12px;
    color: #666;
}

/* .route-autocomplete-item-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
}

.route-autocomplete-item-badge.gcm {
    background-color: #e3f2fd;
    color: #1976d2;
}

.route-autocomplete-item-badge.mapy {
    background-color: #fff3e0;
    color: #f57c00;
} */

.route-autocomplete-loading-more {
    padding: 8px 16px;
    font-size: 13px;
    text-align: center;
    color: #666;
}

.toll-checkbox:disabled + .toll-toggle-switch {
    opacity: 0.7;
    cursor: not-allowed;
}

.toll-toggle-label:has(.toll-checkbox:disabled) {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

/* .waypoint-clear {
    position: absolute;
    right: 2px;
    bottom: 2px;
    display: none;
    opacity: 0.7;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 14px;
    background: transparent;
    outline: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    fill: #9e9e9e;
}

.waypoint-clear.show {
    display: flex;
}

.waypoint-clear:hover {
    opacity: 1;
    background: #757575;
    fill: #fff;
}

.waypoint-clear:focus-visible {
    outline-color: #2196f3;
} */

/* Waypoint clear icon inside input */

/* .waypoint-clear .clear-icon {
    width: 24px;
    height: 24px;
} */

/* Waypoint actions */
.waypoint-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

/* Add waypoint button */
.waypoint-actions button {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    width: fit-content;
    height: 44px;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 16px;
    font-family: var(--font-stack);
    color: #404040;
    border: none;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 10px;
}

.waypoint-actions button:hover {
    color: #fff;
    background: #737373;
    fill: #fff;
}

.waypoint-actions button:focus-visible {
    outline-color: #0369a1;
}

.waypoint-actions button svg {
    width: 20px;
    height: 20px;
}

.reverse-order-btn.disabled,
.reverse-order-btn:disabled {
    opacity: 0.5;
    color: #bdbdbd;
    border-color: #e0e0e0;
    background: #f9f9f9;
    cursor: not-allowed;
    fill: #bdbdbd;
}

/* Search route button */
.search-route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    padding: 12px 20px;
    font-weight: 500;
    font-size: 16px;
    font-family: var(--font-stack);
    color: white;
    border: 1px solid #0369a1;
    border-radius: 99px;
    background: #0369a1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-route-btn:hover {
    color: #0369a1;

    /* box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3); */
    border-color: #0369a1;
    background: #fff;
}

.search-route-btn:focus-visible {
    color: #0369a1;
    border-color: transparent;
    outline-color: #0369a1;
    background: #fff;
}

.search-route-btn .search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Route info marker styles */
.route-info-marker {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.route-info-popup {
    position: relative;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    font-family: var(--font-stack);
    text-align: center;
    white-space: nowrap;
    color: white;
    border-radius: 6px;
    background: rgba(33, 150, 243, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.route-info-popup::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 0;
    border-top: 4px solid rgba(33, 150, 243, 0.95);
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    transform: translateX(-50%);
}

/* Route waypoint markers */
.route-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: transparent !important;
}

.route-marker svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.marker-start {
    background: #0369a1 !important;
}

.marker-end {
    background: #be123c !important;
}

.marker-waypoint {
    background: #404040 !important;
}

/* Route alternatives display */
.route-alternatives {
    display: block;
    margin: 12px 0;
}

.route-option {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    min-height: 73px;
    padding: 16px;
    color: #404040;
    border-bottom: 1px solid #e3e5e5;
    border-left: 4px solid transparent;
    background: white;
    outline: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    outline-offset: 2px;
}

.route-option:hover {
    background: #f5f5f5;
}

.route-option:focus-visible {
    outline-color: #2196f3;
}

.route-option.selected {
    border-bottom-color: #737373;
    border-left-color: #0369a1;
    border-left-color: #0369a1;
    background: #fafafa;
}

.route-option.selected .route-time {
    font-weight: 700;
    color: #0369a1;
}

.route-details {
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    font-size: 13px;
    line-height: 1.3;
}

.route-time {
    font-size: 16px;
}

.route-distance {
    font-weight: 400;
    font-size: 14px;
    color: #737373;
}

.route-label {
    display: flex;
    padding: 4px 8px;
    font-size: 14px;
    color: #0369a1;
    border: 1px solid #0369a1;
    border-radius: 8px;
    background: #e0f2fe;
    gap: 4px;
}

.route-label svg {
    width: 15px;
    height: 15px;
    fill: #0369a1;
}

.route-actions {
    text-align: center;
}

.clear-route-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    padding: 12px 20px;
    font-weight: 500;
    font-size: 16px;
    color: #0369a1;
    border: 1px solid transparent;
    border-radius: 16px;
    background: #fff;
    outline: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
    outline-offset: 2px;
    fill: #0369a1;
}

.clear-route-btn:hover {
    border-color: #0369a1;
    fill: #0369a1;
}

.clear-route-btn:focus-visible {
    outline-color: #2196f3;
}

.clear-route-btn svg {
    width: 20px;
    height: 20px;
}

/* Route tooltips */
.route-tooltip {
    opacity: 1 !important;
    min-width: 84px !important;
    padding: 4px 8px !important;
    font-weight: 400 !important;
    font-size: 14px !important;
    text-align: center !important;
    color: #737373 !important;
    border: none !important;
    border-radius: 4px !important;
    background: #fafafa !important;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px 0 rgba(0, 0, 0, 0.3) !important;
}

.route-tooltip-content {
    line-height: 1.3;
}

.route-tooltip-content strong {
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 16px;
    color: #0369a1;
}

/* Tooltip arrow pointing down (tooltip is above the line) */
.leaflet-tooltip-top::before {
    opacity: 1 !important;
    border-top-color: #fafafa !important;
}

.leaflet-tooltip-top {
    margin-top: -12px !important;
}

/* Toll options */
.route-toll-options {
    margin-bottom: 15px;
}

.toll-toggle-wrapper {
    display: flex;
    width: 100%;
}

.toll-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    font-size: 14px;
    color: #333;
    outline: none;
    cursor: pointer;
}

.toll-checkbox {
    display: none;
}

.toll-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #ccc;
    transition: background 0.2s ease;
}

.toll-toggle-label:focus-visible .toll-toggle-switch {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.toll-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.toll-checkbox:checked + .toll-toggle-switch {
    background: #007bff;
}

.toll-checkbox:checked + .toll-toggle-switch::after {
    transform: translateX(20px);
}

.toll-toggle-text {
    font-weight: 500;
}

/* Route error messages */
.route-error {
    padding: 20px;
    margin: 24px 0;
    border-radius: 8px;
    background: #f5f5f5;
}

.route-error-content {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #737373;
    gap: 16px;
}

.route-error-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: #b91c1c;
}

.route-error-message {
    flex: 1;
}

/* Route loading indicator */
.route-loading {
    padding: 30px 20px;
    text-align: center;
    color: #666;
}

.route-loading p {
    margin: 15px 0 0 0;
    font-size: 14px;
    color: #757575;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.loading-spinner svg {
    width: 32px;
    height: 32px;
    fill: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* POI Categories Styles */
.poi-categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poi-category-item {
    border: 1px solid #f5f5f5;
    border-radius: 12px;
    background: #f5f5f5;
    outline: 1px solid transparent;
    transition: all 0.2s ease;
}

.poi-category-item:hover {
    border: 1px solid #716f73;
    outline: 1px solid #716f73;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.poi-category-item.expanded {
    border: 1px solid #f5f5f5;
    outline: 1px solid transparent;
}

.poi-category-item.expanded:hover {
    border: 1px solid #716f73;
    outline: 1px solid #716f73;
}

.poi-category-item.checked {
    border: 1px solid var(--category-color);
}

.poi-category-item.checked .poi-category-label {
    border-color: var(--category-color);
}

.poi-category-item.checked:hover {
    outline: 1px solid var(--category-color);
}

.poi-category-item.expanded.checked:hover {
    border: 1px solid var(--category-color);
    outline: 1px solid var(--category-color);
}

.poi-category-item.checked .poi-category-toggle:hover {
    background: var(--category-color);
}

.poi-category-item.line-category-item .poi-category-icon {
    color: var(--category-line-color);
}

.poi-subcategory-item .poi-subcategory-icon {
    color: var(--line-color);
}

.poi-category-item.line-category-item:hover {
    border: 1px solid #716f73;
    outline: 1px solid #716f73;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.poi-category-item.line-category-item.checked {
    border: 1px solid var(--category-line-color) !important;
}

.poi-category-item.line-category-item.checked:hover {
    outline: 1px solid var(--category-line-color);
}

.poi-category-item.line-category-item.checked .poi-category-toggle:hover {
    background: var(--category-line-color);
}

.poi-category-item.line-category-item,
.poi-category-item.cadastre-category {
    background: #f7fafa;
}

.poi-category-header {
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 8px;
}

/* Custom checkbox styling */
.poi-category-checkbox {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1px solid #737373;
    border-radius: 2px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.poi-category-checkbox:hover {
    border-color: #757575;
}

.poi-category-checkbox:checked {
    border-color: #737373;
    background: #737373;
}

.poi-category-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 3px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.poi-category-checkbox:indeterminate {
    border-color: #737373;
    background: #737373;
}

.poi-category-checkbox:indeterminate::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 3px;
    width: 10px;
    height: 2px;
    background: white;
}

.poi-category-checkbox:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.poi-category-icon-bg {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
}

.line-category-item .poi-category-icon-bg {
    background: transparent;
}

.cadastre-category .poi-category-icon-bg {
    margin-left: 34px;
    background: transparent;
}

.poi-category-icon {
    font-size: 20px;
    color: var(--category-color);
}

/* Label for checkbox (just for accessibility, no visual content) */
.poi-category-label {
    cursor: pointer;
}

/* Category name - clickable to select all subcategories */
.poi-category-name {
    display: flex;
    flex: 1;
    align-items: center;
    height: 44px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
    border-right: 1px solid #8c8c8c;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.poi-category-text {
    padding-left: 8px;
    font-weight: 400;
    color: var(--category-color);
}

.poi-category-item.expanded .poi-category-name {
    font-weight: 700;
}

/* Category name without role="button" (simple categories) */
.poi-category-label .poi-category-name {
    padding-left: 8px;
    cursor: default;
}

.poi-category-label .poi-category-name:hover {
    color: #333;
}

/* Toggle button for expanding/collapsing */
.poi-category-toggle {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    fill: #404040;
}

.poi-category-toggle:hover {
    background: #716f73;
    fill: #fff;
}

.poi-category-toggle .toggle-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

/* Subcategories list */
.poi-subcategories-list {
    display: flex;
    flex-direction: column;
    padding: 0 12px 12px 12px;
    margin: 0;
    list-style: none;
    gap: 6px;
}

.poi-subcategories-list.hidden {
    display: none;
}

.poi-subcategory-item {
    padding: 0;
}

.poi-subcategory-icon-bg {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--category-color) 15%, white 85%);
}

.poi-subcategory-label {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: white;
    outline: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 10px;
    user-select: none;
}

.poi-subcategory-label:hover {
    border-color: #716f73;
    outline: 1px solid #716f73;
}

.poi-subcategory-label:has(.poi-subcategory-checkbox:checked) {
    border-color: var(--category-color);
}

.poi-subcategory-label:has(.poi-subcategory-checkbox:checked):hover {
    outline: 1px solid var(--category-color);
}

.poi-subcategory-checkbox {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1px solid #737373;
    border-radius: 2px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.poi-subcategory-checkbox:hover {
    border-color: #757575;
}

.poi-subcategory-checkbox:checked {
    border-color: #737373;
    background: #737373;
}

.poi-subcategory-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 3px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.poi-subcategory-checkbox:indeterminate {
    /* border-color: #64b5f6;
    background: #64b5f6; */
}

.poi-subcategory-checkbox:indeterminate::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 3px;
    width: 10px;
    height: 2px;
    background: white;
}

.poi-subcategory-checkbox:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.poi-subcategory-name {
    flex: 1;
    font-weight: 400;
    font-size: 13px;
    color: #555;
}

.poi-subcategory-label:has(.poi-subcategory-checkbox:checked) .poi-subcategory-name {

}

/* POI Marker Styles */
.poi-marker-icon {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.poi-marker-icon svg {
    filter: drop-shadow(0 1px 3px #0000004d) drop-shadow(0 4px 8px #00000026);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.poi-marker-icon:hover svg,
.search-marker-hover svg {
    transform: scale(1.15);
}

.poi-marker-icon:hover,
.search-marker-hover {
    z-index: 9999 !important;
}

.poi-inner-icon-container svg {
    overflow: visible;
}

.poi-inner-icon-container path {
    transition: fill 0.2s ease;
}

.poi-marker-icon:hover .poi-inner-icon-container path {
    fill: #5d3e31;
}

/* POI Card Popup Styles */
.poi-card-popup .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
}

.poi-card-popup .leaflet-popup-content {
    margin: 0;
}

.poi-card-popup .leaflet-popup-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    padding: 0;
    border: none;
    border-radius: 8px;
}

.poi-card-popup .leaflet-popup-close-button span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 400;
    font-size: 20px;
    line-height: 1;
    color: #404040 !important;
}

.poi-card-popup .leaflet-popup-close-button:hover {
    background: #737373;
}

.poi-card-popup .leaflet-popup-close-button:hover span {
    color: #fff !important;
}

/* Green variant for Mapy POI cards */
@media (orientation: landscape) {
    .leaflet-popup-content-wrapper:has(.poi-card-green) {
        max-width: calc(100vw - 400px);
    }
}

@media (orientation: portrait) {
    .leaflet-popup-content-wrapper:has(.poi-card-green) {
        max-width: calc(100vw - 40px);
    }
}

.poi-card {
    font-family: var(--font-stack);
    color: var(--font-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
}

.poi-card-header {
    position: relative;
    color: #404040;
}

.poi-card-title {
    padding: 11px 48px 10px 16px;
    margin: 0;
    font-weight: 700;
    font-size: 18px;
}

.poi-card-title.poi-card-is-logged {
    padding-right: 96px;
}

.poi-card-tabs {
    display: flex;
    padding: 0;
    border-top: 1px solid #e3e5e5;
    border-bottom: 1px solid #e3e5e5;
}

.poi-card-edit-btn {
    position: absolute;
    top: 0;
    right: 48px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.poi-card-edit-btn:hover {
    color: #fff;
    background: #737373;
}

.poi-card-edit-btn:active,
.leaflet-popup-close-button:active {
    border-radius: 9px;
}

.poi-card-tab {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 53px;
    padding: 10px 0 8px;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    color: #404040;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    gap: 2px;
}

.poi-card-tab .poi-card-tabs-icon {
    font-size: 20px;
}

.poi-card-tab span {
    display: block;
    font-size: 14px;
    line-height: 20px;
}

.poi-card-tab:hover {
    background: #f5f5f5;
}

.poi-card-tab.active {
    background: #f5f5f5;
}

.poi-card-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 37px;
    height: 3px;
    border-radius: 4px 4px 0 0;
    background-color: #404040;
}

.poi-card-body {
    height: 265px;
    padding: 16px;
    overflow-y: auto;
    font-size: 14px;
}

.poi-card-green .poi-card-body {
    height: 130px;
}

.poi-card-content {
    display: none;
}

.poi-card-content.active {
    display: block;
}

/* POI Card Popup Styles */
.poi-card-content.poi-card-info .fotogalerie {
    margin: 1rem 0;
}

.poi-card-content.poi-card-info .fotogalerie .gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.poi-card-content.poi-card-info .fotogalerie .evt_img {
    flex: 0 0 calc(33.333% - 3px);
    max-width: calc(33.333% - 3px);
}

.poi-card-content.poi-card-info .fotogalerie .evt_img p {
    margin: 0;
}

.poi-card-content.poi-card-info .fotogalerie .evt_img img {
    display: block;
    width: 100%;
    height: 80px;
    border: none !important;
    border-radius: 2px;
    object-fit: cover;
}

.poi-card-content.poi-card-info .fotogalerie .cleaner {
    display: none;
}

.poi-card-content.poi-card-info .popis a {
    color: #0369a1;
}

.poi-card-content.poi-card-info .popis a:hover {
    text-decoration-thickness: 0.13em !important;
}

.poi-card-content.poi-card-info .popis br {
    font-size: 16px;
}

@media (max-width: 480px) {
    .poi-card-content.poi-card-info .fotogalerie .evt_img {
        flex: 0 0 calc(50% - 2px);
        max-width: calc(50% - 2px);
    }
}

.poi-card-description {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.poi-card-field {
    margin-bottom: 12px;
    font-size: 14px;
}

.poi-card-field strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.poi-card-field span,
.poi-card-field a {
    color: #666;
    word-break: break-word;
}

.poi-card-field a {
    text-decoration: none;
    color: #2196f3;
    transition: color 0.2s ease;
}

.poi-card-field a:hover {
    text-decoration: underline;
    color: #1976d2;
}

.poi-coords-wrapper {
    display: flex;
    align-items: center;
    padding: 3px 12px;
    border: 1px solid #737373;
    border-radius: 12px;
}

.poi-coords-wrapper span {
    flex: 1;
    font-size: 14px;
}

.poi-coords-long {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.poi-coords-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #404040;
    border: none;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poi-coords-toggle:hover {
    background: #737373;
}

.poi-coords-toggle:hover i {
    color: #fff;
}

.poi-coords-toggle:active {
    border-radius: 12px;
}

.poi-coords-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poi-coords-copy:hover {
    background: #737373;
}

.poi-coords-copy:hover i {
    color: #fff;
}

.poi-coords-copy:active {
    border-radius: 12px;
}

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

.poi-error {
    padding: 20px;
    margin: 10px;
    text-align: center;
    color: #d32f2f;
    border-radius: 8px;
    background: #ffebee;
}

.poi-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.poi-card-btn {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    gap: 6px;
}

.poi-card-btn svg {
    width: 14px;
    height: 14px;
    fill: #666;
}

.poi-card-btn:hover {
    color: #1976d2;
    border-color: #2196f3;
    background: #e3f2fd;
}

.poi-card-btn:hover svg {
    fill: #2196f3;
}

/* Scrollbar styling for card body */
.poi-card-body::-webkit-scrollbar {
    width: 6px;
}

.poi-card-body::-webkit-scrollbar-track {
    border-radius: 3px;
    background: #f5f5f5;
}

.poi-card-body::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #bdbdbd;
}

/* Route planner actions in POI card */
.poi-route-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}

.poi-route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 16px;
    color: #333;
    border: 1px solid #737373;
    border-radius: 25px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
}

.poi-route-btn:hover {
    color: #fff;
    background: #737373;
}

.poi-route-btn:hover .poi-route-icon {
    color: #fff;
}

.poi-route-btn:active {
    border-radius: 12px;
}

.poi-route-icon {
    font-size: 20px;
}

.poi-route-start .poi-route-icon {
    color: #0369a1;
}

.poi-route-waypoint .poi-route-icon {
    color: #404040;
}

.poi-route-end .poi-route-icon {
    color: #be123c;
}

/* Responsive styles for POI popup in portrait mode (panel at bottom) */
@media (orientation: portrait) {
    /* Center the POI popup vertically in the available map space */
    .poi-card-popup .leaflet-popup-tip-container {
        /* Move the tip to point correctly when popup is centered */
        margin-top: 0;
    }

    /* Adjust popup positioning to center in visible map area (above the bottom panel) */
    .leaflet-popup {
        /* Leaflet's default positioning will be adjusted via JavaScript panTo offset */

        /* but we can ensure the popup doesn't get too large */
        max-height: calc(55vh - 100px);
    }

    .poi-card-popup .leaflet-popup-content-wrapper {
        max-height: calc(55vh - 100px);
    }

    .poi-card-body {
        min-height: 200px;

        /* Adjust body height to fit better in portrait mode */
        max-height: calc(55vh - 200px);
    }
}

/* Search Styles */
.search-container h3 {
    padding-top: 0;
    margin-top: 0;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--font-color);
}

.search-input-wrapper {
    margin-bottom: 12px;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    position: absolute;
    left: 16px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.search-input-icon .search-icon {
    width: 20px;
    height: 20px;
    fill: #404040;
}

.search-input {
    box-sizing: border-box;
    width: 100%;
    height: 52px;
    padding: 24px 42px 6px 53px;
    font-size: 16px;
    font-family: var(--font-stack);
    border: 1px solid #737373;
    border-radius: 16px;
    background: white;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: #0369a1;
    outline: none;
}

.search-input::placeholder {
    opacity: 0;
}

.search-input-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-input-clear:hover {
    background: #f5f5f5;
}

.search-input-clear .clear-icon {
    width: 20px;
    height: 20px;
    fill: #737373;
}

.search-input:not(:placeholder-shown) ~ .search-input-clear {
    display: flex;
}

.search-floating-label {
    position: absolute;
    top: 50%;
    left: 54px;
    font-weight: 400;
    font-size: 16px;
    color: #737373;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
}

.search-input:focus ~ .search-floating-label,
.search-input:not(:placeholder-shown) ~ .search-floating-label {
    top: 4px;
    font-size: 16px;
    transform: translateY(0);
}

/* Search states */
.search-loading {
    padding: 30px 20px;
    text-align: center;
    color: #737373;
}

.search-help,
.search-no-results,
.search-error {
    padding: 20px;
    margin: 24px 0;
    border-radius: 8px;
    background: #f5f5f5;
}

.search-help-content {
    display: flex;
    font-size: 16px;
    color: #737373;
    gap: 16px;
}

.message-content {
    display: flex;
    gap: 12px;
}

.message-container svg {
    width: auto;
    min-width: 20px;
    height: 20px;
    margin-top: 1px;
}

.message-container .search-help-icon {
    fill: #0369a1;
}

.message-container .no-results-icon,
.message-container .error-icon {
    fill: #b91c1c;
}

.message-container p {
    margin: 0;
    font-size: 16px;
}

.search-loading .loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 10px 0;
}

.search-loading .spinner-icon {
    width: 32px;
    height: 32px;
    fill: #0369a1;
    animation: spin 1s linear infinite;
}

.search-results-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.search-results-container.hidden,
.search-loading.hidden,
.search-no-results.hidden,
.search-help.hidden,
.search-error.hidden,
.search-load-more.hidden {
    display: none;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
    gap: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e3e5e5;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
}

.search-result-item:last-child {
    border-color: transparent;
}

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

.search-result-item:hover .search-result-name {
    font-weight: 700;
}

.search-result-item:focus-visible {
    outline-offset: -2px;
}

.search-result-item.active,
.search-result-item.highlighted {
    border-color: #737373;
    background: #fafafa;
}

.search-result-number {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-weight: bold;
    font-size: 20px;
    line-height: 1;
    color: #737373;
    border-radius: 50%;
    background: #73737326;
}

.search-result-item.gcm .search-result-number {
    color: #0369a1;
    background: #036aa126;
}

.search-result-item.mapycom .search-result-number {
    color: #15803d;
    background: #15803d26;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    margin: 0 0 2px 0;
    overflow: hidden;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.3;
    white-space: nowrap;
    color: #404040;
    text-overflow: ellipsis;
}

.search-result-description {
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    color: #737373;
    text-overflow: ellipsis;
}

/* Search result markers */
.search-result-marker {
    border: none;
    background: transparent;
}

.search-marker-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.search-marker-inner svg {
    width: 32px;
    height: 32px;
    fill: #e91e63;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.search-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    margin: 8px auto;
    margin-top: 8px;
    font-weight: 500;
    font-size: 16px;
    color: #0369a1;
    border: 2px solid transparent;
    border-radius: 16px;
    background: white;
    outline: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 13px;
    outline-offset: 2px;
}

.search-load-more:hover {
    color: #0369a1;
    border-color: #0369a1;
}

.search-load-more:focus-visible {
    outline-color: #0369a1;
}

.search-load-more svg {
    width: 16px;
    height: 16px;
    fill: #0369a1;
}

.search-load-more.loading {
    opacity: 0.7;
    pointer-events: none;
}

.search-load-more.loading svg {
    animation: spin 1s linear infinite;
}

/* Context Menu Styles */
.context-menu {
    position: absolute;
    z-index: 1000;
    width: fit-content;
    min-width: 200px;
    max-width: 400px;
    padding: 8px 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    font-family: var(--font-stack);
    color: #404040;
    border-radius: 8px;
    background: #fff;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.context-menu-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.context-menu-arrow.arrow-topleft {
    top: 0;
    left: 0;
    border-width: 8px 8px 0 0;
    border-color: #0369a1 transparent transparent transparent;
}

.context-menu-arrow.arrow-topright {
    top: 0;
    right: 0;
    border-width: 8px 0 0 8px;
    border-color: #0369a1 transparent transparent transparent;
}

.context-menu-arrow.arrow-bottomleft {
    bottom: 0;
    left: 0;
    border-width: 8px 0 0 8px;
    border-color: transparent transparent transparent #0369a1;
}

.context-menu-arrow.arrow-bottomright {
    right: 0;
    bottom: 0;
    border-width: 0 0 8px 8px;
    border-color: transparent transparent #0369a1 transparent;
}

.context-menu-content {
    position: relative;
}

.context-menu-block {
    padding: 6px 0;
}

.context-menu-block:not(:first-child) {
    border-top: 1px solid #e3e5e5;
}

.context-menu-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    justify-items: center;
    min-height: 40px;
    padding: 0 20px;
    cursor: pointer;
    gap: 20px;
}

.context-menu-item:hover {
    color: #fff;
    background-color: #49454f;
}

.context-menu-item:hover .context-menu-icon {
    fill: #fff;
}

.context-menu-item.hidden {
    display: none;
}

.context-menu-icon {
    flex-shrink: 0;
    width: auto;
    height: 20px;
    fill: #49454f;
}

.context-menu-text {
    justify-self: start;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.map-arrow-marker {
    pointer-events: none !important;
}

.map-arrow-marker svg {
    z-index: 1000 !important;
    filter: drop-shadow(0 1px 3px #0000004d) drop-shadow(0 4px 8px #00000026);
}

/* Tools Panel Styles */
.tools-panel {
    position: fixed;
    z-index: 1000;
    width: fit-content;
    min-width: 200px;
    max-width: 350px;
    padding: 8px 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    font-family: var(--font-stack);
    color: #404040;
    border-radius: 8px;
    background: #fff;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.tools-panel-content {
    position: relative;
}

/* Layer Selector Panel Styles */
.layer-selector-panel {
    position: fixed;
    z-index: 1000;
    width: fit-content;
    min-width: 250px;
    max-width: 400px;
    padding: 16px;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    font-family: var(--font-stack);
    color: #404040;
    border-radius: 8px;
    background: #fff;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.layer-selector-content {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .layer-selector-panel {
        min-width: 182px;
        padding: 8px;
    }

    .layer-selector-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

.layer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.layer-item:hover .layer-preview {
    outline-width: 2px;
    outline-color: #737373;
    outline-offset: 2px;
    outline-style: solid;
}

.layer-item.active .layer-preview {
    outline-width: 1px;
    outline-color: #0369a1;
    outline-offset: 2px;
    outline-style: solid;
}

.layer-item:focus-visible {
    outline: 2px solid #0369a1;
    outline-offset: 2px;
}

.layer-preview {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.layer-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.layer-text {
    font-weight: 400;
    font-size: 16px;
    text-align: center;
    color: #404040;
}

.layer-item.active .layer-text {
    color: #0369a1;
}

/* Help Popup */
.help-popup {
    position: fixed;
    right: 77px;
    bottom: 323px;
    z-index: 1000;
    width: fit-content;
    min-width: 300px;
    max-width: 400px;
    padding: 16px;
    overflow: hidden;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    font-family: var(--font-stack);
    color: #404040;
    border-radius: 4px;
    background: #fff;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.help-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-popup-header h3 {
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 16px;
}

.help-popup-close {
    position: absolute;
    top: 0;
    right: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    cursor: pointer;
}

.help-popup-close svg {
    width: auto;
    height: 16px;
    fill: #404040;
}

.help-popup-close:hover {
    background: #737373;
}

.help-popup-close:hover svg {
    fill: #fff;
}

/* Measurement Popup */
.measurement-popup {
    position: fixed;
    right: 77px;
    bottom: 274px;
    z-index: 1000;
    width: fit-content;
    min-width: 300px;
    max-width: 400px;
    padding: 16px 16px 8px 16px;
    overflow: hidden;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    font-family: var(--font-stack);
    color: #404040;
    border-radius: 4px;
    background: #fff;
    box-shadow:
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.measurement-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.measurement-popup-header h3 {
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 16px;
}

.measurement-popup-close {
    position: absolute;
    top: 0;
    right: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    cursor: pointer;
}

.measurement-popup-close svg {
    width: auto;
    height: 16px;
    fill: #404040;
}

.measurement-popup-close:hover {
    background: #737373;
}

.measurement-popup-close:hover svg {
    fill: #fff;
}

.measurement-popup-content p {
    margin: 0;
    font-size: 16px;
}

.measurement-popup-content #measurement-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 44px;
    min-height: 44px;
    padding: 12px 16px;
    margin-top: 8px;
    font-weight: 500;
    font-size: 16px;
    color: #0369a1;
    border: 1px solid transparent;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    fill: #0369a1;
}

.measurement-popup-content #measurement-clear:hover {
    border-color: #0369a1;
    fill: #0369a1;
}

/* Measurement markers */
.measurement-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    outline: 4px solid #e11d48;
    cursor: pointer;
    transition: all 0.2s ease;
    outline-offset: -4px;
}

.measurement-point.dragging {
    background: #9f1239 !important;
    outline-color: #9f1239 !important;
}

.measurement-point.dragging:hover {
    background: #9f1239 !important;
    outline-color: #9f1239 !important;
}

.measurement-point:hover {
    background: #e11d48;
    outline-color: #e11d48;
}

@media print {
    html,
    body {
        background: transparent !important;
    }

    body * {
        visibility: hidden;
    }

    #gcm-map,
    #gcm-map * {
        visibility: visible;
    }

    #gcm-map {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: transparent !important;
    }

    .leaflet-container {
        background: transparent !important;
    }

    .leaflet-tile-pane,
    .leaflet-tile-pane * {
        background: transparent !important;
    }

    .leaflet-marker-icon,
    .poi-marker-icon {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .poi-marker-icon svg {
        background: transparent !important;
        filter: none !important;
    }

    .leaflet-control-container,
    .leaflet-control-attribution {
        display: none !important;
    }
}
