
/*
 * Koch-Chemie Dealers
 * Использует фон/центральную колонку существующей contacts.css,
 * но расширяет центральный контент для карты и сетки дилеров.
 */

:root {
    --kc-black: #171717;
    --kc-charcoal: #2b2d2f;
    --kc-gray-900: #3f4346;
    --kc-gray-700: #73787c;
    --kc-gray-500: #9da2a6;
    --kc-gray-300: #d9dde0;
    --kc-gray-200: #e8eaec;
    --kc-gray-100: #f4f5f6;
    --kc-white: #ffffff;

    --kc-blue: #138fc4;
    --kc-blue-dark: #0c6f9c;
    --kc-red: #d71920;

    --kc-shadow: 0 18px 55px rgba(0, 0, 0, .12);
    --kc-card-shadow: 0 8px 25px rgba(0, 0, 0, .055);
}

/* Важно: центральный блок должен расти по высоте вместе со всем контентом. */
.contacts-middle-column.dealers-middle-column {
    width: min(1320px, calc(100% - 48px)) !important;
    max-width: 1320px !important;
    height: auto !important;
    min-height: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
    overflow: visible !important;
    background: rgba(255, 255, 255, .965) !important;
    border-radius: 8px;
    box-shadow: var(--kc-shadow);
    position: relative;
    z-index: 3;
}

.dealers-page {
    padding: 38px 42px 46px;
    color: var(--kc-black);
}

/* Header */
.dealers-header {
    max-width: 920px;
    margin: 0 auto 28px;
    text-align: center;
}

.dealers-brandline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--kc-gray-700);
}

.dealers-brandline__name {
    font-weight: 800;
    color: var(--kc-black);
    letter-spacing: .03em;
    text-transform: none;
    font-size: 14px;
}

.dealers-brandline__rule {
    width: 34px;
    height: 2px;
    background: var(--kc-red);
}

.dealers-header h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--kc-black);
}

.dealers-header p {
    max-width: 700px;
    margin: 14px auto 0;
    color: var(--kc-gray-700);
    font-size: 16px;
    line-height: 1.55;
}

/* Search / sorting */
.dealers-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin: 0 0 18px;
}

.dealers-search {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--kc-gray-300);
    background: var(--kc-white);
    border-radius: 5px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.dealers-search:focus-within {
    border-color: var(--kc-blue);
    box-shadow: 0 0 0 3px rgba(19, 143, 196, .11);
}

.dealers-search__icon {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    fill: var(--kc-gray-500);
}

.dealers-search input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--kc-black);
    font-size: 16px;
}

.dealers-search input::placeholder {
    color: var(--kc-gray-500);
}

.dealers-search__clear {
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: var(--kc-gray-500);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.dealers-search__clear:hover {
    color: var(--kc-black);
    background: var(--kc-gray-100);
}

.dealers-sort {
    display: inline-flex;
    background: var(--kc-gray-100);
    border: 1px solid var(--kc-gray-300);
    border-radius: 5px;
    overflow: hidden;
}

.dealers-sort__button {
    min-height: 50px;
    padding: 0 18px;
    border: 0;
    border-right: 1px solid var(--kc-gray-300);
    background: transparent;
    color: var(--kc-gray-700);
    font-weight: 600;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.dealers-sort__button:last-child {
    border-right: 0;
}

.dealers-sort__button:hover {
    color: var(--kc-black);
    background: #eceeef;
}

.dealers-sort__button.is-active {
    background: var(--kc-charcoal);
    color: var(--kc-white);
}

/* Map */
.dealers-map-panel {
    border: 1px solid var(--kc-gray-300);
    background: var(--kc-white);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--kc-card-shadow);
}

.dealers-map-panel__top {
    min-height: 76px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--kc-gray-200);
}

.dealers-map-panel__eyebrow,
.dealers-list-heading__eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--kc-gray-500);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: 10px;
    font-weight: 700;
}

.dealers-map-panel h2,
.dealers-list-heading h2 {
    margin: 0;
    color: var(--kc-black);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
}

.dealers-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--kc-gray-700);
    font-size: 12px;
}

.dealers-map-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.dealers-map-legend__pin {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .045);
}

.dealers-map-legend__pin--blue {
    background: var(--kc-blue);
}

.dealers-map-legend__pin--red {
    background: var(--kc-red);
}

.dealers-map-frame {
    height: clamp(430px, 54vw, 610px);
    min-height: 430px;
    position: relative;
    overflow: hidden;
    background: #eceeef;
}

#dealers-map {
    width: 100%;
    height: 100%;
    background: #eceeef;
}

/* Векторная карта Koch-Chemie: без raster tiles. */
#dealers-map {
    background:
        linear-gradient(180deg, #f7f8f8 0%, #f0f1f2 100%);
}

#dealers-map .leaflet-overlay-pane svg {
    shape-rendering: geometricPrecision;
}


/* Rivers: muted cold-grey blue so dealer markers remain the primary accent. */
#dealers-map .leaflet-pane.kc-river-pane-pane svg {
    shape-rendering: geometricPrecision;
}

.kc-river-label-icon {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

.kc-river-label-icon span {
    display: block;
    white-space: nowrap;
    color: #91a9b3;
    font-size: 9px;
    line-height: 1;
    font-style: italic;
    font-weight: 600;
    letter-spacing: .015em;
    text-shadow:
        -1px -1px 0 rgba(247, 248, 248, .92),
         1px -1px 0 rgba(247, 248, 248, .92),
        -1px  1px 0 rgba(247, 248, 248, .92),
         1px  1px 0 rgba(247, 248, 248, .92);
    pointer-events: none;
}

/* City labels: no white Leaflet bubble, only understated cartographic text. */
.kc-city-label.leaflet-tooltip {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #777c80 !important;
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 rgba(247, 248, 248, .96),
         1px -1px 0 rgba(247, 248, 248, .96),
        -1px  1px 0 rgba(247, 248, 248, .96),
         1px  1px 0 rgba(247, 248, 248, .96);
    pointer-events: none;
}

.kc-city-label--major.leaflet-tooltip {
    color: #555b5e !important;
    font-size: 10.5px;
    font-weight: 700;
}

.kc-city-label.leaflet-tooltip::before {
    display: none !important;
}

#dealers-map.dealers-map--error::after {
    content: "Map geometry could not be loaded";
    position: absolute;
    z-index: 700;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 14px;
    border: 1px solid #d9dde0;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
    color: #73787c;
    font-size: 12px;
}

#dealers-map .leaflet-control-zoom {
    border: 0;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
}

#dealers-map .leaflet-control-zoom a {
    color: var(--kc-charcoal);
    border-color: var(--kc-gray-200);
}

#dealers-map .leaflet-control-attribution {
    background: rgba(255,255,255,.72);
    color: #777;
    font-size: 9px;
}

.dealers-map-reset {
    position: absolute;
    z-index: 500;
    right: 14px;
    top: 14px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 4px;
    background: rgba(255, 255, 255, .93);
    color: var(--kc-charcoal);
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .09);
    cursor: pointer;
}

.dealers-map-reset:hover {
    background: var(--kc-white);
}

/* Custom markers */
.kc-marker {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50% 50% 50% 10%;
    transform: rotate(-45deg);
    background: var(--kc-blue);
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
    transition: transform .15s ease, background .15s ease;
}

.kc-marker::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}

.kc-marker--selected {
    background: var(--kc-red);
    transform: rotate(-45deg) scale(1.14);
}

.kc-marker-icon {
    background: transparent !important;
    border: 0 !important;
}

/* Popup */
.kc-popup {
    min-width: 210px;
    color: var(--kc-black);
}

.kc-popup__city {
    margin-bottom: 3px;
    color: var(--kc-gray-700);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.kc-popup__firm {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 800;
}

.kc-popup__address {
    margin: 0 0 9px;
    color: var(--kc-gray-700);
    font-size: 12px;
    line-height: 1.45;
}

.kc-popup__site {
    color: var(--kc-blue-dark);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.kc-popup__site:hover {
    text-decoration: underline;
}

/* List */
.dealers-list-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    padding: 34px 2px 14px;
    border-bottom: 1px solid var(--kc-gray-300);
}

.dealers-result-count {
    color: var(--kc-gray-700);
    font-size: 13px;
    white-space: nowrap;
}

.dealers-result-count strong {
    color: var(--kc-black);
    font-weight: 800;
}

.dealer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.dealer-card {
    min-width: 0;
    min-height: 245px;
    position: relative;
    padding: 24px 24px 27px;
    background: transparent;
    border-right: 1px solid var(--kc-gray-200);
    border-bottom: 1px solid var(--kc-gray-200);
    outline: 0;
    cursor: pointer;
    transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.dealer-card:nth-child(3n) {
    border-right: 0;
}

.dealer-card:hover,
.dealer-card:focus-visible {
    z-index: 2;
    background: var(--kc-white);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .07);
}

.dealer-card.is-selected {
    z-index: 3;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(215, 25, 32, .12), 0 10px 32px rgba(0, 0, 0, .08);
}

.dealer-card__select-line {
    width: 0;
    height: 3px;
    position: absolute;
    left: 24px;
    bottom: -1px;
    background: var(--kc-red);
    transition: width .18s ease;
}

.dealer-card.is-selected .dealer-card__select-line {
    width: calc(100% - 48px);
}

.dealer-card__topline {
    min-height: 25px;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.dealer-card__city {
    color: var(--kc-black);
    font-size: 20px;
    line-height: 1.15;
    font-weight: 800;
}

.dealer-card__map-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--kc-gray-500);
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.dealer-card__map-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--kc-blue);
}

.dealer-card.is-selected .dealer-card__map-status span {
    background: var(--kc-red);
}

.dealer-card h3 {
    margin: 0 0 13px;
    color: var(--kc-charcoal);
    font-size: 16px;
    line-height: 1.35;
    font-weight: 650;
}

.dealer-card__details {
    color: var(--kc-gray-700);
    font-size: 13px;
    line-height: 1.45;
}

.dealer-card__row {
    margin: 0 0 9px;
}

.dealer-card__label {
    display: block;
    margin-bottom: 1px;
    color: var(--kc-gray-500);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.dealer-card__links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 13px;
}

.dealer-card__links a {
    max-width: 100%;
    color: var(--kc-blue-dark);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.dealer-card__links a:hover {
    color: var(--kc-blue);
    text-decoration: underline;
}

.dealer-card__website {
    font-weight: 700;
}

.dealer-card__website span {
    margin-left: 3px;
}

.dealer-card__email {
    font-size: 13px;
}

/* No results */
.dealers-no-results {
    padding: 54px 20px 28px;
    text-align: center;
    color: var(--kc-gray-700);
}

.dealers-no-results__icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border: 1px solid var(--kc-gray-300);
    border-radius: 50%;
    color: var(--kc-gray-500);
    font-size: 24px;
}

.dealers-no-results h3 {
    margin: 0 0 6px;
    color: var(--kc-black);
    font-size: 19px;
}

.dealers-no-results p {
    margin: 0 0 16px;
}

.dealers-no-results button {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 4px;
    background: var(--kc-charcoal);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.dealers-empty-server {
    grid-column: 1 / -1;
    padding: 48px 20px;
    text-align: center;
    color: var(--kc-gray-700);
}

/* Responsive */
@media (max-width: 1050px) {
    .contacts-middle-column.dealers-middle-column {
        width: min(940px, calc(100% - 30px)) !important;
    }

    .dealers-page {
        padding: 30px 28px 38px;
    }

    .dealer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dealer-card:nth-child(3n) {
        border-right: 1px solid var(--kc-gray-200);
    }

    .dealer-card:nth-child(2n) {
        border-right: 0;
    }
}

@media (max-width: 760px) {
    .contacts-middle-column.dealers-middle-column {
        width: calc(100% - 18px) !important;
        border-radius: 5px;
    }

    .dealers-page {
        padding: 24px 16px 30px;
    }

    .dealers-header {
        margin-bottom: 22px;
    }

    .dealers-toolbar {
        grid-template-columns: 1fr;
    }

    .dealers-sort {
        width: 100%;
    }

    .dealers-sort__button {
        flex: 1 1 0;
        padding: 0 10px;
    }

    .dealers-map-panel__top {
        align-items: flex-start;
        flex-direction: column;
    }

    .dealers-map-frame {
        height: 430px;
        min-height: 430px;
    }

    .dealers-list-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .dealer-grid {
        grid-template-columns: 1fr;
    }

    .dealer-card,
    .dealer-card:nth-child(2n),
    .dealer-card:nth-child(3n) {
        border-right: 0;
    }
}

@media (max-width: 480px) {
    .dealers-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .dealers-map-frame {
        height: 380px;
        min-height: 380px;
    }

    .dealers-map-legend {
        gap: 10px;
    }

    .dealer-card {
        min-height: 0;
        padding: 21px 18px 24px;
    }

    .dealer-card__select-line {
        left: 18px;
    }

    .dealer-card.is-selected .dealer-card__select-line {
        width: calc(100% - 36px);
    }
}


/*
 * Kosovo / Serbia internal boundary:
 * rendered by Leaflet in kc-disputed-pane as a dotted line.
 * The geometry itself is stored locally in kosovo_boundary.geojson.
 */
