/**
 * community-map-nearby.css v6.0
 * 7+ Categories — dropdown accordion sidebar with checkbox icons
 *
 * v6.0: Checkbox sidebar icons, dropdown accordion, dynamic colors via inline style,
 * map markers unchanged (circle style). Supports custom categories.
 */

/* Container */
.spc-map-v2 { padding: 0 !important; }
.spc-map-v2-container { width: 100%; display: flex; height: 500px; overflow: hidden; }

/* Sidebar — scrollable */
.spc-map-sidebar {
    width: 384px; min-width: 384px; height: 100%;
    background: var(--spc-100, #F5F3F0);
    display: flex; flex-direction: column;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0; box-sizing: border-box;
    scrollbar-width: thin; scrollbar-color: var(--spc-300, #E8E5DF) transparent;
}
.spc-map-sidebar::-webkit-scrollbar { width: 4px; }
.spc-map-sidebar::-webkit-scrollbar-track { background: transparent; }
.spc-map-sidebar::-webkit-scrollbar-thumb { background: var(--spc-300, #E8E5DF); border-radius: 4px; }

.spc-map-sidebar-item {
    display: flex; align-items: center; gap: 20px;
    padding: 24px 25px; cursor: pointer;
    transition: background 0.2s ease; flex-shrink: 0;
}
.spc-map-sidebar-item:hover { background: var(--spc-200, #EFEDEB); }
.spc-map-sidebar-item.active { background: var(--spc-200, #EFEDEB); }

.spc-map-sidebar-divider {
    width: calc(100% - 50px); height: 0; margin: 0 25px;
    border: none; border-top: 1px solid var(--spc-300, #E8E5DF); flex-shrink: 0;
}

.spc-map-sidebar-info { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; text-align: left; align-items: flex-start; }

.spc-map-sidebar-category {
    font-family: 'Afacad Flux', sans-serif; font-size: 14px; font-weight: 400;
    text-transform: uppercase; letter-spacing: 0.02em;
}

.spc-map-sidebar-name {
    color: #2A2A2A; font-family: 'Afacad Flux', sans-serif;
    font-size: 18px; font-weight: 500; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.spc-map-sidebar-meta { display: flex; align-items: center; gap: 10px; justify-content: flex-start; text-align: left; }
.spc-map-sidebar-address {
    color: var(--spc-light-text, #766C61); font-family: 'Afacad Flux', sans-serif;
    font-size: 14px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spc-map-sidebar-dot { width: 3px; height: 3px; background: var(--spc-light-text, #766C61); border-radius: 50%; flex-shrink: 0; }
.spc-map-sidebar-distance {
    color: var(--spc-light-text, #766C61); font-family: 'Afacad Flux', sans-serif;
    font-size: 14px; font-weight: 400; flex-shrink: 0;
    text-align: left; margin-left: 0; margin-right: auto;
}

/* ---- Sidebar Marker Icons ---- */
.spc-map-marker-icon { display: flex; justify-content: center; align-items: center; flex-shrink: 0; width: 35px; }

.spc-marker-home {
    width: 28px; height: 28px; background: #778869;
    border: 2px solid #FFFFFF; border-radius: 50%;
    box-shadow: 3px 5px 6px 2px rgba(0,0,0,0.40);
}

/* Legacy circle icons kept for backward compat */
.spc-marker-entertainment { width: 25px; height: 25px; padding: 5px; background: #FEAF3E; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-restaurants   { width: 25px; height: 25px; padding: 5px; background: #F05759; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-fitness       { width: 25px; height: 25px; padding: 5px; background: #9261E8; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-shopping      { width: 25px; height: 25px; padding: 5px; background: #34B07D; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-tech          { width: 25px; height: 25px; padding: 5px; background: #3B82F6; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-amenities     { width: 25px; height: 25px; padding: 5px; background: #F59E0B; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }
.spc-marker-healthcare    { width: 25px; height: 25px; padding: 5px; background: #EF4444; border-radius: 12.5px; box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25); }

/* ============================================================
   CHECKBOX-STYLE SIDEBAR ICONS
   Color set via inline style by JS for dynamic custom category support
   ============================================================ */
.spc-checkbox-icon {
    width: 28px; height: 28px;
    border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.spc-checkbox-icon svg { width: 16px; height: 16px; display: block; }

/* ============================================================
   DROPDOWN / ACCORDION STYLES
   ============================================================ */
.spc-map-cat-header {
    display: flex; align-items: center; gap: 20px;
    padding: 20px 25px; cursor: pointer;
    transition: background 0.2s ease; flex-shrink: 0;
    user-select: none;
}
.spc-map-cat-header:hover { background: var(--spc-200, #EFEDEB); }

.spc-map-cat-header-info {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.spc-map-cat-header-label {
    font-family: 'Afacad Flux', sans-serif; font-size: 15px; font-weight: 500;
    letter-spacing: 0.02em; line-height: 1;
}

.spc-map-cat-chevron {
    font-size: 10px; color: var(--spc-light-text, #766C61);
    transition: transform 0.25s ease; flex-shrink: 0;
    margin-left: auto;
}

.spc-map-cat-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease;
}
.spc-map-cat-body.expanded {
    max-height: 600px;
}

.spc-map-place-item {
    display: flex; align-items: center; gap: 20px;
    padding: 12px 25px 12px 80px;
    cursor: pointer;
    transition: background 0.2s ease; flex-shrink: 0;
}
.spc-map-place-item:hover { background: var(--spc-200, #EFEDEB); }
.spc-map-place-item.active { background: var(--spc-200, #EFEDEB); }
.spc-map-place-item .spc-map-sidebar-info { gap: 2px; }
.spc-map-place-item .spc-map-sidebar-name { font-size: 16px; font-weight: 400; }
.spc-map-place-item .spc-map-sidebar-distance { font-size: 13px; }

/* ---- Right Map ---- */
.spc-map-v2-map-wrap { flex: 1; height: 100%; position: relative; overflow: hidden; }
.spc-map-v2 .spc-map-leaflet { width: 100%; height: 100%; z-index: 1; }
.spc-map-v2 .spc-map-zoom { width: 40px; height: 80px; position: absolute; right: 20px; bottom: 20px; background: var(--spc-white, #FFFFFF); border-radius: 4px; box-shadow: 0 4px 20px rgba(0,0,0,0.10); display: flex; flex-direction: column; z-index: 10; }
.spc-map-v2 .spc-map-zoom-btn { flex: 1; display: flex; justify-content: center; align-items: center; background: none; border: none; cursor: pointer; }
.spc-map-v2 .spc-map-zoom-btn:hover { background: var(--spc-100, #F5F3F0); }
.spc-map-v2 .spc-map-zoom-btn:first-child { border-radius: 4px 4px 0 0; }
.spc-map-v2 .spc-map-zoom-btn:last-child { border-radius: 0 0 4px 4px; }
.spc-map-v2 .spc-map-zoom-btn .material-symbols-outlined { font-size: 24px; color: var(--spc-primary, #5A4F42); }
.spc-map-v2 .spc-map-zoom-divider { width: 80%; height: 0; margin: 0 auto; border-top: 1px solid var(--spc-200, #EFEDEB); }

/* ---- Leaflet Map Markers (UNCHANGED circle style) ---- */
.spc-leaflet-marker-home {
    width: 28px !important; height: 28px !important; background: #778869 !important;
    border-radius: 50% !important; border: 3px solid #FFFFFF !important;
    box-shadow: 3px 5px 6px 2px rgba(0,0,0,0.40) !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
}
.spc-leaflet-marker-home svg { width: 14px; height: 14px; display: block; margin: auto; }

.spc-leaflet-marker-poi {
    width: 25px !important; height: 25px !important; border-radius: 12.5px !important;
    box-shadow: 2px 3px 4px 1px rgba(0,0,0,0.25) !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
}
.spc-leaflet-marker-poi svg { width: 13px; height: 13px; display: block; margin: auto; }

.spc-leaflet-marker-entertainment { background: #FEAF3E !important; }
.spc-leaflet-marker-restaurants   { background: #F05759 !important; }
.spc-leaflet-marker-fitness       { background: #9261E8 !important; }
.spc-leaflet-marker-shopping      { background: #34B07D !important; }
.spc-leaflet-marker-tech          { background: #3B82F6 !important; }
.spc-leaflet-marker-amenities     { background: #F59E0B !important; }
.spc-leaflet-marker-healthcare    { background: #EF4444 !important; }

.spc-map-v2 .leaflet-control-zoom,
.spc-map-v2 .leaflet-control-attribution { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1439px) { .spc-map-v2-container { margin: 0; } }

@media (max-width: 1199px) { .spc-map-sidebar { width: 340px; min-width: 340px; } }

@media (max-width: 1023px) {
    .spc-map-v2-container { flex-direction: column; height: auto; overflow: visible; }
    .spc-map-sidebar { width: 100%; min-width: 100%; height: auto; max-height: 300px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; flex-shrink: 0; }
    .spc-map-v2-map-wrap { height: 400px; min-height: 400px; flex-shrink: 0; }
    .spc-map-v2-map-wrap .spc-map-leaflet, .spc-map-v2 .spc-map-leaflet { height: 400px !important; min-height: 400px !important; }
    .spc-map-place-item { padding-left: 60px; }
}

@media (max-width: 767px) {
    .spc-map-sidebar { max-height: 260px; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
    .spc-map-sidebar-item { padding: 18px 20px; gap: 16px; }
    .spc-map-cat-header { padding: 16px 20px; gap: 16px; }
    .spc-map-place-item { padding: 10px 20px 10px 56px; }
    .spc-map-sidebar-divider { width: calc(100% - 40px); margin: 0 20px; }
    .spc-map-v2-map-wrap { height: 350px; min-height: 350px; }
    .spc-map-v2-map-wrap .spc-map-leaflet, .spc-map-v2 .spc-map-leaflet { height: 350px !important; min-height: 350px !important; }
    .spc-map-sidebar-name { font-size: 16px; }
    .spc-map-v2 .spc-map-zoom { right: 12px; bottom: 12px; }
}

@media (max-width: 480px) {
    .spc-map-sidebar { max-height: 220px; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
    .spc-map-sidebar-item { padding: 14px 16px; gap: 12px; }
    .spc-map-cat-header { padding: 12px 16px; gap: 12px; }
    .spc-map-place-item { padding: 8px 16px 8px 48px; }
    .spc-map-sidebar-divider { width: calc(100% - 32px); margin: 0 16px; }
    .spc-map-v2-map-wrap { height: 280px; min-height: 280px; }
    .spc-map-v2-map-wrap .spc-map-leaflet, .spc-map-v2 .spc-map-leaflet { height: 280px !important; min-height: 280px !important; }
    .spc-map-v2 .spc-map-zoom { right: 10px; bottom: 10px; }
}