/* ── Container ─────────────────────────────────────────────── */
.mall-directory-container {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Search + Category Filter ───────────────────────────────── */
.mall-directory-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 32px;
    border-bottom: 1px solid #e8e8ee;
    margin-bottom: 0;
}

.mall-directory-search {  
    flex: 1; 
    min-width: 0; 
}
.mall-directory-category { flex-shrink: 0; }

.store-search-input {
    padding: 10px 16px;
    border: 1.5px solid #e0e0e6;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    width: 100%;
    transition: border-color 0.2s ease;
}
.store-search-input:focus { border-color: #1a1a3c; }

/* ── Custom category dropdown (replaces the native <select> UI) ────── */
.store-category-dropdown { position: relative; }

.store-category-dropdown__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border: 1.5px solid #e0e0e6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #1a1a3c;
    background: #fff;
    cursor: pointer;
    outline: none;
    min-width: 180px;
    transition: border-color 0.2s ease;
}
.store-category-dropdown__toggle:hover,
.store-category-dropdown__toggle:focus-visible { border-color: #1a1a3c; }

.store-category-dropdown__chevron {
    flex-shrink: 0;
    color: #666;
    transition: transform 0.2s ease;
}
.store-category-dropdown.is-open .store-category-dropdown__chevron { transform: rotate(180deg); }

.store-category-dropdown__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(20,20,40,0.16), 0 2px 8px rgba(20,20,40,0.06);
    padding: 8px;
    margin: 0;
    list-style: none;
    max-height: 340px;
    overflow-y: auto;
    z-index: 60;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.store-category-dropdown.is-open .store-category-dropdown__menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.store-category-dropdown__option {
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 14.5px;
    color: #1a1a3c;
    cursor: pointer;
    transition: background 0.12s ease;
    white-space: nowrap;
    outline: none;
    text-align: left;
}
.store-category-dropdown__option:hover,
.store-category-dropdown__option:focus-visible { background: #f3f3f7; }
.store-category-dropdown__option.is-selected { font-weight: 600; background: #f5f4ff; }

/* The real <select> stays in the DOM (it's what directory.js reads/filters
   from) but is fully hidden — the button+listbox above is the actual UI. */
.store-category-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Main grid: map 70% | list 30% ──────────────────────────── */
.mall-directory-main {
    display: grid;
    grid-template-columns: 30% 70%;
    align-items: stretch;
    min-height: 500px;
}

/* ── Floor Plan (left) ──────────────────────────────────────── */
.floor-plan-section {
    position: sticky;
    top: 0;
    /* height auto — follows the SVG's natural aspect ratio */
    max-height: 680px;
    overflow: hidden;
}

.floor-plan-container {
    position: relative;
    width: 100%;
    background: #edeae3;
    overflow: hidden;
    /* Aspect-ratio lock keeps the container in exact 1672:941 proportion,
       ensuring SVG viewBox zones align pixel-perfectly with the image. */
    aspect-ratio: 1672 / 941;
    max-height: 680px;
}

/* ── SVG map ─────────────────────────────────────────────────── */
/* width:100%;height:auto lets the SVG scale proportionally from
   its intrinsic width="1672" height="941" attributes — no letterbox
   centering, so the <image> base layer and zone overlays always align. */
#cartimar-map-svg {
    width: 100%;
    height: auto;
    display: block;
    touch-action: none;
    cursor: grab;

    @media (max-width: 1024px) {
        padding: 10px 0 !important;
    }
}
#cartimar-map-svg.is-dragging { cursor: grabbing; }

/* ── Zoom controls ───────────────────────────────────────────── */
.svg-map-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.svg-zoom-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.18);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    transition: background 0.15s, box-shadow 0.15s;
    padding: 0;
}
.svg-zoom-btn:hover  { background: #f4f4f4; box-shadow: 0 2px 8px rgba(0,0,0,0.22); }
.svg-zoom-btn:active { background: #e8e8e8; }

/* ── Store List (left) ──────────────────────────────────────── */
.stores-list-section {
    /* Matches the floor plan column height via grid alignment */
    height: 100%;
    max-height: 680px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.stores-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ── Store Card ──────────────────────────────────────────────── */
.store-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f4;
    cursor: pointer;
    transition: background 0.18s ease;
    border-radius: 4px;
}
.store-item:hover  { background: #f5f5fa; }
.store-item.active {
    background: #1a1a3c;
}
.store-item.active .store-item-info h4,
.store-item.active .store-item-location,
.store-item.active .store-item-phone,
.store-item.active .store-item-location svg,
.store-item.active .store-item-phone svg,
.store-item.active .store-item-stall,
.store-item.active .store-item-stall svg { color: #fff; fill: #fff; }

/* Thumbnail */
.store-item-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f0f0f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.store-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.store-item-thumb--pin {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eeeef5;
    border-radius: 8px;
} 
.store-pin-svg {
    width: 26px;
    height: 26px;
    fill: #1a1a3c;
} 

/* Info */
.store-item-info { flex: 1; min-width: 0; }
.store-item-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a3c;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-item-location,
.store-item-stall,
.store-item-phone {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
    color: #777;
    margin: 2px 0 0 0;
    line-height: 1.3;
}
.store-item-location svg,
.store-item-stall svg,
.store-item-phone svg {
    width: 12px;
    height: 12px;
    fill: #999;
    flex-shrink: 0;
}

.store-item-location svg {
    position: relative;
    top: 2px;
}

/* Scroll sentinel — invisible marker the IntersectionObserver in
   directory.js watches to load the next batch of store cards. */
.stores-list-sentinel {
    height: 1px;
}

/* Empty states */
.no-stores-message,
.no-results-found {
    padding: 40px 20px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
}

/* Scrollbar */
.stores-list::-webkit-scrollbar { width: 4px; }
.stores-list::-webkit-scrollbar-track { background: #f5f5f5; }
.stores-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.stores-list::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .mall-directory-main { grid-template-columns: 1fr; }
    .floor-plan-section  { position: static; max-height: 420px; border-right: none; border-bottom: 1px solid #e8e8ee; }
    .floor-plan-container { max-height: 420px; }
    .stores-list-section { height: auto; max-height: 500px; }
}

/* Image protection: deter casual right-click/drag saving of store logos and floor plan map */
.mall-directory-container img,
.mall-directory-container svg image {
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

@media (max-width: 640px) {
    .mall-directory-filters { padding: 16px; flex-direction: column; align-items: stretch; }
    .store-category-dropdown__toggle { width: 100%; }
    .store-category-dropdown__menu { left: 0; right: 0; min-width: 0; }
}
