/*
 * MS DMH Treatment Center Map — Frontend Styles
 *
 * REGION COLORS are no longer set here. They are injected
 * inline by PHP via wp_add_inline_style() using the values
 * saved in the WordPress admin. See ms-dmh-map.php.
 *
 * To override any style from your theme, target .ms-dmh-map:
 *   .ms-dmh-map .info-col { width: 360px; }
 */

.ms-dmh-map,
.ms-dmh-map * {
    box-sizing: border-box;
}

.ms-dmh-map {
    font-family: 'Source Sans 3', sans-serif;
    color: #1c1c2e;
    display: flex;
    flex-direction: column;
}

/* ── Layout ──────────────────────────────────── */
.ms-dmh-map .layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.ms-dmh-map .map-col {
    flex: 1 1 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
}

/* ── SVG Map ─────────────────────────────────── */
#ms-map {
    width: 100%;
    max-width: 480px;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 18px rgba(0,0,0,.13));
}

.ms-dmh-map .county {
    stroke: #fff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: filter .12s, stroke-width .12s;
}
.ms-dmh-map .county:hover {
    stroke: rgba(0,0,0,.45);
    stroke-width: 1.0;
    filter: brightness(.82) saturate(1.4);
}
.ms-dmh-map .county.active {
    stroke: #1c1c2e;
    stroke-width: 1.4;
    filter: brightness(.72) saturate(1.6);
}

/* ── Tooltip ─────────────────────────────────── */
#tooltip {
    position: fixed;
    pointer-events: none;
    background: #1c1c2e;
    color: #fff;
    padding: 6px 11px 7px;
    border-radius: 4px;
    font-size: .76rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 9999;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity .09s, transform .09s;
    box-shadow: 0 3px 12px rgba(0,0,0,.28);
}
#tooltip.show {
    opacity: 1;
    transform: translateY(0);
}
#tooltip small {
    display: block;
    font-weight: 300;
    opacity: .65;
    font-size: .68rem;
    margin-top: 1px;
}

/* ── Info sidebar ────────────────────────────── */
.ms-dmh-map .info-col {
    flex: 0 0 320px;
    width: 320px;
    background: #ffffff;
    border-left: 1px solid #ddd8d0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(100vh - 40px);
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.ms-dmh-map .info-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px;
    text-align: center;
    gap: 12px;
}
.ms-dmh-map .info-placeholder svg { opacity: .15; }
.ms-dmh-map .info-placeholder p {
    font-size: .83rem;
    line-height: 1.6;
    color: #aaa;
}

#info-content { display: none; flex-direction: column; }
#info-content.on { display: flex; }

.ms-dmh-map .itop {
    padding: 16px 18px 13px;
    background: #1c1c2e;
    color: #fff;
}
.ms-dmh-map .cname {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}
.ms-dmh-map .rbadge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .6;
}
.ms-dmh-map .rdot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ms-dmh-map .ibody {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Counties served box */
.ms-dmh-map .served {
    background: #f4f1ec;
    border-radius: 5px;
    padding: 10px 13px;
    border-left: 3px solid #ddd8d0;
}
.ms-dmh-map .served label {
    display: block;
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 600;
    color: #bbb;
    margin-bottom: 4px;
}
.ms-dmh-map .served p {
    font-size: .78rem;
    line-height: 1.6;
    color: #555;
}

/* Center card */
.ms-dmh-map .card {
    border: 1px solid #ddd8d0;
    border-radius: 7px;
    overflow: hidden;
}
.ms-dmh-map .card-head {
    padding: 10px 14px 8px;
    background: #faf8f5;
    border-bottom: 1px solid #ddd8d0;
}
.ms-dmh-map .card-head h3 {
    font-family: 'Libre Baskerville', serif;
    font-size: .92rem;
    font-weight: 700;
    color: #1c1c2e;
    line-height: 1.3;
    margin: 0;
}
.ms-dmh-map .card-head .note {
    font-size: .71rem;
    color: #aaa;
    font-style: italic;
    margin-top: 2px;
}
.ms-dmh-map .card-body {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .78rem;
    color: #444;
    line-height: 1.5;
}
.ms-dmh-map .irow {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}
.ms-dmh-map .irow svg {
    flex-shrink: 0;
    margin-top: 2px;
    opacity: .45;
}
.ms-dmh-map .irow a {
    color: #bf3030;
    text-decoration: none;
    word-break: break-all;
    font-weight: 500;
}
.ms-dmh-map .irow a:hover { text-decoration: underline; }

/* Close button */
.ms-dmh-map .cbtn {
    margin: 0 18px 14px;
    padding: 8px;
    background: transparent;
    border: 1px solid #ddd8d0;
    border-radius: 4px;
    font-family: inherit;
    font-size: .74rem;
    cursor: pointer;
    color: #aaa;
    transition: all .13s;
    letter-spacing: .03em;
}
.ms-dmh-map .cbtn:hover {
    background: #ede9e3;
    color: #1c1c2e;
    border-color: #c4bdb4;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 800px) {
    .ms-dmh-map .layout { flex-direction: column; }
    .ms-dmh-map .info-col {
        flex: none;
        width: 100%;
        max-height: none;
        position: static;
        border-left: none;
        border-top: 1px solid #ddd8d0;
    }
}
