@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600&family=Raleway:wght@400;500&display=swap');

.sml-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #000000;
    height: 670px;
    box-sizing: border-box;

    * {
        box-sizing: border-box;
    }

    .sml-sidebar {
        width: 360px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        border: 1px solid #B9A365;
        background-color: #fff;
        padding: 35px 40px 70px 40px;

        .sml-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;

            h3 {
                margin: 0;
                font-size: 18px;
                font-family: 'Playfair Display', serif;
                font-weight: 500;
                color: #000000;
                position: relative;
                padding-bottom: 12px;

                &::after {
                    content: '';
                    position: absolute;
                    left: 0;
                    bottom: 0;
                    width: 45px;
                    height: 1px;
                    background-color: #B9A365;
                }
            }
        }

        .sml-search-box {
            position: relative;
            margin-bottom: 0px;

            input {
                width: 100%;
                border: none;
                background: transparent;
                border-bottom: 2px dotted #ccc;
                padding: 10px 30px 10px 0;
                font-size: 14px;
                color: #000000;
                outline: none;

                &:focus {
                    border-bottom-color: #999;
                }
            }

            .sml-search-icon {
                position: absolute;
                right: 5px;
                top: 50%;
                transform: translateY(-50%);
                margin-top: -10px;
                color: #000000;
                pointer-events: none;
            }
        }

        /* Kontener spinający wrapper i track jako rodzeństwo —
           track jest POZA scrollującym wrapperem, więc się nie przesuwa */
        .sml-list-area {
            flex: 1 1 0;
            min-height: 0;
            position: relative;

            .sml-scrollbar-track {
                position: absolute;
                right: 0;
                top: 0;
                bottom: 0;
                width: 5px;
                background: #F2F2F2;
                overflow: hidden;

                .sml-scrollbar-thumb {
                    position: absolute;
                    left: 0;
                    width: 5px;
                    background: #B9A365;
                    cursor: pointer;
                    transition: background 0.2s;

                    @media (min-width: 1024px) {
                        &:hover {
                            background: #a38f55;
                        }
                    }
                }
            }
        }

        .sml-list-wrapper {
            width: 100%;
            height: 100%;
        }

        .sml-location-list {
            list-style: none;
            margin: 0;
            padding: 0 20px 0 0;
            overflow-y: scroll;
            overscroll-behavior-y: contain;
            width: 100%;
            height: 100%;

            /* Ukryj natywny scrollbar */
            scrollbar-width: none;
            -ms-overflow-style: none;
            /* Gwarantuj scroll dotykiem na iOS gdy rodzic ma overflow:hidden */
            touch-action: pan-y;

            @media (max-width: 768px) {
                overscroll-behavior-y: unset;
            }

            &::-webkit-scrollbar {
                display: none;
            }

            .sml-location-item {
                display: flex;
                align-items: flex-start;
                margin-bottom: 25px;
                cursor: pointer;
                padding: 5px;
                transition: all 0.2s ease;
                position: relative;

                &.active {
                    background-color: #f9f9f9;
                }

                @media (min-width: 1024px) {
                    &:hover:not(:has(.sml-nav-link:hover)) {
                        background-color: #f9f9f9;
                    }
                }

                .sml-item-icon {
                    margin-right: 8px;
                    color: #000000;
                    margin-top: 3px;
                }

                .sml-item-content {
                    flex-grow: 1;

                    .sml-item-header {
                        display: flex;
                        justify-content: space-between;
                        align-items: flex-start;
                    }

                    .sml-item-title {
                        font-size: 18px;
                        font-family: 'Playfair Display', serif;
                        font-weight: 500;
                        color: #000000;
                        position: relative;
                        padding-bottom: 7px;
                        margin-bottom: 7px;
                        padding-right: 40px;

                        &::after {
                            content: '';
                            position: absolute;
                            left: 0;
                            bottom: 0;
                            width: 30px;
                            height: 1px;
                            background-color: #B9A365;
                        }
                    }

                    .sml-nav-link {
                        position: absolute;
                        top: 2px;
                        right: 2px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        width: 32px;
                        height: 32px;
                        border-radius: 50%;
                        background-color: #f9f9f9;
                        flex-shrink: 0;
                        transition: background-color 0.2s ease;
                        color: #000;

                        @media (min-width: 1024px) {
                            &:hover {
                                background-color: #e0e0e0;
                            }
                        }

                        svg {
                            width: 16px;
                            height: 16px;
                        }
                    }

                    .sml-item-address {
                        font-size: 14px;
                        font-family: 'Raleway', sans-serif;
                        color: #000000;
                        line-height: 1.4;
                    }
                }
            }

            .sml-no-results {
                padding: 20px 40px;
                color: #000000;
                font-style: italic;
                font-size: 14px;
            }
        }
    }

    .sml-map-area {
        flex-grow: 1;
        position: relative;
        background: #e5e3df;
        border: 1px solid #A6A6A6;
        overflow: hidden;

        #sml-map {
            width: 100%;
            height: 100%;
            z-index: 1;
        }

        .sml-map-float-nav {
            position: absolute;
            bottom: 30px;
            right: 30px;
            z-index: 1000;
            background-color: #4285f4;
            color: #fff;
            padding: 12px 24px;
            border-radius: 30px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            font-size: 15px;
            font-weight: 500;
            text-decoration: none;
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px);
            transition: all 0.3s ease;
            
            &.visible {
                opacity: 1;
                visibility: visible;
                transform: translateY(0);
            }

            @media (max-width: 768px) {
                bottom: 10px;
                right: 10px;
            }

            @media (min-width: 1024px) {
                &:hover {
                    background-color: #3367d6;
                    transform: translateY(-2px);
                    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
                }
            }

            svg {
                width: 20px;
                height: 20px;
            }
        }
    }
}

.leaflet-popup-content-wrapper {
    border-radius: 4px;
}

.leaflet-popup-content {
    margin: 15px;
    font-family: inherit;
}

.sml-popup-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
    color: #000000;
}

.sml-popup-address {
    font-size: 13px;
    font-family: 'Raleway', sans-serif;
    color: #000000;
    margin-bottom: 10px;
}

.sml-popup-link {
    display: inline-block;
    color: #fff;
    background-color: #4285f4;
    text-decoration: none;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 3px;
    transition: background 0.2s;

    @media (min-width: 1024px) {
        &:hover {
            background-color: #3367d6;
            color: #fff;
        }
    }
}

@media (max-width: 768px) {
    .sml-container {
        flex-direction: column;
        height: auto;

        .sml-sidebar {
            width: 100%;
            height: 450px;
            padding: 25px;
            display: flex;
            flex-direction: column;

            .sml-list-wrapper {
                overflow-y: scroll;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                -ms-overflow-style: none;

                &::-webkit-scrollbar {
                    display: none;
                }
            }

            .sml-location-list {
                height: auto;
                overflow-y: visible;
                overflow-x: visible;
            }

            .sml-search-box input {
                font-size: 16px;
            }
        }

        .sml-map-area {
            height: 400px;
        }
    }
}

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