/* ==========================================================================
   THINGSATWEB 360 Virtual Tour - Pro viewer chrome
   Zoom controls, auto-rotation, Street View surface and the floor plan
   overlay. Matches the base viewer's white-card language.
   ========================================================================== */

/* ==================== SHARED BUTTON ==================== */
.thingsatweb-virtual-tour-container .thingsatweb-pro-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #ffffff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #333436;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.thingsatweb-virtual-tour-container .thingsatweb-pro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.thingsatweb-virtual-tour-container .thingsatweb-pro-btn:focus-visible {
    outline: 3px solid #4888e8;
    outline-offset: 2px;
}

.thingsatweb-virtual-tour-container .thingsatweb-zoom-in.disabled,
.thingsatweb-virtual-tour-container .thingsatweb-zoom-out.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.thingsatweb-virtual-tour-container .thingsatweb-zoom-in.disabled:hover,
.thingsatweb-virtual-tour-container .thingsatweb-zoom-out.disabled:hover {
    transform: none;
    box-shadow: none;
}

.thingsatweb-virtual-tour-container .thingsatweb-pro-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==================== RIGHT RAIL: ZOOM + AUTO-ROTATE ==================== */
.thingsatweb-pro-controls {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.thingsatweb-autorotate-toggle .icon-pause,
.thingsatweb-autorotate-toggle.is-active .icon-play {
    display: none;
}

.thingsatweb-autorotate-toggle.is-active .icon-pause {
    display: block;
}

.thingsatweb-autorotate-toggle.is-active {
    background: #4888e8;
    color: #ffffff;
}

/* ==================== GOOGLE STREET VIEW ==================== */
.thingsatweb-streetview-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    background: #000;
}

.thingsatweb-streetview-layer.is-active {
    display: block;
}

/* Hide the (black) Pannellum canvas while Google renders the panorama. */
.thingsatweb-virtual-tour-container.thingsatweb-streetview-active #pannellum-container {
    visibility: hidden;
}

/* Zoom/reset/auto-rotate control the Pannellum panorama, which is hidden
   during Street View - Google's own pan/zoom (or our clickToGo navigation)
   handles movement there instead, so this rail has nothing to act on. */
.thingsatweb-virtual-tour-container.thingsatweb-streetview-active .thingsatweb-pro-controls {
    display: none !important;
}

.thingsatweb-streetview-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    background: #16181d;
}

/* Google injects its own controls; keep them clear of our bottom chrome. */
.thingsatweb-streetview-layer .gm-style-cc,
.thingsatweb-streetview-layer .gmnoprint {
    margin-bottom: 56px;
}

/* ==================== FLOOR PLAN ==================== */
.thingsatweb-floorplan {
    position: absolute;
    z-index: 110;
    --thingsatweb-floorplan-width: 280px;
}

/* Sits to the left of the base viewer's "Scenes" button (bottom-right,
   10px from the edge, ~150px wide) instead of stacking on top of it. */
.thingsatweb-floorplan--bottom-right {
    right: 160px;
    bottom: 10px;
}

.thingsatweb-floorplan--bottom-left {
    left: 10px;
    bottom: 68px;
}

.thingsatweb-floorplan--top-right {
    right: 10px;
    top: 68px;
}

.thingsatweb-floorplan--top-left {
    left: 10px;
    top: 68px;
}

/* Toggle = a mini-map card: plan thumbnail with a pulsing pin and a spot
   count, then "Floor plan" + "2 floors · 6 spots". Reads as "there's a
   map in here", not as another plain control. */
.thingsatweb-floorplan-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 4px;
    height: 48px;
    box-sizing: border-box;
    background: #ffffff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #333436;
    cursor: pointer;
    font-family: 'Figtree', sans-serif;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thingsatweb-floorplan .thingsatweb-floorplan-toggle,
.thingsatweb-floorplan .thingsatweb-floorplan-toggle:hover,
.thingsatweb-floorplan .thingsatweb-floorplan-toggle:focus {
    background: #ffffff !important;
    color: #333436 !important;
    border: none;
}

.thingsatweb-floorplan-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.thingsatweb-floorplan-toggle-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 54px;
    height: 40px;
    border-radius: 7px;
    background-color: #eef1f5;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Pulsing pin in the middle of the thumbnail. */
.thingsatweb-floorplan-toggle-ping {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: #2f7bea;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    box-sizing: content-box;
}

.thingsatweb-floorplan-toggle-ping::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid #2f7bea;
    animation: thingsatweb-pin-pulse 1.8s ease-out infinite;
}

.thingsatweb-floorplan-toggle-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 9px;
    background: #2f7bea;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.thingsatweb-floorplan-toggle-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    white-space: nowrap;
}

.thingsatweb-floorplan-toggle-text strong {
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
}

.thingsatweb-floorplan-toggle-text small {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: #5a6270;
}

/* Open panel: lift it clear of the bottom bar (scene title, the 1/6
   pager, Scenes) instead of sitting on top of it. */
.thingsatweb-floorplan--bottom-right.is-open,
.thingsatweb-floorplan--bottom-left.is-open {
    bottom: 62px;
}

.thingsatweb-floorplan.is-open .thingsatweb-floorplan-toggle {
    display: none;
}

.thingsatweb-floorplan-panel {
    display: none;
    position: relative;
    width: var(--thingsatweb-floorplan-width);
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.thingsatweb-floorplan.is-open .thingsatweb-floorplan-panel {
    display: block;
}

.thingsatweb-floorplan-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 8px 0 8px;
    /* Margin (not padding) so the whole tab row stops short of the close
       (x) button. With a scrolling row, padding only reserved that space at
       the far end of the scroll, so a scrolled tab slid under the x. Tabs
       now wrap onto a second line instead of scrolling - every floor name
       stays visible, and there's no scrollbar. */
    margin-right: 36px;
}

/* Single-floor name (no tab bar when there's only one floor). */
.thingsatweb-floorplan-title {
    padding: 10px 44px 0 12px;
    line-height: 28px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The base viewer's Scenes wrapper is z-index 100, under the floor plan
   (110) - so the Floor plan button showed on top of the open Scenes
   popup. While that popup is open, lift it above and hide the floor plan
   (its sibling from the thingsatweb_360_viewer_overlays hook) - on small
   screens the button sits just above the popup rather than under it, so
   stacking order alone doesn't clear it. One popup at a time. */
.thingsatweb-scenes-wrapper:has(.thingsatweb-scenes-panel.open) {
    z-index: 120;
}

.thingsatweb-scenes-wrapper:has(.thingsatweb-scenes-panel.open) ~ .thingsatweb-floorplan {
    visibility: hidden;
    pointer-events: none;
}

.thingsatweb-floorplan-tab {
    flex: 0 0 auto;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: #f2f4f7;
    color: #5a6270;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.thingsatweb-floorplan-tab.is-active {
    background: #4888e8;
    color: #ffffff;
}

/* Themes style every button on :hover/:focus (Hello Elementor's reset and
   the Elementor kit's `.elementor-kit-N button:focus` outrank the rules
   above), so a clicked tab lost its blue and pins grew a coloured box.
   Re-assert our look with a container-scoped selector; the colours carry
   !important because some kits/themes mark their button colours
   !important too, and the active floor must always read as active. */
.thingsatweb-floorplan .thingsatweb-floorplan-tab,
.thingsatweb-floorplan .thingsatweb-floorplan-tab:hover,
.thingsatweb-floorplan .thingsatweb-floorplan-tab:focus {
    background: #f2f4f7 !important;
    color: #5a6270 !important;
    border: none;
    box-shadow: none;
    text-decoration: none;
    text-transform: none;
}

.thingsatweb-floorplan .thingsatweb-floorplan-tab:hover {
    background: #e4e8ee !important;
    color: #1d2327 !important;
}

.thingsatweb-floorplan .thingsatweb-floorplan-tab.is-active,
.thingsatweb-floorplan .thingsatweb-floorplan-tab.is-active:hover,
.thingsatweb-floorplan .thingsatweb-floorplan-tab.is-active:focus {
    background: #4888e8 !important;
    color: #ffffff !important;
}

.thingsatweb-floorplan .thingsatweb-floorplan-tab:focus-visible {
    outline: 2px solid #4888e8;
    outline-offset: 2px;
}

.thingsatweb-floorplan .thingsatweb-floorplan-close,
.thingsatweb-floorplan .thingsatweb-floorplan-close:focus {
    padding: 4px;
    border: none;
    background: transparent !important;
    box-shadow: none;
}

.thingsatweb-floorplan .thingsatweb-floorplan-close:hover {
    background: #f0f0f0 !important;
}

.thingsatweb-floorplan .thingsatweb-floorplan-pin,
.thingsatweb-floorplan .thingsatweb-floorplan-pin:hover,
.thingsatweb-floorplan .thingsatweb-floorplan-pin:focus {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    color: inherit;
}

.thingsatweb-floorplan .thingsatweb-floorplan-pin:focus-visible .thingsatweb-floorplan-pin-dot {
    outline: 2px solid #1d2327;
    outline-offset: 2px;
}

.thingsatweb-floorplan-stage {
    position: relative;
    padding: 8px;
}

/* A fixed aspect box, regardless of each floor's own image dimensions, so
   the panel doesn't resize when a visitor switches floor tabs - and this
   has to match the same box in the editor's canvas (.thingsatweb-floorplan-
   stage-inner) so a pin's stored percentage position lands in the same
   spot here as where it was dropped. */
.thingsatweb-floorplan-map {
    display: none;
    position: relative;
    aspect-ratio: 4 / 3;
    background: #eef1f5;
    overflow: hidden;
}

.thingsatweb-floorplan-map.is-active {
    display: block;
}

.thingsatweb-floorplan-map img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Matches the Scenes popup's close button (.thingsatweb-scenes-close in
   viewer.css): flat, same icon-close.png icon, light grey hover. */
.thingsatweb-floorplan-close {
    position: absolute;
    top: 12px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thingsatweb-floorplan-close:hover {
    background: #f0f0f0;
}

.thingsatweb-floorplan-close img {
    display: block;
    width: 16px;
    height: 16px;
}

/* ---- Pins ----
   Pins have to read as "tap me to go there" at a glance: a solid blue
   dot with a pulsing halo and a blue name pill with a chevron, like a
   link. The pin for the scene the visitor is in turns green ("you are
   here"), stops pulsing and shows the heading cone. */
.thingsatweb-floorplan-pin {
    position: absolute;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    --pin-rotation: 0deg;
    --pin-color: #2f7bea;
    --pin-color-dark: #1f5fc4;
}

/* Bigger invisible hit area so the dot is easy to tap on touch screens. */
.thingsatweb-floorplan-pin::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
}

.thingsatweb-floorplan-pin.is-active {
    --pin-color: #16a34a;
    --pin-color-dark: #12833c;
    z-index: 2;
}

.thingsatweb-floorplan-pin-dot {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--pin-color);
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, background 0.15s ease;
}

/* Pulsing halo on the pins you can travel to. */
.thingsatweb-floorplan-pin-dot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--pin-color);
    animation: thingsatweb-pin-pulse 1.8s ease-out infinite;
    pointer-events: none;
}

.thingsatweb-floorplan-pin.is-active .thingsatweb-floorplan-pin-dot::after {
    display: none;
}

@keyframes thingsatweb-pin-pulse {
    0%   { transform: scale(1);   opacity: 0.9; }
    100% { transform: scale(2.2); opacity: 0; }
}

.thingsatweb-floorplan-pin:hover .thingsatweb-floorplan-pin-dot,
.thingsatweb-floorplan-pin:focus-visible .thingsatweb-floorplan-pin-dot {
    transform: scale(1.2);
    background: var(--pin-color-dark);
}

/* Direction cone, rotated to the visitor's live heading. */
.thingsatweb-floorplan-pin-cone {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    display: none;
    background: radial-gradient(closest-side, rgba(22, 163, 74, 0.55), rgba(22, 163, 74, 0));
    clip-path: polygon(50% 50%, 22% 0%, 78% 0%);
    transform: rotate(var(--pin-rotation));
    transform-origin: 50% 50%;
    pointer-events: none;
}

.thingsatweb-floorplan-pin.is-active .thingsatweb-floorplan-pin-cone {
    display: block;
}

/* Name pill. Clickable (it sits inside the pin button), so tapping the
   name goes to the scene too - before, clicks on it fell through to the
   map and did nothing. */
.thingsatweb-floorplan-pin-label {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--pin-color);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: background 0.15s ease;
}

/* Chevron: "this goes somewhere". Not on the scene you're already in. */
.thingsatweb-floorplan-pin:not(.is-active) .thingsatweb-floorplan-pin-label::after {
    content: "\203A";
    margin-left: 4px;
    font-size: 13px;
    line-height: 1;
}

.thingsatweb-floorplan-pin:hover .thingsatweb-floorplan-pin-label,
.thingsatweb-floorplan-pin:focus-visible .thingsatweb-floorplan-pin-label {
    background: var(--pin-color-dark);
}

.thingsatweb-floorplan-pin.is-active {
    cursor: default;
}

/* Crowded pins: pro-viewer.js shortens a name that would cover another.
   Hover / keyboard focus brings the pin to the front with its full name. */
.thingsatweb-floorplan-pin.is-label-compact .thingsatweb-floorplan-pin-label {
    max-width: 72px;
}

.thingsatweb-floorplan-pin:hover,
.thingsatweb-floorplan-pin:focus-visible {
    z-index: 3;
}

.thingsatweb-floorplan-pin:hover .thingsatweb-floorplan-pin-label,
.thingsatweb-floorplan-pin:focus-visible .thingsatweb-floorplan-pin-label {
    max-width: 220px;
}

/* Legend under the map, so first-time visitors know what the pins do. */
.thingsatweb-floorplan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 0 10px 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #5a6270;
}

.thingsatweb-floorplan-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.thingsatweb-floorplan-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2f7bea;
    box-shadow: 0 0 0 2px rgba(47, 123, 234, 0.25);
}

.thingsatweb-floorplan-legend .is-here i {
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}

/* Pins near an edge: grow the label toward the inside of the map so the
   map's overflow:hidden doesn't cut it off (classes set in viewer.php). */
.thingsatweb-floorplan-pin--label-start .thingsatweb-floorplan-pin-label {
    left: -4px;
    transform: none;
}

.thingsatweb-floorplan-pin--label-end .thingsatweb-floorplan-pin-label {
    left: auto;
    right: -4px;
    transform: none;
}

.thingsatweb-floorplan-pin--label-above .thingsatweb-floorplan-pin-label {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 6px;
}

/* ==================== SMALL SCREENS ==================== */
/* Narrower tours: pro-viewer.js adds .is-compact when the card's text
   would run into the centred 1/6 pager - show just the thumbnail. */
.thingsatweb-floorplan.is-compact .thingsatweb-floorplan-toggle-text {
    display: none;
}

.thingsatweb-floorplan.is-compact .thingsatweb-floorplan-toggle {
    padding: 4px;
}

@media (max-width: 768px) {
    /* Phones: zoom / reset / play stack down the right edge, just above
       the Scenes button - they used to sit in a row in the middle of the
       panorama. */
    .thingsatweb-pro-controls {
        top: auto;
        bottom: 58px;
        right: 8px;
        transform: none;
        flex-direction: column;
        gap: 6px;
    }

    .thingsatweb-virtual-tour-container .thingsatweb-pro-btn {
        width: 38px;
        height: 38px;
    }

    /* Floor plan: left edge, just above the scene title - the right edge
       belongs to the controls, and the toggle used to float mid-screen.
       Same spot whichever bottom corner was chosen, since a phone has no
       room for it on the right. */
    .thingsatweb-floorplan--bottom-right,
    .thingsatweb-floorplan--bottom-left {
        left: 8px;
        right: auto;
        bottom: 58px;
    }

    .thingsatweb-floorplan--bottom-right.is-open,
    .thingsatweb-floorplan--bottom-left.is-open {
        bottom: 58px;
    }

    /* Keep the open panel inside the tour, not the page. */
    .thingsatweb-floorplan-panel {
        max-width: calc(100vw - 32px);
    }

    /* Phones: thumbnail with its count badge only. */
    .thingsatweb-floorplan-toggle-text {
        display: none;
    }

    .thingsatweb-floorplan-toggle {
        height: 48px;
        padding: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thingsatweb-virtual-tour-container .thingsatweb-pro-btn,
    .thingsatweb-floorplan-toggle,
    .thingsatweb-floorplan-pin-dot,
    .thingsatweb-floorplan-pin-label {
        transition: none;
    }

    .thingsatweb-floorplan-pin-dot::after,
    .thingsatweb-floorplan-toggle-ping::after {
        animation: none;
        opacity: 0.6;
    }
}
