/* =====================================================
   Local Store Maps - Frontend Clean CSS
   Panel trái 45%, map phải 55%
===================================================== */

.lsm-store-locator,
.lsm-store-locator * {
    box-sizing: border-box;
}

.lsm-store-locator {
    --lsm-yellow: var(--lsm-primary, #ffcc00);
    --lsm-text: #222;
    --lsm-muted: #444;
    --lsm-blue: #1580a8;

    display: grid;
    grid-template-columns: minmax(430px, 42%) minmax(0, 1fr) !important;
    width: 100%;
    min-height: 660px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e1e1e1;
    color: var(--lsm-text);
    font-family: Arial, Helvetica, sans-serif;
}

/* =====================================================
   Left panel
===================================================== */

.lsm-panel {
    position: relative;
    z-index: 2;
    display: flex;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-right: 1px solid #d9d9d9;
}

.lsm-search,
.lsm-filters,
.lsm-near-title {
    background: var(--lsm-yellow);
}

/* =====================================================
   Search
===================================================== */

.lsm-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    padding: 12px 12px 6px;
}

.lsm-search input {
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 0;
    outline: none;
    background-color: white;
    color: #30343b;
    box-shadow: none;
    font-size: 15px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lsm-search input::placeholder {
    color: #777;
    opacity: 1;
}

.lsm-search-button {
    display: inline-flex;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 0;
    background: white;
    color: #111;
    cursor: pointer;
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
}

.lsm-search-button:hover,
.lsm-search-button:focus {
    background: rgba(255, 255, 255, 0.78);
    color: #111;
}

/* =====================================================
   Filters
===================================================== */

.lsm-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 8px 12px 8px;
}

.lsm-filters select {
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 42px 0 14px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 0;
    outline: none;
    background-color: white;
    color: #30343b;
    box-shadow: none;
    font-size: 15px;
    line-height: 1.2;

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    background-image: url("data:image/svg+xml,%3Csvg width='16' height='10' viewBox='0 0 16 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L8 8L14 2' stroke='%23222' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 10px;
}

.lsm-filters select::-ms-expand {
    display: none;
}

.lsm-near-title {
    padding: 6px 12px 12px;
    color: #111;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
}

/* =====================================================
   Store list
===================================================== */

.lsm-list {
    flex: 1;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    scrollbar-color: #111 #e9e9e9;
    scrollbar-width: thin;
}

.lsm-list::-webkit-scrollbar {
    width: 8px;
}

.lsm-list::-webkit-scrollbar-track {
    background: #e9e9e9;
}

.lsm-list::-webkit-scrollbar-thumb {
    background: #111;
    border-radius: 0;
}

/* =====================================================
   Store card
===================================================== */

.lsm-store-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 18px;
    width: 100%;
    max-width: 100%;
    min-height: 145px;
    padding: 16px 14px;
    overflow: hidden;
    cursor: pointer;
    border: 0;
    border-bottom: 1px solid #ededed;
    background: #fff;
    transition: background-color 160ms ease;
}

.lsm-store-card:hover,
.lsm-store-card.is-active {
    background: #E6E6E6;
}

.lsm-card-image {
    width: 160px;
    height: 105px;
    min-width: 160px;
    max-width: 160px;
    overflow: hidden;
    align-self: start;
    background: #e8e8e8;
}

.lsm-card-image img,
.lsm-popup-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lsm-no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ececec, #d7d7d7);
}

.lsm-card-body,
.lsm-popup-body {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.lsm-card-body h3,
.lsm-popup h3 {
    max-width: 100%;
    margin: 0 0 9px;
    color: #171717;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: 0;
    text-transform: uppercase;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.lsm-card-body p,
.lsm-popup p {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    max-width: 100%;
    margin: 0 0 7px;
    color: var(--lsm-muted);
    font-size: 14px;
    line-height: 1.4;
}

.lsm-card-body p span,
.lsm-popup p span {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.lsm-optional {
    display: grid;
}

/* =====================================================
   Icons
===================================================== */

.lsm-ico {
    display: inline-flex;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    align-items: center;
    justify-content: center;
    color: var(--lsm-yellow);
    flex: 0 0 18px;
    font-size: 15px;
    line-height: 1;
}

.lsm-ico-direction {
    color: var(--lsm-blue);
    font-size: 15px;
}

/* =====================================================
   Buttons
===================================================== */

.lsm-card-actions,
.lsm-popup-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 14px;
    max-width: 100%;
    margin-top: 10px;
    overflow: hidden;
}

.lsm-more,
.lsm-direction,
.lsm-popup-direction {
    display: inline-flex;
    min-height: 31px;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
}

.lsm-more {
    padding: 7px 13px;
    background: var(--lsm-yellow);
    color: #222 !important;
}

.lsm-more:hover,
.lsm-more:focus {
    color: #222 !important;
    filter: brightness(0.98);
}

.lsm-direction,
.lsm-popup-direction {
    gap: 5px;
    color: var(--lsm-blue) !important;
    background: transparent;
}

.lsm-direction:hover,
.lsm-popup-direction:hover,
.lsm-direction:focus,
.lsm-popup-direction:focus {
    color: #0e688b !important;
}

/* =====================================================
   Map
===================================================== */

.lsm-map-area {
    position: relative;
    min-width: 0;
    background: #eef1f2;
}

.lsm-map {
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.lsm-map .leaflet-control-zoom {
    margin-top: 16px;
    margin-left: 16px;
    border: 0;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.24);
}

.lsm-map .leaflet-control-zoom a {
    width: 38px;
    height: 38px;
    color: #111;
    font-size: 24px;
    font-weight: 700;
    line-height: 36px;
}

/* Khi thu gọn panel trái, map bung full */
.lsm-store-locator.is-panel-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) !important;
}

.lsm-store-locator.is-panel-collapsed .lsm-panel {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    border-right: 0 !important;
}

.lsm-store-locator.is-panel-collapsed .lsm-toggle-panel {
    left: 18px;
    z-index: 999;
    transform: rotate(180deg);
}

.lsm-store-locator.is-panel-collapsed .lsm-map-area {
    width: 100%;
    min-width: 0;
}

/* =====================================================
   Popup
===================================================== */

.lsm-popup {
    display: grid;
    grid-template-columns: 180px minmax(260px, 1fr);
    gap: 18px;
    max-width: 620px;
    padding: 0;
}

.lsm-popup-image {
    width: 180px;
    height: 118px;
    align-self: start;
    overflow: hidden;
    background: #ececec;
}

.lsm-popup h3 {
    margin-bottom: 12px;
    padding-right: 18px;
    font-size: 18px;
}

.lsm-popup p {
    margin-bottom: 7px;
    font-size: 14px;
}

.lsm-popup .lsm-optional {
    display: grid;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.leaflet-popup-content {
    width: auto !important;
    margin: 16px;
}

.leaflet-popup-tip {
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.16);
}

.leaflet-container a.leaflet-popup-close-button {
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    color: #b8b8b8;
    font-size: 28px;
    font-weight: 700;
    line-height: 26px;
}

/* =====================================================
   Marker
===================================================== */

.lsm-marker-pin {
    position: relative;
}

.lsm-marker-pin span {
    position: absolute;
    left: 6px;
    top: 1px;
    width: 42px;
    height: 42px;
    border: 7px solid #d33131;
    border-radius: 50% 50% 50% 0;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.26);
    transform: rotate(-45deg);
}

.lsm-marker-pin span::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d33131;
}

.lsm-empty {
    padding: 28px 18px;
    color: #666;
    font-size: 16px;
}

/* =====================================================
   Responsive
===================================================== */

@media (max-width: 1180px) {
    .lsm-store-locator {
        grid-template-columns: minmax(420px, 44%) minmax(0, 1fr) !important;
    }

    .lsm-store-card {
        grid-template-columns: 135px minmax(0, 1fr);
        gap: 15px;
    }

    .lsm-card-image {
        width: 135px;
        height: 90px;
        min-width: 135px;
        max-width: 135px;
    }
}

@media (max-width: 900px) {
    .lsm-store-locator {
        grid-template-columns: 1fr !important;
        min-height: auto !important;
    }

    .lsm-panel {
        max-height: 500px;
        border-right: 0;
        border-bottom: 1px solid #dedede;
    }

    .lsm-map {
        min-height: 420px;
    }

    .lsm-toggle-panel {
        display: none;
    }
}

@media (max-width: 620px) {
    .lsm-search {
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 8px;
        padding: 10px;
    }

    .lsm-search input,
    .lsm-search-button,
    .lsm-filters select {
        height: 44px;
        font-size: 14px;
    }

    .lsm-search-button {
        width: 44px;
        font-size: 20px;
    }

    .lsm-filters {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 0 10px 10px;
    }

    .lsm-near-title {
        padding: 4px 10px 12px;
        font-size: 14px;
    }

    .lsm-store-card {
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 12px;
        padding: 14px 10px;
    }

    .lsm-card-image {
        width: 110px;
        height: 74px;
        min-width: 110px;
        max-width: 110px;
    }

    .lsm-card-body h3 {
        font-size: 15px;
    }

    .lsm-card-body p {
        font-size: 13px;
    }

    .lsm-card-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .lsm-popup {
        grid-template-columns: 1fr;
    }

    .lsm-popup-image {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}
.lsm-map .leaflet-control-attribution {
    display: none !important;
}
/* =====================================================
   Giới hạn danh sách cửa hàng: hiện tối đa 4 cái
   Từ cái thứ 5 thì scroll xuống
===================================================== */

/* Khóa chiều cao widget theo header + 4 cửa hàng. */
.lsm-store-locator {
    --lsm-card-height: 145px;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-items: stretch !important;
}

.lsm-panel {
    min-height: 0 !important;
    height: auto !important;
}

.lsm-list {
    flex: 0 0 auto !important;
    height: calc(var(--lsm-card-height) * 4) !important;
    max-height: calc(var(--lsm-card-height) * 4) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Set chiều cao card ổn định để đúng 4 cái, item thứ 5 bắt đầu scroll. */
.lsm-store-card {
    height: var(--lsm-card-height) !important;
    min-height: var(--lsm-card-height) !important;
    max-height: var(--lsm-card-height) !important;
    overflow: hidden !important;
}

.lsm-map-area,
.lsm-map {
    min-height: 0 !important;
    height: 100% !important;
}

/* Không cho text dài làm card phình quá cao */
.lsm-card-body {
    overflow: hidden !important;
}

.lsm-card-body h3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.lsm-card-body p span {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Scrollbar gọn */
.lsm-list::-webkit-scrollbar {
    width: 8px !important;
}

.lsm-list::-webkit-scrollbar-track {
    background: #e9e9e9 !important;
}

.lsm-list::-webkit-scrollbar-thumb {
    background: #111 !important;
    border-radius: 0 !important;
}

@media (max-width: 900px) {
    .lsm-store-locator {
        --lsm-card-height: 145px;
    }

    .lsm-list {
        height: calc(var(--lsm-card-height) * 4) !important;
        max-height: calc(var(--lsm-card-height) * 4) !important;
    }

    .lsm-map,
    .lsm-map-area {
        min-height: 420px !important;
    }
}

@media (max-width: 620px) {
    .lsm-store-locator {
        --lsm-card-height: 128px;
    }
}
/* =====================================================
   Fix nút thu gọn panel: hiện rõ, vuông, icon giữa
===================================================== */

.lsm-toggle-panel {
    position: absolute !important;
    top: 95px !important;
    left: 17px !important;
    z-index: 9999 !important;

    width: 37px !important;
    height: 37px !important;
    min-width: 37px !important;
    min-height: 37px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    margin: 0 !important;

    border: 0 !important;
    background: #ffffff !important;
    color: #111 !important;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18) !important;
    cursor: pointer !important;

    font-size: 0 !important;
    line-height: 1 !important;
    transform: none !important;
}

/* Icon mũi tên luôn nằm giữa */
.lsm-toggle-panel::before {
    content: "‹" !important;
    display: block !important;
    color: #111 !important;
    font-size: 32px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    transform: translateY(-2px) !important;
}

/* Khi thu gọn panel: không xoay nguyên nút, chỉ đổi icon */
.lsm-store-locator.is-panel-collapsed .lsm-toggle-panel {
    position: absolute !important;
    left: 17px !important;
    z-index: 9999 !important;
    transform: none !important;
}

.lsm-store-locator.is-panel-collapsed .lsm-toggle-panel::before {
    content: "›" !important;
    transform: translateY(-2px) !important;
}