/**
 * Tourism Slider
 * Bottombar (smal/staand) of zijbalk (breed/liggend) met gevonden bezienswaardigheden
 */

#tourism-slider {
    position: absolute;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    color: #fff;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 1;
}

#tourism-slider.dragging {
    transition: none;
}

#tourism-slider.hidden {
    opacity: 0;
    pointer-events: none;
}

#tourism-slider.mode-bottom.hidden {
    transform: translateY(120%) !important;
}

#tourism-slider.mode-side.hidden {
    transform: translateX(-120%) !important;
}

/* Bottombar */
#tourism-slider.mode-bottom {
    left: 8px;
    right: 8px;
    bottom: calc(var(--ts-bottom-offset, 0px) + 8px);
    max-width: 980px;
    margin: 0 auto;
}

/* Zijbalk */
#tourism-slider.mode-side {
    left: 10px;
    top: 84px;
    bottom: calc(var(--ts-bottom-offset, 0px) + 10px);
    width: 320px;
}

@media (max-height: 500px) {
    #tourism-slider.mode-side {
        top: 10px;
        left: 56px;
        width: 260px;
    }
}

/* Header */
.ts-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 6px 14px;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.ts-grip {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
}

.mode-side .ts-grip {
    display: none;
}

.ts-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.ts-minimize {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

.ts-minimize:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.ts-minimize svg {
    width: 16px;
    height: 16px;
}

.mode-side .ts-minimize svg {
    transform: rotate(90deg);
}

/* Track */
.ts-track {
    display: flex;
    gap: 10px;
    outline: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ts-track::-webkit-scrollbar {
    display: none;
}

.mode-bottom .ts-track {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 10px 12px;
    touch-action: pan-x;
}

.mode-side .ts-track {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 10px 10px;
    touch-action: pan-y;
}

/* Kaartjes */
.ts-card {
    position: relative;
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    opacity: 0.75;
}

.mode-bottom .ts-card {
    width: min(78vw, 300px);
    height: 92px;
}

.mode-side .ts-card {
    width: 100%;
    height: 96px;
}

.ts-card.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--marker-color);
    box-shadow: 0 0 0 1px var(--marker-color), 0 0 18px -4px var(--marker-color);
}

.ts-photo {
    position: relative;
    flex: 0 0 92px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-photo-icon {
    font-size: 1.8rem;
}

.ts-index {
    position: absolute;
    top: 6px;
    left: 6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--marker-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.ts-info {
    flex: 1;
    min-width: 0;
    padding: 8px 10px 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ts-info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ts-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
}

.ts-rating small {
    color: rgba(255, 255, 255, 0.45);
}

.ts-badges {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow: hidden;
}

.ts-badge {
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--marker-color) 28%, transparent);
    color: #fff;
    white-space: nowrap;
}

/* Tab om de slider terug te halen */
#tourism-slider-tab {
    position: absolute;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#tourism-slider-tab svg {
    width: 16px;
    height: 16px;
    color: #10b981;
}

#tourism-slider-tab.mode-bottom {
    left: 10px;
    bottom: calc(var(--ts-bottom-offset, 0px) + 10px);
}

#tourism-slider-tab.mode-side {
    left: 10px;
    top: 84px;
}

#tourism-slider-tab.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Uitgelichte marker op de kaart */
.tourism-marker-container.is-active {
    z-index: 2000 !important;
}

.tourism-marker-container.is-active .tourism-marker {
    scale: 1.22;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--marker-color), 0 0 26px 10px var(--marker-color);
}

.tourism-marker-container.is-active::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 3px solid var(--ts-active-color, #10b981);
    animation: tsMarkerPulse 1.6s ease-out infinite;
    pointer-events: none;
}

@keyframes tsMarkerPulse {
    0% { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .tourism-marker-container.is-active::after {
        animation: none;
    }
}


/* Advertentiekaart in de slider */
.ts-ad {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    overflow: hidden;
}

.mode-bottom .ts-ad {
    width: 320px;
    height: 100px;
}

.mode-side .ts-ad {
    width: 100%;
    height: 268px;
    padding-top: 14px;
}

.ts-ad-label {
    position: absolute;
    top: 3px;
    left: 8px;
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    z-index: 1;
    pointer-events: none;
}

.ts-ad-close {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2;
}

.ts-ad-close svg {
    width: 13px;
    height: 13px;
}

.ts-ad-slot {
    line-height: 0;
}

/* Geen advertentie beschikbaar: plek inklappen */
.ts-ad.ts-ad-empty {
    display: none;
}


/* Liggende telefoon: zijbalk onder de zoekknoppen, tijdbalk maakt plaats */
@media (max-height: 500px) {
    #tourism-slider.mode-side {
        top: 104px;
        left: 10px;
        width: 280px;
    }
    
    #tourism-slider-tab.mode-side {
        top: 104px;
    }
}

/* Liggende telefoon: filterpanelen rechts naast de zijbalk */
@media (max-height: 500px) and (min-width: 601px) {
    body #map-container #p4n-filter-panel,
    body #map-container #tourism-filter-panel {
        left: 300px;
        transform: none;
        width: min(280px, calc(100% - 370px));
        max-height: calc(100% - 120px);
    }
}

/* Tabbladen Overnachten / Doen + dagplan */
.ts-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ts-tabs { display: flex; gap: 6px; }
.ts-tabs[hidden], .ts-plan[hidden], .ts-title[hidden] { display: none; }
.ts-tabs button {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.ts-tabs button b { font-weight: 700; opacity: 0.7; margin-left: 2px; }
.ts-tabs button.active { background: #10b981; border-color: #10b981; color: #fff; }
.ts-plan { font-size: 0.7rem; color: rgba(255, 255, 255, 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-p4n-icon { width: 16px; height: 16px; vertical-align: -3px; }
.ts-photo-icon .ts-p4n-icon { width: 34px; height: 34px; }

.p4n-marker-container.is-active .p4n-marker {
    transform: scale(1.25);
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px #10b981, 0 0 24px 8px #10b981;
    border-radius: 50%;
}
.p4n-marker-container.is-active::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 3px solid #10b981;
    animation: tsMarkerPulse 1.6s ease-out infinite;
    pointer-events: none;
}

/* Routekaartje in de slider: tegels + lijn, gecentreerd in het fotovak */
.ts-photo { overflow: hidden; }
.ts-photo .ts-map { position: absolute; left: 50%; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; background: #e5e7eb; }
.ts-photo .ts-map img { position: absolute; width: 256px; height: 256px; max-width: none; object-fit: fill; }
.ts-photo .ts-map svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
