/* ================================================================
 *  MATEHETSz Map – Frontend Styles
 *  Clean, modern design inspired by shadcn/ui.
 *  Font: Open Sans via Google Fonts.
 * ============================================================= */

/* ─── Reset for our wrapper ────────────────────────────── */
#matehetsz-map-wrapper,
#matehetsz-map-wrapper *,
#matehetsz-map-wrapper *::before,
#matehetsz-map-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ─── Wrapper ──────────────────────────────────────────── */
#matehetsz-map-wrapper {
    display: flex;
    width: 100%;
    height: var(--map-height, 700px);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #0f172a;
    background: #ffffff;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* ─── Sidebar ──────────────────────────────────────────── */
#matehetsz-sidebar {
    flex: 0 0 380px;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    overflow: hidden;
}

/* ─── List View container (result count + cards) ──────── */
#matehetsz-map-wrapper .matehetsz-list-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ─── Title ────────────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-sidebar__title {
    font-family: 'Open Sans', sans-serif !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    padding: 24px 24px 0 !important;
    margin: 0 !important;
    color: #0f172a !important;
    letter-spacing: -0.01em;
    line-height: 1.3 !important;
}

/* ─── Search ───────────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-search {
    position: relative;
    padding: 18px 24px 0 !important;
    margin: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-search__icon {
    position: absolute;
    left: 36px;
    top: 65%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
}

#matehetsz-map-wrapper #matehetsz-search-input {
    width: 100% !important;
    height: 44px !important;
    padding: 0 14px 0 44px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 8px !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    background: #f1f5f9 !important;
    color: #0f172a !important;
    outline: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#matehetsz-map-wrapper #matehetsz-search-input:focus {
    background: #e8ecf1 !important;
    box-shadow: none !important;
}

#matehetsz-map-wrapper #matehetsz-search-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

/* ─── Category Badges ──────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-badges {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    padding: 16px 24px 0 !important;
    margin: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: auto !important;
    padding: 5px 10px !important;
    margin: 0 !important;
    border-radius: 5px !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border: 1px solid #0e1e52 !important;
    background: #0e1e52 !important;
    color: #ffffff !important;
    white-space: nowrap;
    line-height: 1.2 !important;
    letter-spacing: 0.01em;
}

#matehetsz-map-wrapper .matehetsz-badge:hover {
    opacity: 0.9;
}

#matehetsz-map-wrapper .matehetsz-badge:active {
    transform: scale(0.97);
}

#matehetsz-map-wrapper .matehetsz-badge.matehetsz-badge--inactive {
    background: #ffffff !important;
    border-color: #111827 !important;
    color: #111827 !important;
}

#matehetsz-map-wrapper .matehetsz-badge__dot {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ─── Result Count ─────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-result-count {
    padding: 18px 24px 0 !important;
    margin: 0 !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8 !important;
}

/* ─── Card List ────────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-card-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 0 24px !important;
    margin: 0 !important;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

/* Webkit scrollbar */
.matehetsz-card-list::-webkit-scrollbar {
    width: 4px;
}
.matehetsz-card-list::-webkit-scrollbar-track {
    background: transparent;
}
.matehetsz-card-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}
.matehetsz-card-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ─── Card ─────────────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    cursor: pointer;
    transition: background-color 0.15s ease;
    background: transparent;
}

#matehetsz-map-wrapper .matehetsz-card:last-child {
    border-bottom: none !important;
}

#matehetsz-map-wrapper .matehetsz-card:hover {
    background: #f8fafc !important;
}

#matehetsz-map-wrapper .matehetsz-card.matehetsz-card--active {
    background: #f1f5f9 !important;
}

#matehetsz-map-wrapper .matehetsz-card__header {
    display: flex !important;
    align-items: baseline !important;
    gap: 10px !important;
    padding: 0 !important;
    margin: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-card__dot {
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    position: relative;
    top: -1px;
}

#matehetsz-map-wrapper .matehetsz-card__title {
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.45 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-card__city {
    font-family: 'Open Sans', sans-serif !important;
    font-size: 13px !important;
    color: #64748b !important;
    font-weight: 400 !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-left: 20px !important;
    line-height: 1.4 !important;
}

/* ─── Detail View ──────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-detail-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 24px 24px !important;
    margin: 0 !important;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

#matehetsz-map-wrapper .matehetsz-detail__back {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: none !important;
    border: none !important;
    color: #64748b !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
    transition: color 0.15s ease;
}

#matehetsz-map-wrapper .matehetsz-detail__back:hover {
    color: #0f172a !important;
}

#matehetsz-map-wrapper .matehetsz-detail__back svg {
    flex-shrink: 0;
}

#matehetsz-map-wrapper .matehetsz-detail__content {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 24px !important;
    margin: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-detail__cats {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-detail__cat-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 26px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #fff !important;
    white-space: nowrap;
}

#matehetsz-map-wrapper .matehetsz-detail__title {
    font-family: 'Open Sans', sans-serif !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.35 !important;
    letter-spacing: -0.01em;
    margin: 0 !important;
    padding: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-detail__address {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    color: #475569 !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#matehetsz-map-wrapper .matehetsz-detail__address svg {
    flex-shrink: 0;
    color: #94a3b8;
}

/* ─── Map ──────────────────────────────────────────────── */
.matehetsz-map {
    flex: 1 1 auto;
    min-width: 0;
}

/* ─── Cluster icon ─────────────────────────────────────── */
.matehetsz-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #1e293b;
    color: #ffffff;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 1px 6px rgb(0 0 0 / 0.2), 0 0 0 3px #ffffff;
    border: none;
}

/* ─── Circle marker ────────────────────────────────────── */
.matehetsz-marker {
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    box-shadow: 0 1px 5px rgb(0 0 0 / 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.matehetsz-marker:hover {
    transform: scale(1.3);
    z-index: 9999 !important;
}

.matehetsz-marker--active {
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08), 0 2px 8px rgb(0 0 0 / 0.25);
}

/* ─── Leaflet zoom control override ────────────────────── */
#matehetsz-map-wrapper .leaflet-control-zoom {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.06) !important;
}

#matehetsz-map-wrapper .leaflet-control-zoom a {
    font-family: 'Open Sans', sans-serif;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px;
    color: #475569;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0 !important;
}

#matehetsz-map-wrapper .leaflet-control-zoom a:hover {
    background: #f8fafc;
    color: #0f172a;
}

#matehetsz-map-wrapper .leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

/* ─── Leaflet attribution – subtle ─────────────────────── */
#matehetsz-map-wrapper .leaflet-control-attribution {
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.75) !important;
    padding: 2px 6px;
}

#matehetsz-map-wrapper .leaflet-control-attribution a {
    color: #64748b;
}

/* ─── Loading state ────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-loading {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100%;
    color: #94a3b8 !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ─── Empty state ──────────────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-empty {
    text-align: center;
    padding: 48px 24px !important;
    margin: 0 !important;
    color: #94a3b8 !important;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
}

/* ─── Detail rows (contact) ────────────────────────────── */
#matehetsz-map-wrapper .matehetsz-detail__row {
    font-size: 14px !important;
    color: #475569 !important;
    padding-left: 22px !important;
    overflow-wrap: anywhere;
}

#matehetsz-map-wrapper .matehetsz-detail__row a,
#matehetsz-map-wrapper .matehetsz-detail__readmorebutton a {
    color: #2e6fd8 !important;
}

#matehetsz-map-wrapper .matehetsz-detail__readmorebutton a {
    font-weight: 600 !important;
}

/* ─── Marker letter (P / T / M) + per-type shape ────────── */
.matehetsz-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.matehetsz-marker.matehetsz-marker--tt {
    border-radius: 5px;
}

.matehetsz-marker.matehetsz-marker--muh {
    border-radius: 50% 50% 50% 4px;
}

#matehetsz-map-wrapper .matehetsz-badge__dot--letter {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

/* ─── Full width ([matehetsz_map fullwidth="1"]) ────────── */
/* --mtsz-sbw = scrollbar width, set by map-frontend.js (100vw includes it). */
#matehetsz-map-wrapper.matehetsz-fullwidth {
    --mtsz-vw: calc(100vw - var(--mtsz-sbw, 0px));
    width: var(--mtsz-vw) !important;
    max-width: var(--mtsz-vw) !important;
    margin-left: calc(50% - var(--mtsz-vw) / 2) !important;
    margin-right: calc(50% - var(--mtsz-vw) / 2) !important;
    border-left: 0;
    border-right: 0;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    #matehetsz-map-wrapper {
        flex-direction: column;
        height: auto;
    }

    #matehetsz-sidebar {
        flex: none;
        max-width: 100%;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .matehetsz-map {
        min-height: 350px;
        height: 55vh;
    }

    #matehetsz-map-wrapper .matehetsz-sidebar__title {
        padding: 20px 20px 0 !important;
        font-size: 18px !important;
    }

    #matehetsz-map-wrapper .matehetsz-search {
        padding: 14px 20px 0 !important;
    }

    #matehetsz-map-wrapper .matehetsz-badges {
        padding: 12px 20px 0 !important;
    }

    #matehetsz-map-wrapper .matehetsz-result-count {
        padding: 14px 20px 0 !important;
    }

    #matehetsz-map-wrapper .matehetsz-card-list {
        padding: 8px 0 20px !important;
    }

    #matehetsz-map-wrapper .matehetsz-card {
        padding: 14px 20px !important;
    }

    #matehetsz-map-wrapper .matehetsz-detail-view {
        padding: 20px !important;
    }
}
