/* ═══════════════════════════════════════════════════════
   SM Mall Map — Frontend Styles
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

:root {
    --sm-bg-primary: #ffffff;
    --sm-bg-secondary: #fdfdfd;
    --sm-bg-card: #ffffff;
    --sm-accent-1: #e94560;
    --sm-accent-2: #0f3460;
    --sm-accent-3: #533483;
    --sm-accent-gold: #f5a623;
    --sm-teal: #00d2ff;
    --sm-text-primary: #f0f0f5;
    --sm-text-secondary: #a0a0b8;
    --sm-text-muted: #6b6b80;
    --sm-border: rgba(255, 255, 255, 0.08);
    --sm-border-hover: rgba(255, 255, 255, 0.15);
    --sm-shop-hover: #00d2ff;
    --sm-shop-active: #f5a623;
    --sm-gradient-accent: linear-gradient(135deg, #e94560 0%, #533483 100%);
    --sm-gradient-card: linear-gradient(145deg, rgba(22, 33, 62, 0.9), rgba(15, 15, 26, 0.95));
    --sm-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --sm-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --sm-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --sm-shadow-glow: 0 0 30px rgba(0, 210, 255, 0.15);
    --sm-radius-sm: 8px;
    --sm-radius-md: 12px;
    --sm-radius-lg: 20px;
    --sm-radius-xl: 28px;
    --sm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sm-fast: 0.2s ease;
    --sm-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ────────────────────────────────────────────── */
.sm-map-root,
.sm-map-root *,
.sm-map-root *::before,
.sm-map-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Root Container — FULL VIEWPORT ──────────────────── */
.sm-map-root {
    font-family: var(--sm-font);
    color: var(--sm-text-primary);
    background: var(--sm-bg-primary);
    line-height: 1.6;
    width: 100% !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    position: relative !important;
    display: block !important;
}

/* ── Map Wrapper — fills root ────────────────────────── */
.sm-map-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    position: relative;
}

/* ── Search + Zoom — floating overlay ────────────────── */
.sm-search-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}

.sm-search-controls > * {
    pointer-events: auto;
}

.sm-search-box {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.sm-search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-lg);
    color: var(--sm-text-primary);
    font-family: var(--sm-font);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--sm-fast), box-shadow var(--sm-fast);
    box-shadow: var(--sm-shadow-md);
}

.sm-search-box input:focus {
    border-color: var(--sm-teal);
    box-shadow: var(--sm-shadow-glow);
}

.sm-search-box input::placeholder {
    color: var(--sm-text-muted);
}

.sm-search-box .sm-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sm-text-muted);
    font-size: 1rem;
    pointer-events: none;
}

/* ── Search Dropdown ──────────────────────────────────── */
.sm-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(15, 15, 26, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--sm-shadow-lg);
}

.sm-search-dropdown.show {
    display: block;
    animation: smSlideIn 0.2s ease;
}

.sm-search-result {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--sm-border);
    transition: background var(--sm-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.sm-search-result:last-child { border-bottom: none; }

.sm-search-result:hover,
.sm-search-result:active {
    background: rgba(0, 210, 255, 0.08);
}

.sm-search-result .sm-result-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.sm-search-result .sm-result-id {
    font-size: 0.75rem;
    color: var(--sm-teal);
    background: rgba(0, 210, 255, 0.1);
    padding: 2px 8px;
    border-radius: var(--sm-radius-sm);
    flex-shrink: 0;
    margin-left: 8px;
}

.sm-no-results {
    padding: 16px;
    color: var(--sm-text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* ── Zoom Controls ────────────────────────────────────── */
.sm-zoom-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.sm-zoom-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--sm-radius-md);
    border: 1px solid var(--sm-border);
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--sm-text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sm-fast);
    font-family: var(--sm-font);
    box-shadow: var(--sm-shadow-sm);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.sm-zoom-btn:hover {
    border-color: var(--sm-teal);
    color: var(--sm-teal);
}

.sm-zoom-btn:active {
    transform: scale(0.9);
    background: var(--sm-accent-2);
}

/* ── Map Container — FULL HEIGHT ──────────────────────── */
.sm-map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sm-bg-primary);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.sm-map-container:active {
    cursor: grabbing;
}

.sm-map-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.sm-map-inner {
    transform-origin: 0 0;
}

.sm-map-inner svg {
    display: block;
    width: 100%;
    min-width: 1600px; 
    height: auto;
}

/* ── SVG Shop Polygons ────────────────────────────────── */
.sm-map-inner .btn-cta polygon {
    transition: fill var(--sm-fast), filter var(--sm-fast);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sm-map-inner .btn-cta:hover polygon {
    fill: var(--sm-shop-hover) !important;
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.4));
}

.sm-map-inner .btn-cta polygon.active_shop {
    fill: var(--sm-shop-active) !important;
    filter: drop-shadow(0 0 12px rgba(245, 166, 35, 0.5));
}

/* ══════════════════════════════════════════════════════════
   SHOP NAME LABELS  —  FORCE HIDDEN
   The SVG #Shop_Names group contains <polygon> and <text>
   elements with inline fill/stroke. We must use display:none
   with !important to guarantee they are invisible.
   JS will show specific ones on hover via inline style.
   ══════════════════════════════════════════════════════════ */
#Shop_Names polygon,
#Shop_Names text {
    display: none !important;
}

#Shop_Names g {
    display: none !important;
}

/* When JS adds .sm-label-show, override the hide */
#Shop_Names polygon.sm-label-show,
#Shop_Names text.sm-label-show,
#Shop_Names g.sm-label-show,
#Shop_Names g.sm-label-show polygon,
#Shop_Names g.sm-label-show text {
    display: inline !important;
}

/* ── Loading Spinner ──────────────────────────────────── */
.sm-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    color: var(--sm-text-muted);
    z-index: 10;
}

.sm-map-loading .sm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--sm-border);
    border-top-color: var(--sm-teal);
    border-radius: 50%;
    animation: smSpin 0.8s linear infinite;
    margin-right: 10px;
}

/* ── Mobile hint (hidden by default) ──────────────────── */
.sm-map-hint {
    display: none;
}

/* ── Panel Overlay ────────────────────────────────────── */
.sm-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--sm-smooth);
    -webkit-tap-highlight-color: transparent;
}

.sm-panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Shop Detail Panel ────────────────────────────────── */
.sm-shop-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 88vw;
    height: 100vh;
    height: 100dvh;
    background: var(--sm-gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--sm-border);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform var(--sm-smooth);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.sm-shop-panel.active {
    transform: translateX(0);
}

.sm-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sm-border);
    flex-shrink: 0;
}

.sm-panel-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sm-teal);
}

.sm-panel-close {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 1px solid var(--sm-border);
    background: transparent;
    color: var(--sm-text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sm-fast);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sm-panel-close:hover,
.sm-panel-close:active {
    background: var(--sm-accent-1);
    border-color: var(--sm-accent-1);
    color: white;
}

.sm-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ── Shop Image ───────────────────────────────────────── */
.sm-shop-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--sm-bg-secondary);
    flex-shrink: 0;
}

.sm-shop-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sm-shop-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--sm-gradient-accent);
    color: white;
    padding: 5px 12px;
    border-radius: var(--sm-radius-xl);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: var(--sm-shadow-sm);
}

/* ── Shop Details ─────────────────────────────────────── */
.sm-shop-details {
    padding: 20px;
}

.sm-shop-name {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 4px;
    word-break: break-word;
}

.sm-shop-category {
    color: var(--sm-text-secondary);
    font-size: 0.82rem;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sm-shop-info-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sm-shop-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--sm-radius-md);
    border: 1px solid var(--sm-border);
}

.sm-shop-info-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--sm-radius-sm);
    background: rgba(0, 210, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sm-shop-info-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sm-text-muted);
    margin-bottom: 2px;
}

.sm-shop-info-value {
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-word;
}

.sm-shop-info-value a {
    color: var(--sm-teal);
    text-decoration: none;
}

.sm-shop-info-value a:active {
    color: var(--sm-accent-gold);
}

/* ── Animations ───────────────────────────────────────── */
@keyframes smSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes smSpin {
    to { transform: rotate(360deg); }
}

/* ── Scrollbar ────────────────────────────────────────── */
.sm-map-root ::-webkit-scrollbar { width: 4px; }
.sm-map-root ::-webkit-scrollbar-track { background: transparent; }
.sm-map-root ::-webkit-scrollbar-thumb { background: var(--sm-text-muted); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════
   MOBILE — max 768px
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sm-search-controls {
        top: 10px;
        left: 10px;
        right: 10px;
        gap: 8px;
    }

    .sm-search-box input {
        padding: 10px 14px 10px 36px;
        font-size: 0.84rem;
        border-radius: var(--sm-radius-md);
    }

    .sm-search-box .sm-search-icon {
        left: 11px;
        font-size: 0.9rem;
    }

    .sm-zoom-controls {
        flex-direction: row;
        gap: 6px;
    }

    .sm-zoom-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        border-radius: var(--sm-radius-sm);
    }

    /* Panel slides up from bottom */
    .sm-shop-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 65vh;
        height: 65dvh;
        border-left: none;
        border-top: 1px solid var(--sm-border);
        border-radius: var(--sm-radius-lg) var(--sm-radius-lg) 0 0;
        transform: translateY(100%);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    }

    .sm-shop-panel.active {
        transform: translateY(0);
    }

    /* Drag handle */
    .sm-panel-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--sm-text-muted);
        opacity: 0.4;
    }

    .sm-panel-header {
        position: relative;
        padding: 14px 16px;
    }

    .sm-shop-details {
        padding: 16px;
    }

    .sm-shop-name {
        font-size: 1.05rem;
    }

    .sm-shop-image-wrap {
        aspect-ratio: 16 / 8;
    }
}

/* ── Small phones ─────────────────────────────────────── */
@media (max-width: 420px) {
    .sm-search-controls {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .sm-search-box input {
        padding: 9px 12px 9px 32px;
        font-size: 0.8rem;
    }

    .sm-zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .sm-shop-panel {
        height: 72vh;
        height: 72dvh;
    }
}

/* ── Landscape phones ─────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .sm-shop-panel {
        top: 0;
        bottom: 0;
        left: auto;
        right: 0;
        width: 50vw;
        max-width: 50vw;
        height: 100vh;
        height: 100dvh;
        border-top: none;
        border-left: 1px solid var(--sm-border);
        border-radius: 0;
        transform: translateX(100%);
    }

    .sm-shop-panel.active {
        transform: translateX(0);
    }

    .sm-panel-header::before {
        display: none;
    }
}

/* ── Avada / theme overrides ──────────────────────────── */
.sm-map-root table { border-collapse: collapse; margin: 0; }
.sm-map-root img { max-width: 100%; height: auto; }
