/* [ss_distributors] - map + filterable list. Scoped under .ssd; colours follow the Industrial theme. */
.ssd {
    --ssd-brand: #004c90;
    --ssd-brand-dark: #003a6e;
    --ssd-brand-soft: #e6eef7;
    --ssd-hq: #d9261f; /* logo red */
    --ssd-hq-dark: #b51e18;
    --ssd-selected: #d9261f; /* clicked countries/markers: logo red */
    --ssd-selected-dark: #b51e18;
    --ssd-text-muted: #6b7280;
    --ssd-border: #dfe3e8;
    --ssd-bg-soft: #f5f7fa;
    --ssd-radius: 4px;
    --ssd-height: 560px;
    position: relative;
    z-index: 0;
    margin: 0 0 40px;
    font-size: 15px;
    line-height: 1.5;
}
.ssd *, .ssd *::before, .ssd *::after { box-sizing: border-box; }

/* Filters */
.ssd-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}
.ssd-filters__search {
    position: relative;
    flex: 1 1 260px;
    margin: 0;
}
.ssd-filters__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--ssd-text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}
.ssd-filters input[type="search"],
.ssd-filters select {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--ssd-border);
    border-radius: var(--ssd-radius);
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: 15px;
    line-height: 42px;
}
.ssd-filters input[type="search"] { padding-left: 38px; }
.ssd-filters input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.ssd-filters select {
    flex: 0 1 220px;
    min-width: 160px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
.ssd-filters input:focus,
.ssd-filters select:focus,
.ssd-filters__reset:focus-visible,
.ssd-card__map:focus-visible {
    outline: 2px solid var(--ssd-brand);
    outline-offset: 1px;
    border-color: var(--ssd-brand);
}
.ssd-filters__reset {
    height: 44px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--ssd-border);
    border-radius: var(--ssd-radius);
    background: #fff;
    color: var(--ssd-brand);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ssd-filters__reset:hover { background: var(--ssd-brand-soft); border-color: var(--ssd-brand); }

/* Layout */
.ssd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
    gap: 24px;
    align-items: start;
}
.ssd-map {
    height: var(--ssd-height);
    border: 1px solid var(--ssd-border);
    border-radius: var(--ssd-radius);
    background: #f3f6f9;
    overflow: hidden;
    isolation: isolate;
}
.ssd-map .leaflet-pane { z-index: 400; }
.ssd-map .leaflet-top, .ssd-map .leaflet-bottom { z-index: 800; }
.ssd-map .leaflet-container { font: inherit; font-size: 13px; background: #f3f6f9; }
.ssd-map .leaflet-container img { max-width: none !important; height: auto; }
.ssd-map .leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.75); }
.ssd-map .leaflet-bar a { color: var(--ssd-brand); }

/* Panel / list */
.ssd-panel {
    display: flex;
    flex-direction: column;
    max-height: var(--ssd-height);
    min-height: 0;
}
.ssd-panel__summary {
    flex: 0 0 auto;
    margin: 0 0 12px;
    color: var(--ssd-text-muted);
    font-size: 14px;
}
.ssd-panel__summary strong { color: var(--ssd-brand); font-size: 16px; }
.ssd-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}
.ssd-group { margin: 0 0 22px; }
.ssd-group__title {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 0 10px;
    padding: 6px 0;
    background: #fff;
    border-bottom: 2px solid var(--ssd-brand);
    color: var(--ssd-brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.ssd--flat .ssd-group__title { display: none; }
.ssd-group--hq .ssd-group__title { border-color: var(--ssd-hq); color: var(--ssd-hq); }

/* Card */
.ssd-card {
    position: relative;
    margin: 0 0 10px;
    padding: 14px 16px 14px 18px;
    border: 1px solid var(--ssd-border);
    border-left: 4px solid var(--ssd-brand);
    border-radius: var(--ssd-radius);
    background: #fff;
    transition: box-shadow .15s, border-color .15s;
}
.ssd-card:hover { border-color: var(--ssd-brand); border-left-color: var(--ssd-brand); box-shadow: 0 4px 16px rgba(0, 76, 144, .10); }
.ssd-card.is-active { border-color: var(--ssd-brand); box-shadow: 0 0 0 2px var(--ssd-brand-soft), 0 6px 20px rgba(0, 76, 144, .18); }
.ssd-card--hq { border-left-color: var(--ssd-hq); background: var(--ssd-bg-soft); }
.ssd-card--hq:hover, .ssd-card--hq.is-active { border-color: var(--ssd-hq); box-shadow: 0 4px 16px rgba(217, 38, 31, .12); }
/* position/z-index reset: the theme styles every <header> as `position:relative; z-index:10`,
   which would lift card heads above the sticky group title. */
.ssd-card__head { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 8px; position: static; z-index: auto; }
.ssd-card__flags { display: flex; flex: 0 0 auto; gap: 4px; padding-top: 2px; }
.ssd-card__flags img, .ssd-card__globe {
    display: block;
    width: 28px;
    height: 21px;
    border: 1px solid var(--ssd-border);
    border-radius: 2px;
    object-fit: cover;
}
.ssd-card__globe { padding: 1px; fill: none; stroke: var(--ssd-brand); stroke-width: 1.6; background: var(--ssd-brand-soft); }
.ssd-card__heading { min-width: 0; }
.ssd-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}
.ssd-card__where { margin: 2px 0 0; color: var(--ssd-text-muted); font-size: 13px; }
.ssd-card__types { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.ssd-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 2px 10px 2px 8px;
    border-radius: 999px;
    background: var(--ssd-bg-soft);
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}
.ssd-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ssd-brand); }
.ssd-tag--equipment::before { background: #247390; }
.ssd-tag--parts::before { background: #d97706; }
.ssd-card__contacts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 14px;
    margin: 0;
    font-size: 14px;
}
.ssd-card__contacts > div { display: contents; }
.ssd-card__contacts dt { margin: 0; color: var(--ssd-text-muted); font-weight: 400; }
.ssd-card__contacts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ssd-card__contacts a { color: var(--ssd-brand); text-decoration: none; }
.ssd-card__contacts a:hover { text-decoration: underline; }
.ssd-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.ssd-card__actions-label { color: var(--ssd-text-muted); font-size: 13px; }
.ssd-card__map {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--ssd-border);
    border-radius: var(--ssd-radius);
    background: #fff;
    color: var(--ssd-brand);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ssd-card__map svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.ssd-card__map:hover { background: var(--ssd-brand-soft); border-color: var(--ssd-brand); }
.ssd-empty {
    margin: 0;
    padding: 24px 16px;
    border: 1px dashed var(--ssd-border);
    border-radius: var(--ssd-radius);
    color: var(--ssd-text-muted);
    text-align: center;
}

/* Country areas - SVG paths whose colours here override Leaflet's presentation attributes.
   Selectors carry `.leaflet-pane path` to outrank leaflet.css's pointer-events rule. */
.ssd-map .leaflet-pane path.ssd-area {
    fill: transparent;
    stroke: none;
    pointer-events: none;
    transition: fill .15s, fill-opacity .15s;
}
.ssd-map .leaflet-pane path.ssd-area--hq,
.ssd-map .leaflet-pane path.ssd-area--direct,
.ssd-map .leaflet-pane path.ssd-area--regional { pointer-events: auto; cursor: pointer; }
/* Grey land, white borders, no raster tiles. Countries covered through a whole
   continent get the same blue as directly covered ones (the client's choice; the
   tooltip still says "Region: ..."). */
.ssd-map .leaflet-pane path.ssd-area { fill: #dce2e9; fill-opacity: 1; stroke: #fff; stroke-width: .7; stroke-opacity: 1; }
.ssd-map .leaflet-pane path.ssd-area--direct,
.ssd-map .leaflet-pane path.ssd-area--regional { fill: var(--ssd-brand); }
.ssd-map .leaflet-pane path.ssd-area--direct:hover,
.ssd-map .leaflet-pane path.ssd-area--regional:hover { fill: var(--ssd-brand-dark); }
/* Selected countries turn logo red (the client's choice: dark blue barely stood out). */
.ssd-map .leaflet-pane path.ssd-area--direct.is-active,
.ssd-map .leaflet-pane path.ssd-area--regional.is-active { fill: var(--ssd-selected); }
.ssd-map .leaflet-pane path.ssd-area.is-active { stroke: var(--ssd-selected-dark); stroke-width: 1.5; stroke-opacity: 1; }
/* Head office country: the same blue as every covered country (the client's choice -
   red is kept for the selection, so it never reads as "the head office"). */
.ssd-map .leaflet-pane path.ssd-area.ssd-area--hq { fill: var(--ssd-brand); }
.ssd-map .leaflet-pane path.ssd-area.ssd-area--hq:hover { fill: var(--ssd-brand-dark); }
.ssd-map .leaflet-pane path.ssd-area.ssd-area--hq.is-active { fill: var(--ssd-selected); }

/* Markers: head office and exact locations (and countries too small to paint) */
.ssd-dot {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--ssd-brand);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    transition: transform .15s;
    cursor: pointer;
}
.ssd-dot--hq { width: 18px; height: 18px; background: var(--ssd-hq); }
.ssd-dot.is-active { transform: scale(1.2); background: var(--ssd-selected); box-shadow: 0 0 0 4px rgba(217, 38, 31, .30), 0 1px 4px rgba(0, 0, 0, .35); }
.ssd-dot--hq.is-active { background: var(--ssd-hq); box-shadow: 0 0 0 4px rgba(217, 38, 31, .30), 0 1px 4px rgba(0, 0, 0, .35); }
.leaflet-marker-icon:hover .ssd-dot, .leaflet-marker-icon:focus .ssd-dot { transform: scale(1.2); }

/* Tooltip on country hover */
.ssd-map .ssd-tooltip {
    padding: 6px 10px;
    border: 0;
    border-radius: var(--ssd-radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 280px;
}
.ssd-map .ssd-tooltip strong { display: block; color: var(--ssd-brand); }
.ssd-map .ssd-tooltip span { display: block; color: #374151; }
.ssd-map .ssd-tooltip em {
    display: block;
    margin-top: 4px;
    color: var(--ssd-text-muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Popup */
.ssd-map .leaflet-popup-content-wrapper { border-radius: var(--ssd-radius); box-shadow: 0 8px 28px rgba(0,0,0,.2); }
.ssd-map .leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.5; }
.ssd-popup__title {
    margin: 0 0 8px;
    padding: 0 0 6px;
    border-bottom: 2px solid var(--ssd-brand);
    color: var(--ssd-brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.ssd-popup__region {
    margin: 10px 0 6px;
    color: var(--ssd-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ssd-popup__item { margin: 0 0 10px; }
.ssd-popup__item:last-child { margin-bottom: 0; }
.ssd-popup__item strong { display: block; font-size: 14px; }
.ssd-popup__item span { display: block; color: var(--ssd-text-muted); }
.ssd-popup__item a { display: block; color: var(--ssd-brand); text-decoration: none; }
.ssd-popup__item a:hover { text-decoration: underline; }
.ssd-popup__goto {
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ssd-brand);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 900px) {
    .ssd-layout { grid-template-columns: 1fr; }
    .ssd-map { height: 380px; }
    .ssd-panel { max-height: none; }
    .ssd-list { overflow: visible; padding-right: 0; }
    .ssd-group__title { position: static; }
}
@media (max-width: 560px) {
    .ssd-filters select, .ssd-filters__reset { flex: 1 1 100%; }
    .ssd-card__contacts { grid-template-columns: 1fr; gap: 2px; }
    .ssd-card__contacts dt { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .ssd-list { scroll-behavior: auto; }
    .ssd-card, .ssd-dot, .ssd-map path.ssd-area, .ssd-filters__reset, .ssd-card__map { transition: none; }
}
