/* ═══════════════════════════════════════════════
   TD Hotspot — Frontend
   ════════════════════════════════════════════ */

/* ── Kontener obrazu ── */
.tdhs-wrap {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

/* Hint "kliknij kółka" — pojawia się na dole wrapa, znika po 4s */
.tdhs-wrap[data-hint]::after {
    content: attr(data-hint);
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.52);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 50;
    opacity: 1;
    animation: tdhs-hint-fade 4s ease forwards;
}

@keyframes tdhs-hint-fade {
    0%   { opacity: 1; }
    65%  { opacity: 1; }
    100% { opacity: 0; }
}

.tdhs-image {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Slider: obraz wypełnia wysokość kontenera ── */
.tdhs-slider-img .tdhs-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ═══════════════════════════════════════════════
   Hotspot — pulsująca kropka + miniatura + tooltip
   ════════════════════════════════════════════ */

.tdhs-spot {
    position: absolute;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    z-index: 20;
    line-height: 0;
    display: block;
    text-decoration: none;
}

.tdhs-spot:hover,
.tdhs-spot:focus-within {
    z-index: 100;
}

/* Pulsująca kropka */
.tdhs-dot {
    display: block;
    flex-shrink: 0;
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--tb-theme-color, #7f5f43);
    box-shadow: 0 2px 12px rgba(0,0,0,.40);
    transition: transform .2s ease, background .2s ease;
}

.tdhs-spot:hover .tdhs-dot,
.tdhs-spot:focus .tdhs-dot {
    background: var(--tb-theme-color, #7f5f43);
    transform: scale(1.2);
    outline: none;
}

/* Pierścień pulsujący 1 */
.tdhs-dot::before,
.tdhs-dot::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--tb-theme-color, #7f5f43);
    opacity: 0;
    animation: tdhs-pulse 2.6s ease-out infinite;
}

/* Pierścień pulsujący 2 (opóźniony) */
.tdhs-dot::after {
    animation-delay: 1.3s;
}

@keyframes tdhs-pulse {
    0%   { transform: scale(0.8); opacity: 0.60; }
    100% { transform: scale(2.8); opacity: 0;    }
}

/* ── Tooltip — mini zawsze widoczny, pełny na hover ── */
.tdhs-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.78);
    transform-origin: 50% 100%;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    padding: 8px 12px;
    min-width: 150px;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    opacity: 1;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    z-index: 30;
    white-space: normal;
    line-height: 1.35;
}

/* Strzałka tooltipa */
.tdhs-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #fff;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.08));
}

.tdhs-spot:hover .tdhs-tooltip,
.tdhs-spot:focus-within .tdhs-tooltip {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    pointer-events: auto;
}

.tdhs-tooltip-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    display: block;
}

/* CTA ukryte w mini stanie, widoczne na hover */
.tdhs-tooltip-cta {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--tb-theme-color, #7f5f43);
    text-align: center;
    text-decoration: none;
    border-top: 1px solid #f0ece8;
    padding-top: 6px;
    width: 100%;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity .2s ease, max-height .2s ease, padding-top .2s ease;
}

.tdhs-spot:hover .tdhs-tooltip-cta,
.tdhs-spot:focus-within .tdhs-tooltip-cta {
    opacity: 1;
    max-height: 60px;
    padding-top: 6px;
    padding-bottom: 2px;
}

/* ═══════════════════════════════════════════════
   Slider
   ════════════════════════════════════════════ */

.tdhs-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #111;
    line-height: 0;
}

.tdhs-track {
    position: relative;
    width: 100%;
    height: var(--tdhs-h, 60vh);
}

.tdhs-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.65s ease;
}

.tdhs-slide.is-active {
    opacity: 1;
    pointer-events: all;
}

/* ── Strzałki nawigacji ── */
.tdhs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    background: rgba(255,255,255,.85);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
    transition: background .2s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tdhs-prev { left: 16px; }
.tdhs-next { right: 16px; }

.tdhs-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
}

/* ── Paginacja (kropki) ── */
.tdhs-pager {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    gap: 8px;
}

.tdhs-pip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.7);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background .2s, border-color .2s;
}

.tdhs-pip.is-active {
    background: #fff;
    border-color: #fff;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .tdhs-track { height: var(--tdhs-h-mobile, 44vw); }

    .tdhs-arrow {
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    .tdhs-tooltip {
        min-width: 140px;
        max-width: 180px;
    }
}

/* ══════════════════════════════════════════════════════
   Scene Slider — [tdhs_scene_slider]
   ══════════════════════════════════════════════════════ */

/* !important niezbędne — Elementor nadpisuje display:flex na block */
.tdhs-ss-wrap {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    line-height: 0;
    box-sizing: border-box;
}

/* Gdy brak panelu — slider zajmuje 100% */
.tdhs-ss-wrap:not(.has-panel) .tdhs-ss-slides {
    width: 100% !important;
    flex: 1 !important;
}

/* Panel po prawej stronie */
.tdhs-ss-wrap.panel-right {
    flex-direction: row-reverse !important;
}

/* ── Panel tekstowy (25%) ── */
.tdhs-ss-panel {
    width: 25% !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    /* Padding: więcej oddechu od krawędzi ekranu */
    padding: 40px 48px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

.tdhs-ss-heading {
    font-size: clamp(1.1rem, 1.8vw, 1.7rem);
    font-weight: 700;
    margin: 0 0 14px;
    line-height: 1.25;
    color: inherit;
}

.tdhs-ss-text {
    font-size: clamp(.82rem, 1vw, 1rem);
    margin: 0 0 22px;
    opacity: .9;
    line-height: 1.6;
    color: inherit;
}

.tdhs-ss-cta {
    display: inline-block;
    padding: 5px 13px;
    border: 2px solid;
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .15s;
    align-self: flex-end;
    color: inherit;
}

.tdhs-ss-cta:hover { opacity: .8; }

/* ── Slides (75% gdy panel, 100% gdy brak) ──
   Domyślnie: aspect-ratio 16/9 (--tdhs-h nie ustawione).
   Gdy shortcode ma height="...", --tdhs-h nadpisuje aspect-ratio.       */
.tdhs-ss-slides {
    width: 75% !important;
    flex: 1 !important;
    position: relative !important;
    overflow: hidden !important;
    line-height: 0;
    /* Domyślna proporcja 16:9 — odcinamy niebo z góry, produkty widoczne */
    aspect-ratio: 16 / 9;
    height: var(--tdhs-h) !important; /* nadpisuje aspect-ratio gdy ustawione */
    /* Na bardzo szerokich ekranach ogranicz do 82vh — treść strony musi być widoczna */
    max-height: 82vh;
}

.tdhs-ss-slide {
    position: absolute;
    inset: 0;
    /* Explicit width+height — potrzebne żeby child img mógł rozwiązać height:100% */
    width: 100%;
    height: 100%;
    /* overflow:visible — żeby tooltips hotspotów mogły wystawać ponad slide */
    overflow: visible;
    opacity: 0;
    transition: opacity .5s ease;
}

/* Hotspoty w sliderze — te same style co standardowe .tdhs-wrap */
.tdhs-ss-slide .tdhs-spot {
    z-index: 20;
}
.tdhs-ss-slide .tdhs-spot:hover,
.tdhs-ss-slide .tdhs-spot:focus-within {
    z-index: 100;
}

.tdhs-ss-slide.is-active { opacity: 1; }

.tdhs-ss-slide img {
    /* position:absolute+inset:0 zamiast height:100% — 100% reliable fill */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Pokaż dolną część obrazu — tam są produkty, niebo odcina się z góry */
    object-position: center 75%;
    display: block;
}

/* ── Strzałki ── */
.tdhs-ss-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0,0,0,.35);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    backdrop-filter: blur(4px);
}

.tdhs-ss-arrow:hover { background: rgba(0,0,0,.6); }
.tdhs-ss-prev { left: 14px; }
.tdhs-ss-next { right: 14px; }

/* ── Pager ── */
.tdhs-ss-pager {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.tdhs-ss-pip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.8);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background .2s, border-color .2s;
}

.tdhs-ss-pip.is-active {
    background: #fff;
    border-color: #fff;
}

/* ── Tablet (≤1024px) — trochę mniejszy panel ── */
@media (max-width: 1024px) {
    .tdhs-ss-panel {
        padding: 28px 32px !important;
    }
}

/* ── Mobile (≤768px): obraz NA GÓRZE, tekst NA DOLE ── */
@media (max-width: 768px) {
    .tdhs-ss-wrap {
        flex-direction: column !important;
        gap: 0 !important;
        align-items: stretch !important;
    }

    /* Obraz zawsze na górze niezależnie od panel_position */
    .tdhs-ss-slides {
        order: 1 !important;
        width: 100% !important;
        /* Explicit vw-based height zamiast aspect-ratio — 100% cross-browser reliable
           75vw = proporcja 4:3 przy 100% szerokości viewportu (typowe mobile) */
        height: 56.25vw !important;
        aspect-ratio: unset !important;
        max-height: 65vw !important; /* cap na przypadek bardzo szerokiego telefonu landscape */
        min-height: 180px !important;
        flex: none !important;
        margin: 0 !important;
    }

    /* Panel tekstowy zawsze pod obrazem */
    .tdhs-ss-panel {
        order: 2 !important;
        width: 100% !important;
        padding: 24px 20px !important;
        margin: 0 !important;
    }

    .tdhs-ss-arrow { width: 36px; height: 36px; font-size: 20px; }

    .tdhs-ss-heading { font-size: clamp(1rem, 4vw, 1.4rem); }
    .tdhs-ss-text    { font-size: clamp(.72rem, 2.8vw, .88rem); }

    /* Etykietki slidera mniejsze i półprzezroczyste w spoczynku na mobile */
    .tdhs-ss-slide .tdhs-tooltip {
        transform: translateX(-50%) scale(0.54);
        opacity: 0.5;
    }
    .tdhs-ss-slide .tdhs-spot:hover .tdhs-tooltip,
    .tdhs-ss-slide .tdhs-spot:focus-within .tdhs-tooltip {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}
