/* ========================================
   Root Elements (html, body)
   ======================================== */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* 전체 스크롤 방지 */
}


#main-container {
    position: relative;

    display: block;
    width: 100vw;
    height: 100dvh;

    min-width: 350px;
}

    #store-map-header {
        position: relative; /* sortable 의 drag 가 시작될 때, scroll 튐 방지 */

        display: grid;
        grid-template-columns:
            100px
            minmax(190px, 1fr)
            100px;

        border-bottom: 1px solid #dee2e6;
        padding: 10px 0px;

        min-width: fit-content;

    }

        #store-map-header-logo {
        }
            #store-map-header-logo img {
                width: 100%;
                padding: 5px 10px;
            }

        #store-map-header-title {
            display: block;
            margin: 0;
            padding-top: 3px;

            background: #fff;
            text-align: center;
            width: 100%;

            font-weight: 600;
            font-size: 14px;
        }
            #store-map-header-title-main {
            }
            #store-map-header-title-desc {
            }

        #store-map-header-menu {
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: flex-start;

            column-gap: 7px;
        }
            #top-language-icon {
                display: flex;
                flex-direction: column;
                
                padding-top: 7px;
                
                cursor: pointer;
            }
                #store-map-header-menu-language-img {
                    height: 24px;
                }
                #store-map-header-menu-language-text {
                    font-size: 10px;
                    font-weight: 600;
                }
            #store-map-header-menu-search {
                padding-top: 10px;
                
                cursor: pointer;
            }
                #store-map-header-menu-search img {
                    height: 27px;
                }



    /* Map Container */
    #map {
        width: 100%;
        height: 100%;
    }

        /* Animated GPS Location Marker (inside #map) */
        .animated-marker {
            width: 50px;
            height: 50px;
            transform: translate(-50%, -50%);
        }

        .marker-circle {
            position: absolute;
            width: 40px;
            height: 40px;
            background: #4285F4;
            border: 3px solid #FFFFFF;
            border-radius: 50%;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            background: rgba(66, 133, 244, 0.2);
            border-radius: 50%;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            z-index: 1;
            animation: pulse 2s ease-out infinite;
        }

            @keyframes pulse {
                0% {
                    transform: translate(-50%, -50%) scale(0.5);
                    opacity: 1;
                }

                100% {
                    transform: translate(-50%, -50%) scale(2);
                    opacity: 0;
                }
            }

            /* Direction arrow for GPS marker - improved for direction shape */
            .marker-arrow {
                position: absolute;
                width: 0;
                height: 0;

                /* Narrower width, longer height → better directional arrow */
                border-left: 10px solid transparent;
                border-right: 10px solid transparent;
                border-bottom: 26px solid #4285F4;

                left: 50%;
                top: 25%;
                transform: translate(-50%, -50%);
                transform-origin: 50% 75%;
                z-index: 2;
                opacity: 0.95;
                display: none;
                filter: drop-shadow(0 0 2px #fff);
            }

        .marker-dot {
            position: absolute;
            width: 16px;       /* 점 크기 */
            height: 16px;
            background-color: #4285F4;  /* Google Maps 파란색 */
            border: 2px solid #fff;     /* 흰색 테두리 */
            border-radius: 50%;          /* 원 모양 */
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            z-index: 3;
        }



        /* fetch store in current location */
        #search-again-button {
            position: fixed;
            display: none;

            top: 90px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            padding: 10px 18px;
            color: #5c9f55;
            box-shadow: 0 3px 8px rgba(0,0,0,0.2);
            border-radius: 20px;
            border: 1px solid #777;
            background: #fff;
            font-size: 12px;
            font-weight: 600;

            cursor: pointer;
        }

        #query-route-button {
            position: fixed;
            display: none;

            top: 90px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            padding: 10px 18px;
            color: #fff;
            box-shadow: 0 3px 8px rgba(0,0,0,0.2);
            border-radius: 20px;
            border: 1px solid #545454;
            background: #5c9f55;
            font-size: 12px;
            font-weight: 600;

            cursor: pointer;
        }


        #route-cancel-button {
            position: fixed;
            display: none;

            top: 90px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            padding: 10px 18px;
            color: #fff;
            box-shadow: 0 3px 8px rgba(0,0,0,0.2);
            border-radius: 20px;
            border: 1px solid #545454;
            background: #871719;
            font-size: 12px;
            font-weight: 600;

            cursor: pointer;
        }


        #error-popup {
            position: fixed;
            display: none;
            flex-direction: row;
            justify-content: flex-start;

            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 9999;
            padding: 11px 25px;
            color: #fff;
            box-shadow: 0 3px 8px rgba(0,0,0,0.2);
            border-radius: 20px;
            background: #871719;
            font-size: 12px;

            cursor: pointer;
        }
            #error-popup-title {
            }
            #error-popup-close {
                font-weight: 600;
                cursor: pointer;

                position: absolute;
                top: -1px;
                right: 13px;
            }


        /* Current Location Button */
        #locate-me-button {
            position: absolute;
            right: 20px;
            bottom: calc(40% + 30px);   /* Place on the bottom */
            width: 48px;
            height: 48px;
            background: white;
            border: none;
            border-radius: 50%;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 15;
            transition: all 0.2s ease;
            color: #333;
        }
            #locate-me-button:hover {
                background: #f5f5f5;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
            }
            #locate-me-button:active {
                transform: scale(0.95);
            }

            #locate-me-button img {
                width: 24px;
                height: 24px;
            }


        /* Current Location Button */
        #google-map-button {
            position: absolute;
            display: none;

            position: absolute;
            left: 20px;
            bottom: calc(40% + 30px);
            width: 48px;
            height: 48px;
            background: white;
            border: none;
            border-radius: 50%;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            align-items: center;
            justify-content: center;
            z-index: 15;
            transition: all 0.2s ease;
            color: #333;
        }
            #google-map-button img {
                width: 38px;
                aspect-ratio: 1/1;
            }

        /* Custom Popup (inside #map) */
        .custom-popup {
            position: absolute;
            background: white;
            border: 2px solid #24811e;
            border-radius: 8px;
            padding: 10px 15px;
            font-size: 14px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            transform: translate(-50%, calc(-100% - 20px));
            pointer-events: auto;
            z-index: 10;
            width: 150px;
        }

            /* 삼각형 테두리 */
            .custom-popup::before {
                content: "";
                position: absolute;
                bottom: -12px; /* 바깥쪽 */
                left: 50%;
                transform: translateX(-50%);
                border-width: 12px 10px 0 10px;
                border-style: solid;
                border-color: #24811e transparent transparent transparent;
            }

            /* 삼각형 내부 */
            .custom-popup::after {
                content: "";
                position: absolute;
                bottom: -10px; /* 안쪽 */
                left: 50%;
                transform: translateX(-50%);
                border-width: 10px 8px 0 8px;
                border-style: solid;
                border-color: white transparent transparent transparent;
            }


            .popup-close {
                position: absolute;
                top: 5px;
                right: 8px;
                cursor: pointer;
                color: #999;
                font-size: 16px;
                line-height: 1;
            }

            .popup-content {
                text-align: center;
            }

                .popup-content img {
                    width: 100%;
                    max-height: 100px;
                    object-fit: cover;
                    border-radius: 4px;
                    margin-bottom: 8px;
                }

                .popup-store-name {
                    margin-bottom: 5px;
                    margin-left: 5px;
                    margin-right: 5px;


                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    
                    font-size: 10px;
                    font-weight: 600;
                    color: #52b313;
                }

                .popup-image-container {
                    width: 100%;
                    max-width: 120px;
                }
                    .popup-store-image {
                        width: 100%;
                        aspect-ratio: 1;
                    }

                .popup-store-link {
                    background-color: #24811e;
                    color: #fff;
                    font-weight: 600;
                    font-size: 12px;
                    cursor: pointer;
                    text-decoration: none;
                    padding: 5px 15px;
                    border-radius: 20px;

                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                    display: block;
                }
                    .popup-store-link:hover {
                        color: #fff;
                    }



    /* Bottom Sheet Container */
    #bottom-sheet {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 40%;
        background: white;
        z-index: 19999;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
        transition: height 0.15s ease-out;

        min-width: 350px;
    }

        /* Drag Handle (child of #bottom-sheet) */
        #bottom-sheet-handle {
            width: 100%;
            height: 24px;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: grab;
            flex-shrink: 0;
        }

            #bottom-sheet-handle::after {
                content: "";
                width: 40px;
                height: 4px;
                background: #ddd;
                border-radius: 2px;
            }


        #bottom-sheet-option {
            position: relative;
            display: flex;
            flex-direction: row;
            gap: 10px;
            padding: 0px 15px 5px;
        }
            .bottom-sheet-option-item {
                border-radius: 10px;
                border: 1px solid #ccc;
                padding: 2px 10px;
                font-size: 12px;
                font-weight: 600;
                cursor: pointer;
            }
            .bottom-sheet-option-item[checked] {
                background-color: #6b9d57;
                color: #fff;
            }


    /* Store List Container (child of #bottom-sheet) */
    #near-store-rows {
        flex: 1;
        overflow-y: auto;
        padding: 0 16px 16px 16px;
    }

        .near-store-row {
            display: grid;
            grid-template-columns: 96px 1fr;
            gap: 12px;
            align-items: start;
            
            padding: 10px 0px;

            cursor: pointer;
        }
        .near-store-row:not(:last-child) {
            border-bottom: 1px solid #ccc;
        }

            .near-store-row-logo {
                display: block;
                width: 96px;
            }
                .near-store-row-logo img {
                    width: 100%;
                    object-fit: cover;
                    aspect-ratio: 1 / 1;
                    border-radius: 10px;
                }

            .near-store-row-content {
                position: relative;
                display: flex;
                flex-direction: column;
                row-gap: 5px;
                overflow-x: hidden;
            }

                .near-store-row-content-genre {
                    display: flex;
                    flex-direction: row;
                    flex-wrap: nowrap;
                }
                    .near-store-row-content-genre-item {
                        flex: 0 0 auto;
                        text-overflow: ellipsis;
                        flex-shrink: 1;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        margin-right: 8px;
                        border-radius: 15px;
                        border: 1px solid #eee;
                        font-size: 10px;
                        font-weight: 600;
                        padding: 2px 10px;
                    }
                .near-store-row-content-name {
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                }
                .near-store-row-content-openclose {
                }
                    .near-store-row-content-openclose-item {
                        font-size: 12px;
                        font-weight: 500;
                    }
                .near-store-row-content-badge {
                    display: flex;
                    flex-direction: row;

                    position: absolute;
                    right: 0px;
                    bottom: 0px;
                }
                    .near-store-row-content-badge {
                    }
                        .near-store-row-content-badge img {
                            height: 24px;
                        }
                        .gender-list-head-image {
                        }
                        .gender-list-item-image {
                            width: 12px;
                            height: 24px;
                            object-fit: cover;
                        }
                .near-store-row-content-distance {
                    font-size: 12px;
                }


        #near-store-is-empty {
            text-align: center;
        }

