/* =========================================================
   [story_map_v4] – Story tags (stories_tag) additions.
   Loaded after map-css.css, only where the v4 shortcode is used.
   ========================================================= */

/* ---------- Top bar: grouped "Tags" dropdown ---------- */

.map_v4 .ul_dd.has_value .placeholder {
    color: #520556;
    font-weight: bold;
}

.map_v4 .ul_dd.is_open .dd_sub {
    display: block;
}

.map_v4 .dd_sub.dd_sub_grouped {
    width: 340px;
    height: auto;
    max-height: 420px;
    padding: 5px 12px 0;
}

.map_v4 .dd_group + .dd_group {
    border-top: 1px solid #eeeeee;
}

.map_v4 .dd_group {
    padding: 8px 0 6px;
}

.map_v4 .dd_group_title {
    font-size: 11px;
    line-height: 1.3;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #520556;
    margin-bottom: 6px;
}

.map_v4 .dd_sub_grouped .dd_item {
    margin-bottom: 4px;
}

.map_v4 .reset_tags {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #eeeeee;
    padding: 8px 0 10px;
    font-size: 12px;
    color: #004b85;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
}

.map_v4 .reset_tags i {
    margin-right: 7px;
}

/* selected tag chips under the dropdown (same look as .aoi_item) */
.map_v4 .selected_tags {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    row-gap: 3px;
    width: max-content;
    max-width: 90vw;
}

.map_v4 .tag_item {
    font-size: 11px;
    line-height: 1.2;
    margin-right: 10px;
    white-space: nowrap;
    font-style: italic;
    color: #999;
    cursor: pointer;
}

.map_v4 .tag_item:hover {
    color: #520556;
}

/* ---------- Story footer: tags (left) + Share (right) ---------- */

.map_v4 .story_footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.map_v4 .story_footer .share {
    margin: 0 0 0 auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.map_v4 .story_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.map_v4 .story_tag_link,
.map_v4 .story_tag_link:visited {
    display: inline-block;
    font-size: 12px;
    line-height: 1.3;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f3eef4;
    color: #520556;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color .2s, color .2s;
}

.map_v4 .story_tag_link:hover,
.map_v4 .story_tag_link:focus {
    background: #520556;
    color: #fff;
}

@media (max-width: 767px) {
    .map_v4 .dd_sub.dd_sub_grouped {
        width: 280px;
        max-height: 60vh;
    }
    .map_v4 .m_ctrl_group.hide_on_org {
        margin-bottom: 20px;
    }
}

@media (max-width: 479px) {
    .map_v4 .story_footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .map_v4 .story_footer .share {
        margin-left: 0;
    }
}
