/* ==========================================================================
   Regional Group Finder — adaptive Design System styles
   Scoped under .tx-q4u-regionalgroupfinder
   ========================================================================== */

/* --- Search card -------------------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-search-card {
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.04);
    border: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.08);
    border-radius: var(--bs-border-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 575.98px) {
    .tx-q4u-regionalgroupfinder .rgf-search-card {
        padding: 1rem;
    }
}

/* --- Results panel (scrollable in split layout) ------------------------- */
.tx-q4u-regionalgroupfinder .rgf-results-panel {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.tx-q4u-regionalgroupfinder .rgf-results-panel::-webkit-scrollbar {
    width: 6px;
}

.tx-q4u-regionalgroupfinder .rgf-results-panel::-webkit-scrollbar-thumb {
    background: rgba(var(--bs-emphasis-color-rgb), 0.15);
    border-radius: 3px;
}

@media (max-width: 991.98px) {
    .tx-q4u-regionalgroupfinder .rgf-results-panel {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
}

/* --- Card container (matches shop checkout card pattern) ---------------- */
.tx-q4u-regionalgroupfinder .rgf-card {
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.04);
    border: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.08);
    border-radius: var(--bs-border-radius);
    margin-bottom: 1rem;
}

.tx-q4u-regionalgroupfinder .rgf-card__header {
    background: rgba(var(--bs-emphasis-color-rgb), 0.03);
    border-bottom: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.08);
    border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
    padding: 0.75rem 1.25rem;
}

.tx-q4u-regionalgroupfinder .rgf-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--bs-body-color);
}

.tx-q4u-regionalgroupfinder .rgf-card__body {
    padding: 1.25rem;
}

@media (max-width: 575.98px) {
    .tx-q4u-regionalgroupfinder .rgf-card__header {
        padding: 0.625rem 1rem;
    }
    .tx-q4u-regionalgroupfinder .rgf-card__body {
        padding: 1rem;
    }
}

/* --- Result item (inside card body) ------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-result-item {
    padding: 0.75rem 1rem;
    border-radius: var(--bs-border-radius);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.tx-q4u-regionalgroupfinder .rgf-result-item + .rgf-result-item {
    border-top: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.06);
}

.tx-q4u-regionalgroupfinder .rgf-result-item:hover {
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.04);
}

.tx-q4u-regionalgroupfinder .rgf-result-item:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Active state (map marker clicked) */
.tx-q4u-regionalgroupfinder .rgf-result-item--active {
    animation: rgf-pulse 0.6s ease;
}

@keyframes rgf-pulse {
    0%   { background-color: transparent; }
    30%  { background-color: rgba(var(--bs-emphasis-color-rgb), 0.1); }
    100% { background-color: transparent; }
}

/* --- Map container ------------------------------------------------------ */
.tx-q4u-regionalgroupfinder .rgf-map-wrap {
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    border: 1px solid rgba(var(--bs-emphasis-color-rgb), 0.08);
}

.tx-q4u-regionalgroupfinder .rgf-map {
    height: 520px;
    width: 100%;
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.04);
}

@media (max-width: 991.98px) {
    .tx-q4u-regionalgroupfinder .rgf-map {
        height: 300px;
    }
}

@media (max-width: 575.98px) {
    .tx-q4u-regionalgroupfinder .rgf-map {
        height: 250px;
    }
}

/* --- Map consent placeholder -------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-map-consent {
    height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.04);
    color: var(--bs-secondary-color);
    padding: 2rem;
}

@media (max-width: 991.98px) {
    .tx-q4u-regionalgroupfinder .rgf-map-consent {
        height: 200px;
    }
}

.tx-q4u-regionalgroupfinder .rgf-map-consent svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* --- Distance badge ----------------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-distance {
    font-size: 0.8125rem;
    font-weight: 600;
}

/* --- Mobile map toggle -------------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-map-toggle {
    margin-bottom: 1rem;
}

/* --- No results --------------------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--bs-secondary-color);
}

.tx-q4u-regionalgroupfinder .rgf-no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* --- Results reveal animation ------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-results-area {
    animation: rgf-reveal 0.3s ease-out;
}

@keyframes rgf-reveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Result detail & contact -------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-result-detail {
    line-height: 1.6;
}

.tx-q4u-regionalgroupfinder .rgf-result-contact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tx-q4u-regionalgroupfinder .rgf-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.tx-q4u-regionalgroupfinder .rgf-contact-link:hover {
    text-decoration: underline;
}

.tx-q4u-regionalgroupfinder .rgf-contact-link .bi {
    opacity: 0.6;
    flex-shrink: 0;
}

/* --- Action buttons row ------------------------------------------------- */
.tx-q4u-regionalgroupfinder .rgf-result-actions {
    padding-top: 0.25rem;
}

/* --- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .tx-q4u-regionalgroupfinder .rgf-result-item {
        transition: none;
    }
    .tx-q4u-regionalgroupfinder .rgf-result-item--active {
        animation: none;
        background-color: rgba(var(--bs-emphasis-color-rgb), 0.1);
    }
    .tx-q4u-regionalgroupfinder .rgf-results-area {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Map labels — tooltip (hover/focus) and popup (click)
   ═══════════════════════════════════════════════════════════════════════
   Both are scoped by the className set in POPUP_OPTIONS / TOOLTIP_OPTIONS.
   Leaflet ships hardcoded #fff / #222 chrome, which is a bright card in dark
   mode, so every colour is re-stated from Bootstrap tokens; those already
   flip with [data-bs-theme] and need no separate dark-mode block. */

/* --- Tooltip: the quick label on hover and keyboard focus --------------- */
.rgf-tooltip.leaflet-tooltip {
    padding: 0.375rem 0.625rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
    box-shadow: 0 0.125rem 0.5rem rgba(var(--bs-emphasis-color-rgb), 0.15);
    font-size: 0.8125rem;
    line-height: 1.35;
    white-space: nowrap;
}

.rgf-tooltip .rgf-tooltip__name {
    font-weight: 600;
}

/* Second line, so name and metadata do not read as one run-on string. */
.rgf-tooltip .rgf-tooltip__meta {
    display: block;
    color: var(--bs-secondary-color);
}

/* The callout arrow is a border triangle — it has to be recoloured
   separately or it stays Leaflet's white and detaches in dark mode. */
.rgf-tooltip.leaflet-tooltip-top::before {
    border-top-color: var(--bs-border-color);
}

/* --- Popup: the detail view on click ------------------------------------ */
.rgf-popup .leaflet-popup-content-wrapper {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 0.25rem 1rem rgba(var(--bs-emphasis-color-rgb), 0.18);
}

.rgf-popup .leaflet-popup-tip {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    box-shadow: none;
}

/* Width follows the content: no min-width, and room for the close button so
   a long name never runs underneath it. */
.rgf-popup .leaflet-popup-content {
    margin: 0.625rem 2rem 0.625rem 0.875rem;
    min-width: 0;
    font-size: 0.875rem;
    line-height: 1.4;
}

.rgf-popup .rgf-popup__name {
    margin: 0;
    font-weight: 600;
}

.rgf-popup .rgf-popup__meta {
    margin: 0.125rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
}

/* Leaflet forces `.leaflet-container a { color: #0078A8 }`, which overrides
   the theme link colour inside popups — restate it. */
.rgf-popup .rgf-popup__link,
.rgf-popup .rgf-popup__link:hover {
    display: inline-block;
    margin-top: 0.375rem;
    color: var(--bs-link-color);
}

/* Leaflet styles this as `.leaflet-container a.leaflet-popup-close-button`
   (0,2,1) — a plain `.rgf-popup .leaflet-popup-close-button` loses to it and
   the button silently stays Leaflet's #757575. Match the container+element
   shape rather than reaching for !important. */
.leaflet-container .rgf-popup a.leaflet-popup-close-button {
    color: var(--bs-secondary-color);
}

.leaflet-container .rgf-popup a.leaflet-popup-close-button:hover,
.leaflet-container .rgf-popup a.leaflet-popup-close-button:focus-visible {
    color: var(--bs-body-color);
}

.leaflet-container .rgf-popup a.leaflet-popup-close-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: var(--bs-border-radius-sm);
}

/* --- Action buttons: one source for icon↔label spacing ------------------
   The two buttons in a result card get their icons from different systems:
   "Zur Website" is decorated by q4u_base's `.btn[target="_blank"]::before`
   (t3bootstrap icon font, which brings `gap: .5em`), while the vCard button
   carries an inline SVG that used a Bootstrap `me-1` utility. Two mechanisms,
   two values — measured 13px against 4px. Declaring the gap here for every
   button in the row and dropping the per-icon margins means the spacing has a
   single origin, so it cannot drift again when one of the two is touched. */
.tx-q4u-regionalgroupfinder .rgf-result-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}


/* --- Map markers ---------------------------------------------------------
   Pins get a ground shadow so they read as standing ON the map instead of
   floating over it — and it separates the muted "nearby" pin from tiles of
   a similar grey (WCAG 1.4.11 support on top of the white stroke). */
.rgf-marker-group svg,
.rgf-marker-search svg {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

/* Markers are keyboard-focusable (Leaflet's default keyboard:true). The UA
   outline hugs the transparent icon box and disappears against busy tiles —
   restate it in theme colour, same pattern as the result cards above. */
.tx-q4u-regionalgroupfinder .leaflet-marker-icon:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* The permanent name label on the exact match. It captions the pin rather
   than answering a hover, so it is bolder and tighter than the hover
   tooltip; colours are inherited from .rgf-tooltip above (theme-aware). */
.rgf-tooltip.rgf-tooltip--permanent {
    padding: 0.25rem 0.5rem;
    font-weight: 600;
}
