/**
 * mNw Map Widget — Frontend Styles
 * Version: 1.0.0
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ═══════════════════════════════════════
   Widget Container
   ═══════════════════════════════════════ */

.mnw-map-widget {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    background: #f8f9fc;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mnw-map-widget.mnw-fullscreen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    z-index: 99999;
}

.mnw-map-canvas {
    width: 100%;
    height: 100%;
}


/* ═══════════════════════════════════════
   Floating Header
   ═══════════════════════════════════════ */

.mnw-map-header {
    position: absolute;
    top: 16px;
    left: 332px;
    z-index: 10;
    background: #fff;
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 340px;
    animation: mnwSlideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
    border: 1px solid #e8eaef;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When panel is hidden or no panel, header goes back to left */
.mnw-map-widget:not(:has(.mnw-map-poi-panel)) .mnw-map-header,
.mnw-map-widget:has(.mnw-map-poi-panel.collapsed) .mnw-map-header {
    left: 56px;
}

.mnw-map-header__logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.mnw-map-header__logo img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.mnw-map-header__info h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
    margin: 0;
    padding: 0;
}

.mnw-map-header__info p {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 2px 0 0;
    padding: 0;
}


/* ═══════════════════════════════════════
   Filter Chips
   ═══════════════════════════════════════ */

.mnw-map-filters {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: mnwSlideLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.mnw-map-filter-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e8eaef;
    border-radius: 100px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: #6b7280;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.mnw-map-filter-chip:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateX(-2px);
}

.mnw-map-filter-chip.active {
    background: var(--mnw-brand-primary, #1a1a2e);
    color: #fff;
    border-color: var(--mnw-brand-primary, #1a1a2e);
}

.mnw-map-filter-chip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mnw-map-filter-chip__count {
    font-size: 10px;
    opacity: 0.6;
    margin-left: auto;
    padding-left: 6px;
}


/* ═══════════════════════════════════════
   Map Controls
   ═══════════════════════════════════════ */

.mnw-map-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: mnwSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.mnw-map-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8eaef;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1a1a2e;
    padding: 0;
}

.mnw-map-control-btn:hover {
    background: var(--mnw-brand-primary, #1a1a2e);
    color: #fff;
    transform: scale(1.05);
}

.mnw-map-control-btn svg {
    width: 18px;
    height: 18px;
}


/* ═══════════════════════════════════════
   POI Side Panel (Left)
   ═══════════════════════════════════════ */

.mnw-map-poi-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    bottom: 16px;
    z-index: 10;
    width: 300px;
    display: flex;
    align-items: stretch;
    pointer-events: none;
    animation: mnwSlideRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}

.mnw-map-poi-panel__inner {
    flex: 1;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.05);
    border: 1px solid #e8eaef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mnw-map-poi-panel.collapsed .mnw-map-poi-panel__inner {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    border: none;
    box-shadow: none;
}

.mnw-map-poi-panel.collapsed {
    width: auto;
}

.mnw-map-poi-panel__toggle {
    position: absolute;
    top: 50%;
    right: -16px;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: #fff;
    border: 1px solid #e8eaef;
    border-left: none;
    border-radius: 0 10px 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 4px 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s;
    color: #6b7280;
    z-index: 2;
}

.mnw-map-poi-panel__toggle:hover {
    background: var(--mnw-brand-primary, #1a1a2e);
    color: #fff;
}

.mnw-map-poi-panel__toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mnw-map-poi-panel.collapsed .mnw-map-poi-panel__toggle {
    right: auto;
    left: 0;
    border-radius: 10px;
    border: 1px solid #e8eaef;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.mnw-map-poi-panel.collapsed .mnw-map-poi-panel__toggle svg {
    transform: rotate(0deg);
}

.mnw-map-poi-panel:not(.collapsed) .mnw-map-poi-panel__toggle svg {
    transform: rotate(180deg);
}

.mnw-map-poi-panel__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f1f3;
    flex-shrink: 0;
}

.mnw-map-poi-panel__title h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    padding: 0;
}

.mnw-map-poi-count {
    font-size: 11px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 100px;
}

.mnw-map-poi-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    padding: 8px 10px 12px;
}

.mnw-map-poi-list::-webkit-scrollbar { width: 4px; }
.mnw-map-poi-list::-webkit-scrollbar-track { background: transparent; }
.mnw-map-poi-list::-webkit-scrollbar-thumb { background: #e8eaef; border-radius: 2px; }

.mnw-map-poi-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.mnw-map-poi-item:hover {
    background: #f8f9fc;
    border-color: #e8eaef;
}

.mnw-map-poi-item.active {
    background: rgba(233, 69, 96, 0.08);
    border-color: var(--mnw-brand-accent, #e94560);
}

.mnw-map-poi-item__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mnw-map-poi-item__icon svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.mnw-map-poi-item__info {
    flex: 1;
    min-width: 0;
}

.mnw-map-poi-item__name {
    font-size: 12.5px;
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mnw-map-poi-item__meta {
    font-size: 10.5px;
    color: #9ca3af;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mnw-map-poi-item__distance {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════
   Custom Info Window
   ═══════════════════════════════════════ */

.mnw-map-infowindow {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    font-family: 'DM Sans', sans-serif;
    animation: mnwPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.mnw-map-infowindow__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.mnw-map-infowindow__name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
    line-height: 1.3;
}

.mnw-map-infowindow__address {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 10px;
}

.mnw-map-infowindow__actions {
    display: flex;
    gap: 8px;
}

.mnw-map-infowindow__btn {
    flex: 1;
    padding: 7px 0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    font-family: 'DM Sans', sans-serif;
}

.mnw-map-infowindow__btn--primary {
    background: var(--mnw-brand-primary, #1a1a2e);
    color: #fff;
}

.mnw-map-infowindow__btn--primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.mnw-map-infowindow__btn--secondary {
    background: #f8f9fc;
    color: #1a1a2e;
    border: 1px solid #e8eaef;
}

.mnw-map-infowindow__btn--secondary:hover {
    background: #e8eaef;
}


/* ═══════════════════════════════════════
   Google Maps Overrides
   ═══════════════════════════════════════ */

.mnw-map-widget .gm-style-iw-d { overflow: visible !important; }
.mnw-map-widget .gm-style-iw { padding: 0 !important; overflow: visible !important; }
.mnw-map-widget .gm-style-iw-c { padding: 0 !important; border-radius: 14px !important; box-shadow: 0 20px 60px rgba(0,0,0,0.15) !important; }
.mnw-map-widget .gm-style-iw-tc { display: none !important; }
.mnw-map-widget .gm-ui-hover-effect { top: 4px !important; right: 4px !important; }
.mnw-map-widget .gm-style .gm-style-mtc,
.mnw-map-widget .gm-style .gm-svpc,
.mnw-map-widget .gm-style .gm-fullscreen-control { display: none !important; }


/* ═══════════════════════════════════════
   No API Key Placeholder
   ═══════════════════════════════════════ */

.mnw-map-no-key {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-direction: column;
    gap: 12px;
    padding: 40px;
    text-align: center;
}

.mnw-map-no-key p {
    font-family: 'DM Sans', sans-serif;
    color: #6b7280;
    font-size: 14px;
    max-width: 360px;
    line-height: 1.6;
}

.mnw-map-no-key strong {
    color: #1a1a2e;
}

.mnw-map-no-key code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.mnw-map-no-key a {
    color: var(--mnw-brand-accent, #e94560);
    text-decoration: none;
    font-weight: 500;
}


/* ═══════════════════════════════════════
   Animations
   ═══════════════════════════════════════ */

@keyframes mnwSlideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mnwSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mnwSlideLeft {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes mnwSlideRight {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes mnwPopIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}


/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
    .mnw-map-widget {
        border-radius: 16px;
    }

    .mnw-map-header {
        left: 16px;
        max-width: calc(100% - 32px);
    }

    /* Side panel becomes bottom drawer on tablet/mobile */
    .mnw-map-poi-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 45%;
        flex-direction: column;
        animation: mnwSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
    }

    .mnw-map-poi-panel__inner {
        border-radius: 16px 16px 0 0;
    }

    .mnw-map-poi-panel__toggle {
        top: -16px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 48px;
        height: 28px;
        border-radius: 10px 10px 0 0;
        border: 1px solid #e8eaef;
        border-bottom: none;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    }

    .mnw-map-poi-panel__toggle svg {
        transform: rotate(-90deg) !important;
    }

    .mnw-map-poi-panel.collapsed .mnw-map-poi-panel__toggle svg {
        transform: rotate(90deg) !important;
    }

    .mnw-map-poi-panel.collapsed .mnw-map-poi-panel__toggle {
        left: 50%;
        right: auto;
        border-radius: 10px 10px 0 0;
    }

    .mnw-map-poi-panel.collapsed .mnw-map-poi-panel__inner {
        transform: translateY(100%);
        height: 0;
    }

    .mnw-map-poi-list {
        max-height: 200px;
    }

    .mnw-map-filters {
        flex-direction: row;
        top: auto;
        bottom: 16px;
        right: 16px;
        left: 16px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .mnw-map-filters::-webkit-scrollbar { display: none; }

    .mnw-map-controls {
        bottom: 56px;
    }

    /* Adjust filters when panel is visible */
    .mnw-map-widget:has(.mnw-map-poi-panel:not(.collapsed)) .mnw-map-filters {
        bottom: auto;
        top: 80px;
    }

    .mnw-map-widget:has(.mnw-map-poi-panel:not(.collapsed)) .mnw-map-controls {
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .mnw-map-widget {
        border-radius: 12px;
    }

    .mnw-map-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .mnw-map-header__logo {
        width: 36px;
        height: 36px;
    }

    .mnw-map-header__info h3 {
        font-size: 13px;
    }
}
