/* ================================================================
   Dealer Map — Novochema brand skin
   Primárna: #C8181E  |  Tmavá: #1C1C1C  |  Šedá: #F4F4F4
   ================================================================ */

/* ─── Wrap ─── */
.dm-wrap {
    display: flex;
    gap: 0;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    background: #fff;
    /* Výška wrapa = výška mapy (nastavená inline štýlom na dm-map-wrap) */
    align-items: stretch;
    position: relative;
}

/* ─── Sidebar ─── */
.dm-sidebar {
    width: 340px;
    min-width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 2px solid #F0F0F0;
    /* Kľúč: sidebar je absolute, výška = výška mapy */
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: 1;
    overflow: hidden;
}

/* ─── Search bar ─── */
.dm-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 12px;
    border-bottom: 2px solid #F0F0F0;
    background: #1C1C1C;
}

.dm-search-inner {
    flex: 1;
    position: relative;
}

#dm-search {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid transparent;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    background: #2E2E2E;
    color: #fff;
    transition: border-color .2s, background .2s;
}
#dm-search::placeholder { color: #888; }
#dm-search:focus {
    border-color: #C8181E;
    background: #333;
}

/* ─── Autocomplete ─── */
.dm-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-top: 3px solid #C8181E;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    z-index: 9999;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
.dm-autocomplete.open { display: block; }

.dm-ac-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #f5f5f5;
    transition: background .12s;
    color: #222;
}
.dm-ac-item:last-child { border-bottom: none; }
.dm-ac-item:hover, .dm-ac-item.active { background: #FEF0F0; }

.dm-ac-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
}
.dm-ac-badge.city  { background: #FEF0F0; color: #C8181E; border: 1px solid #f5c0c0; }
.dm-ac-badge.name  { background: #F0F4FE; color: #2B5ADE; border: 1px solid #bfd0f5; }

/* ─── GPS button ─── */
#dm-gps-btn {
    flex-shrink: 0;
    background: #C8181E;
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#dm-gps-btn:hover  { background: #A81016; }
#dm-gps-btn:active { transform: scale(.94); }

/* ─── Results info ─── */
.dm-results-info {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 14px 4px;
    min-height: 26px;
}

/* ─── List ─── */
.dm-list {
    flex: 1;
    overflow-y: auto;
}

.dm-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #F2F2F2;
    cursor: pointer;
    transition: background .12s;
    border-left: 3px solid transparent;
}
.dm-list-item:hover  { background: #FEF7F7; border-left-color: #e8a0a0; }
.dm-list-item.active { background: #FEF0F0; border-left-color: #C8181E; }

.dm-item-thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 5px;
    overflow: hidden;
    background: #F4F4F4;
    border: 1px solid #E8E8E8;
}
.dm-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dm-item-body  { flex: 1; min-width: 0; }
.dm-item-body h4 {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 700;
    color: #1C1C1C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-item-city {
    font-size: 12px;
    color: #888;
    margin: 0;
}
.dm-item-dist {
    font-size: 11px;
    font-weight: 600;
    color: #C8181E;
    margin: 2px 0 0;
}

/* Status v list itemi */
.dm-item-status {
    font-size: 11px;
    font-weight: 600;
    margin: 3px 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
}
.dm-item-status .dm-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dm-item-status--open          { color: #16803c; }
.dm-item-status--open .dm-status-dot   { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.dm-item-status--closed        { color: #9a3412; }
.dm-item-status--closed .dm-status-dot { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.dm-item-status--unknown       { color: #b45309; }
.dm-item-status--unknown .dm-status-dot { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.2); }

.dm-empty {
    padding: 40px 14px;
    text-align: center;
    color: #bbb;
    font-size: 13px;
}
.dm-empty::before {
    content: '🔍';
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    opacity: .5;
}

/* ─── Map ─── */
.dm-map-wrap {
    width: 100%;
    margin-left: 340px;
    position: relative;
    min-height: 520px;
}
#dm-map {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    height: 100% !important;
}

/* ─── Leaflet popup — Novochema skin ─── */
.dm-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    min-width: 220px;
    max-width: 320px;
}

.dm-popup-photo {
    width: calc(100% + 36px);
    margin: -16px -18px 14px -18px;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #F4F4F4;
}

.dm-popup-title {
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 4px;
    color: #1C1C1C;
    letter-spacing: -.2px;
}

.dm-popup-addr {
    font-size: 12px;
    color: #777;
    margin: 0 0 10px;
    line-height: 1.4;
}

.dm-popup-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #F0F0F0;
    padding-top: 8px;
}

.dm-popup-rows li {
    font-size: 12px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #444;
}

.dm-popup-rows a {
    color: #C8181E;
    text-decoration: none;
    font-weight: 500;
}
.dm-popup-rows a:hover { text-decoration: underline; }

/* Leaflet popup — full bleed foto, vlastný close button */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: none !important;
}
.leaflet-popup-content {
    margin: 0 !important;
    width: 320px !important;
}
.leaflet-popup-tip-container { display: none !important; }

/* Skryť natívny Leaflet close button — máme vlastný */
.leaflet-popup-close-button { display: none !important; }

/* Popup wrapper */
.dm-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Foto sekcia — full bleed, relatívna pre close btn */
.dm-popup-photo-wrap {
    position: relative;
    width: 320px;
    height: 140px;
    background: #EBEBEB;
    overflow: hidden;
    flex-shrink: 0;
}
.dm-popup-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Vlastný close button cez fotku */
.dm-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,.45);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.dm-popup-close:hover { background: rgba(200,24,30,.85); }

/* Obsah pod fotkou */
.dm-popup-body {
    padding: 14px 16px 16px;
}
.dm-popup-title {
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 4px;
    color: #1C1C1C;
    letter-spacing: -.2px;
    line-height: 1.3;
}
.dm-popup-addr {
    font-size: 12px;
    color: #777;
    margin: 0 0 10px;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}
.dm-popup-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #F0F0F0;
    padding-top: 8px;
}
.dm-popup-rows li {
    font-size: 12px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #444;
}
.dm-popup-rows a {
    color: #C8181E;
    text-decoration: none;
    font-weight: 500;
}
.dm-popup-rows a:hover { text-decoration: underline; }

/* ─── Otváracie hodiny v popupe ─── */
.dm-popup-hours {
    border-top: 1px solid #F0F0F0;
    padding-top: 10px;
    margin-bottom: 10px;
}

/* Variant: neznáme hodiny – statický, bez toggle */
.dm-popup-hours--unknown {
    padding: 10px 8px 6px;
}
.dm-popup-hours--unknown .dm-hours-head {
    color: #999;
    font-size: 12px;
}
.dm-hours-unknown-text {
    font-style: italic;
}
.dm-hours-toggle {
    width: 100%;
    background: none !important;
    border: none !important;
    padding: 6px 8px !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: inherit;
    color: #444;
    font-size: 12px;
    text-align: left;
    box-shadow: none !important;
    text-decoration: none !important;
    -webkit-appearance: none;
            appearance: none;
    line-height: 1.3;
    border-radius: 6px !important;
    transition: background .15s ease;
}
.dm-hours-toggle:hover {
    background: #FAFAFA !important;
    color: #444 !important;
    text-decoration: none !important;
}
.dm-hours-toggle:focus,
.dm-hours-toggle:active {
    background: #FAFAFA !important;
    color: #444 !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
    text-decoration: none !important;
}
.dm-hours-toggle .dm-hours-clock-icon { color: #999; flex-shrink: 0; }
.dm-hours-toggle:hover .dm-hours-caret { color: #C8181E; }
.dm-hours-toggle * { pointer-events: none; }

.dm-hours-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    min-width: 0;
}
.dm-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: -.1px;
}
.dm-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}
.dm-status--open          { color: #15803d; }
.dm-status--open .dm-status-dot   {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
    animation: dm-pulse 2s ease-in-out infinite;
}
.dm-status--closed        { color: #b91c1c; }
.dm-status--closed .dm-status-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.dm-status--unknown       { color: #b45309; }
.dm-status--unknown .dm-status-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.15); }

@keyframes dm-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
    50%      { box-shadow: 0 0 0 5px rgba(34,197,94,.08); }
}

.dm-hours-caret {
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    color: #bbb;
    flex-shrink: 0;
}
.dm-popup-hours.is-open .dm-hours-caret { transform: rotate(180deg); color: #C8181E; }

/* Rozbaliteľný panel – animácia cez max-height */
.dm-hours-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .3s cubic-bezier(.4,0,.2,1), opacity .2s ease, margin-top .3s ease;
    margin-top: 0;
}
.dm-popup-hours.is-open .dm-hours-panel {
    max-height: 340px;
    opacity: 1;
    margin-top: 6px;
}

/* Moderný layout – flex riadky s leader dots */
.dm-hours-list {
    list-style: none;
    padding: 6px 8px 4px;
    margin: 0;
    background: #FAFAFA;
    border-radius: 6px;
    font-size: 12px;
}
.dm-hours-list li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
    position: relative;
}
.dm-hours-list li + li {
    border-top: 1px dashed #EAEAEA;
}
.dm-hours-list .dm-day-name {
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 72px;
}
.dm-hours-list .dm-day-time {
    color: #222;
    font-weight: 600;
    margin-left: auto;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.dm-hours-list li.dm-hours-today {
    padding: 6px 8px;
    margin: 0 -6px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.dm-hours-list li.dm-hours-today + li { border-top: none; }
.dm-hours-list li.dm-hours-today .dm-day-name { color: #C8181E; font-weight: 700; }
.dm-hours-list li.dm-hours-today .dm-day-time { color: #1C1C1C; font-weight: 800; }
.dm-hours-closed {
    color: #bbb;
    font-weight: 500;
    font-style: normal;
}
.dm-hours-note {
    margin: 8px 2px 0;
    padding: 0;
    font-size: 11px;
    color: #999;
    font-style: italic;
    line-height: 1.4;
}
.dm-map-wrap .leaflet-pane     { z-index: 1; }
.dm-map-wrap .leaflet-top,
.dm-map-wrap .leaflet-bottom   { z-index: 2; }
.dm-map-wrap .leaflet-popup    { z-index: 3; }

/* Custom Leaflet marker pin — červená */
.dm-marker-icon {
    background: #C8181E;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    width: 24px;
    height: 24px;
    box-shadow: 0 2px 6px rgba(200,24,30,.4);
}

/* ─── Scrollbar ─── */
.dm-list::-webkit-scrollbar { width: 4px; }
.dm-list::-webkit-scrollbar-track { background: #f9f9f9; }
.dm-list::-webkit-scrollbar-thumb { background: #E0E0E0; border-radius: 2px; }
.dm-list::-webkit-scrollbar-thumb:hover { background: #C8181E; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .dm-wrap {
        flex-direction: column;
        height: auto !important;
    }
    .dm-sidebar {
        position: relative;
        top: auto; left: auto; bottom: auto;
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 2px solid #F0F0F0;
        max-height: 260px;
        flex-shrink: 0;
    }
    .dm-map-wrap {
        margin-left: 0;
        width: 100%;
        height: 400px !important;
        min-height: 400px;
        flex-shrink: 0;
    }
}
@media (max-width: 480px) {
    .dm-map-wrap {
        height: 340px !important;
        min-height: 340px;
    }
}

/* GPS button spin animation */
@keyframes dm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
#dm-gps-btn svg { display: block; width: 28px !important; height: 28px !important; }

/* ─── Popup action buttons ─── */
.dm-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #F0F0F0;
}
.dm-popup-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.dm-popup-btn--map {
    background: #F4F4F4;
    color: #333 !important;
    border: 1px solid #E0E0E0;
}
.dm-popup-btn--map:hover {
    background: #E8E8E8;
    color: #1C1C1C !important;
}
.dm-popup-btn--navi {
    background: #C8181E;
    color: #fff !important;
    border: 1px solid #C8181E;
}
.dm-popup-btn--navi:hover {
    background: #A81016;
    border-color: #A81016;
}
