/* Vinyl Visualizer — scoped under .poolwebs-visualizer */

.poolwebs-visualizer {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ── Controls toggle button ───────────────────────────────────── */

.pv-controls-toggle {
    position: absolute;
    bottom: 0;
    right: 16px;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 24px;
    border: none;
    border-radius: 6px 6px 0 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.15s, bottom 0.3s ease;
    padding: 0;
}

.pv-controls-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.pv-controls-toggle__icon.dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.pv-controls-toggle.is-hidden .pv-controls-toggle__icon {
    transform: rotate(180deg);
}

/* ── Controls bar ─────────────────────────────────────────────── */

.pv-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: transform 0.3s ease;
}

.pv-controls.is-hidden {
    transform: translateY(100%);
}

/* ── Custom pattern dropdown ──────────────────────────────────── */

.pv-controls__pattern {
    position: relative;
    min-width: 240px;
}

.pv-pattern-select {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
}

.pv-pattern-select:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.pv-pattern-select.is-open {
    border-color: rgba(255, 255, 255, 0.7);
}

.pv-pattern-select__thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.pv-pattern-select__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
}

.pv-pattern-select__arrow {
    flex-shrink: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: auto;
}

.pv-pattern-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    z-index: 100;
}

.pv-pattern-dropdown[hidden] {
    display: none;
}

.pv-pattern-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #fff;
    cursor: pointer;
    transition: background 0.1s;
}

.pv-pattern-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

.pv-pattern-option.is-selected {
    background: rgba(255, 255, 255, 0.18);
}

.pv-pattern-option__thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.pv-pattern-option__title {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Time-of-day buttons */

.pv-controls__time {
    display: flex;
    gap: 4px;
}

.pv-time-btn {
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pv-time-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pv-time-btn.is-active {
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    border-color: rgba(255, 255, 255, 0.9);
}

/* Angle navigation */

.pv-controls__angle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Motion toggle */

.pv-motion-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    flex-shrink: 0;
}

.pv-motion-btn__icon.dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    line-height: 1;
}

/* Slow spin when motion is active */
.pv-motion-btn:not(.is-paused) .pv-motion-btn__icon {
    animation: pv-spin 3s linear infinite;
}

/* On hover: stop spin and swap to pause icon */
.pv-motion-btn:not(.is-paused):hover .pv-motion-btn__icon {
    animation: none;
}

.pv-motion-btn:not(.is-paused):hover .pv-motion-btn__icon.dashicons::before {
    content: "\f523"; /* dashicons-controls-pause */
}

.pv-motion-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pv-motion-btn.is-paused {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
}

.pv-angle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.pv-angle-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.pv-angle-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.pv-angle-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    line-height: 1;
    font-size: 13px;
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
    color: #fff;
}

/* ── Canvas container ─────────────────────────────────────────── */

.pv-stage {
    position: relative;
}

.pv-canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a1a;
    overflow: hidden;
}

/* ── Viewport & crossfade ────────────────────────────────────── */

.pv-viewport {
    position: absolute;
    inset: 0;
}

.pv-viewport__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease;
    will-change: transform, opacity;
    animation-duration: 14s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.pv-viewport__img.is-active {
    opacity: 1;
}

/* ── Ken Burns presets ───────────────────────────────────────── */

@keyframes pv-kb-zoom-in {
    from { transform: scale3d(1, 1, 1) translateZ(0); }
    to   { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translateZ(0); }
}

@keyframes pv-kb-zoom-out {
    from { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translateZ(0); }
    to   { transform: scale3d(1, 1, 1) translateZ(0); }
}

@keyframes pv-kb-pan-left {
    from { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translate3d(var(--kb-pan, 2%), 0, 0); }
    to   { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translate3d(calc(var(--kb-pan, 2%) * -1), 0, 0); }
}

@keyframes pv-kb-pan-right {
    from { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translate3d(calc(var(--kb-pan, 2%) * -1), 0, 0); }
    to   { transform: scale3d(var(--kb-scale, 1.12), var(--kb-scale, 1.12), 1) translate3d(var(--kb-pan, 2%), 0, 0); }
}

/* ── Welcome overlay ──────────────────────────────────────────── */

.pv-welcome {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 81px; /* default offset; overridden by JS from welcomePadding config */
}

.pv-welcome[hidden] {
    display: none;
}

.pv-welcome__bg {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    will-change: transform;
    animation-duration: 14s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.pv-welcome__content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 24px 32px;
    max-width: 560px;
}

.pv-welcome__heading {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.pv-welcome__text {
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ── Pattern carousel ─────────────────────────────────────────── */

.pv-carousel-title {
    margin-top: 16px;
    padding: 0 12px;
    font-size: 22.5px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    line-height: 1.3;
}

.pv-carousel-title[hidden] {
    display: none;
}

.pv-carousel-title + .pv-carousel {
    margin-top: 8px;
}

.pv-carousel {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 16px;
}

.pv-carousel__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.pv-carousel__arrow:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: rgba(0, 0, 0, 0.25);
}

.pv-carousel__arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.pv-carousel__arrow--prev {
    margin-right: 8px;
}

.pv-carousel__arrow--next {
    margin-left: 8px;
}

.pv-carousel__track-wrap {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.pv-carousel__track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 4px 0 12px;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

/* When cards overflow, left-align so scrolling works naturally */
.pv-carousel__track.is-overflowing {
    justify-content: flex-start;
}

/* Hide scrollbar */
.pv-carousel__track::-webkit-scrollbar {
    height: 0;
    display: none;
}

.pv-carousel__track {
    scrollbar-width: none;
}

.pv-carousel__card {
    flex: 0 0 auto;
    width: var(--pv-thumb-size, 200px);
    cursor: pointer;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    border: none;
    background: #fff;
    color: #111;
    transition: border-color 0.15s;
}

.pv-carousel__card:hover {
    box-shadow: 0 0 0 2px #999;
}

.pv-carousel__card.is-selected {
    box-shadow: 0 0 0 2px #0073aa;
}

.pv-carousel__thumb {
    display: block;
    width: 100%;
    height: var(--pv-thumb-size, 200px);
    min-height: var(--pv-thumb-size, 200px);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.pv-carousel__title {
    display: block;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111;
}

/* ── Loading spinner ──────────────────────────────────────────── */

.pv-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 26, 0.7);
    transition: opacity 0.2s;
}

.pv-spinner[hidden] {
    display: none;
}

.pv-spinner__circle {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pv-spin 0.7s linear infinite;
}

@keyframes pv-spin {
    to { transform: rotate(360deg); }
}

/* ── Error message ────────────────────────────────────────────── */

.pv-error {
    margin-top: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.pv-error[hidden] {
    display: none;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 600px) {
    /* On mobile, move the controls below the visualizer canvas instead of
       overlaying it. The toggle isn't needed since controls are always
       visible in normal flow. */
    .pv-controls-toggle {
        display: none;
    }

    .pv-controls {
        position: static;
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        row-gap: 10px;
    }

    .pv-controls.is-hidden {
        transform: none;
    }

    /* On mobile, the carousel below the canvas serves as the pattern
       selector — no need for the dropdown inside the controls bar. */
    .pv-controls__pattern {
        display: none;
    }

    /* Row 1: arrows. Row 2: Animate | Day/Night. */
    .pv-controls__angle {
        order: 1;
        flex-basis: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .pv-motion-btn {
        order: 2;
    }

    .pv-controls__time {
        order: 3;
        justify-content: center;
    }

    .pv-carousel__card {
        width: var(--pv-thumb-size-mobile, 96px);
    }

    .pv-carousel__thumb {
        height: var(--pv-thumb-size-mobile, 96px);
        min-height: var(--pv-thumb-size-mobile, 96px);
    }
}
