/**
 * Inspired Projects Map – Frontend CSS v1.4.0
 * The wrapper exposes --ipm-accent (set from the "Accent / Selected Color"
 * setting) for the active filter tab, list titles, and list highlight.
 */

/* Wrapper */
.ipm-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

/* =============================================
 * Category Filter Bar – sits above the map
 * ============================================= */

.ipm-filter-bar {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 0;
    overflow: hidden;
}

.ipm-filter-scroll {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 6px;
    gap: 4px;
}

/* Individual tab buttons */
.ipm-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    line-height: 1.3;
}

.ipm-filter-tab:hover {
    background: #e8e8e8;
    border-color: #bbb;
    color: #222;
}

.ipm-filter-tab.ipm-filter-active {
    background: var(--ipm-accent, #00263E);
    border-color: var(--ipm-accent, #00263E);
    color: #fff;
}

.ipm-filter-tab.ipm-filter-active:hover {
    background: var(--ipm-accent, #00263E);
    border-color: var(--ipm-accent, #00263E);
    filter: brightness(1.15);
}

/* Count badge */
.ipm-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    background: rgba(0, 0, 0, 0.08);
    color: #555;
}

.ipm-filter-active .ipm-tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* =============================================
 * Map Container
 * ============================================= */

.ipm-projects-map {
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Prevent theme CSS from hiding or mangling Google Maps controls */
.ipm-projects-map button,
.ipm-projects-map a,
.ipm-projects-map img,
.ipm-projects-map div {
    max-width: none !important;
    box-sizing: content-box;
}

.ipm-projects-map .gm-control-active,
.ipm-projects-map .gmnoprint,
.ipm-projects-map .gm-style-mtc,
.ipm-projects-map .gm-bundled-control {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.ipm-projects-map .gm-control-active {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    line-height: normal !important;
    font-size: inherit !important;
}

/* When no filter bar (and no business list layout), give the map full border radius */
.ipm-wrapper:not(:has(.ipm-filter-bar)):not(:has(.ipm-layout)) .ipm-projects-map {
    border-radius: 6px;
}

/* When no filter bar but a business list is present, round the map's outer corners */
.ipm-wrapper:not(:has(.ipm-filter-bar)) .ipm-layout-left .ipm-projects-map {
    border-radius: 0 6px 6px 0;
}

.ipm-wrapper:not(:has(.ipm-filter-bar)) .ipm-layout-right .ipm-projects-map {
    border-radius: 6px 0 0 6px;
}

.ipm-wrapper:not(:has(.ipm-filter-bar)) .ipm-layout-below .ipm-projects-map {
    border-radius: 6px 6px 0 0;
}

/* =============================================
 * Info Window
 * ============================================= */

.ipm-info-window {
    max-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    padding: 2px 0;
}

.ipm-info-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #1a1a1a;
}

.ipm-info-cats {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.ipm-info-address {
    color: #555;
    margin-bottom: 6px;
}

.ipm-info-desc {
    color: #666;
    margin-bottom: 8px;
    font-size: 12px;
}

.ipm-info-links {
    padding-top: 6px;
    border-top: 1px solid #eee;
}

.ipm-info-link {
    display: inline-block;
    color: #2271b1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-right: 12px;
}

.ipm-info-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* =============================================
 * Business List – clickable list of locations
 * ============================================= */

.ipm-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.ipm-layout-left {
    flex-direction: row;
}

.ipm-layout-right {
    flex-direction: row-reverse;
}

.ipm-layout-below {
    flex-direction: column;
}

.ipm-list {
    background: #f5f5f5;
    border: 1px solid #ddd;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ipm-layout-left .ipm-list,
.ipm-layout-right .ipm-list {
    flex: 0 0 280px;
    width: 280px;
}

.ipm-layout-left .ipm-list {
    border-right: none;
    border-radius: 6px 0 0 6px;
}

.ipm-layout-right .ipm-list {
    border-left: none;
    border-radius: 0 6px 6px 0;
}

.ipm-layout-below .ipm-list {
    border-top: none;
    border-radius: 0 0 6px 6px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1px;
    max-height: 320px;
}

/* Map keeps its share of the row */
.ipm-layout-left .ipm-projects-map,
.ipm-layout-right .ipm-projects-map {
    flex: 1 1 auto;
    min-width: 0;
}

.ipm-layout-left .ipm-projects-map {
    border-radius: 0 0 6px 0;
}

.ipm-layout-right .ipm-projects-map {
    border-radius: 0 0 0 6px;
}

.ipm-layout-below .ipm-projects-map {
    border-radius: 0;
}

/* Individual list entries */
.ipm-list-item {
    background: #fff;
    padding: 14px 16px;
    margin: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ipm-layout-below .ipm-list-item {
    margin: 6px;
}

.ipm-list-item:hover,
.ipm-list-item:focus {
    background: #fdfdfd;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
    outline: none;
}

.ipm-list-item.ipm-list-active {
    box-shadow: inset 3px 0 0 var(--ipm-accent, #00263E), 0 1px 6px rgba(0, 0, 0, 0.15);
}

.ipm-list-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--ipm-accent, #00263E);
    line-height: 1.3;
}

.ipm-list-item:hover .ipm-list-title {
    text-decoration: underline;
}

.ipm-list-address {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}

/* Phone / email / website links under the address */
.ipm-list-contacts {
    margin-top: 6px;
}

.ipm-list-contact {
    display: block;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ipm-accent, #00263E);
    text-decoration: none;
    word-break: break-word;
}

.ipm-list-contact:hover,
.ipm-list-contact:focus {
    text-decoration: underline;
    color: var(--ipm-accent, #00263E);
}

/* =============================================
 * Mobile Responsive
 * ============================================= */

@media (max-width: 768px) {
    /* Stack the side list below the map on small screens */
    .ipm-layout-left,
    .ipm-layout-right {
        flex-direction: column;
    }

    .ipm-layout-left .ipm-list,
    .ipm-layout-right .ipm-list {
        flex: 1 1 auto;
        width: auto;
        max-height: 280px !important;
        border: 1px solid #ddd;
        border-top: none;
        border-radius: 0 0 6px 6px;
    }

    .ipm-layout-left .ipm-projects-map,
    .ipm-layout-right .ipm-projects-map {
        border-radius: 0;
    }

    .ipm-filter-tab {
        padding: 7px 12px;
        font-size: 12px;
    }

    .ipm-tab-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        padding: 0 4px;
    }

    .ipm-filter-scroll {
        padding: 6px 4px;
        gap: 3px;
    }

    .ipm-info-window {
        max-width: 240px;
        font-size: 12px;
    }

    .ipm-info-title {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ipm-filter-tab {
        padding: 6px 10px;
        font-size: 11px;
    }

    .ipm-info-window {
        max-width: 200px;
    }
}
