/* Scroll Progress Indicator Widget Styles */

.wml-scroll-progress-indicator {
    --wml-spi-z-index: 9999;
    --wml-spi-progress-color: #3b82f6;
    --wml-spi-bg-color: #e5e7eb;
    --wml-spi-bar-height: 4px;
    --wml-spi-circle-size: 60px;
    --wml-spi-stroke-width: 4px;
    --wml-spi-circumference: 175.929;
}

/* ========================================
   Top Bar Style
   ======================================== */

.wml-scroll-progress-indicator[data-style="bar"] {
    position: fixed;
    left: 0;
    right: 0;
    z-index: var(--wml-spi-z-index);
    pointer-events: none;
}

.wml-scroll-progress-indicator[data-style="bar"][data-position="top"] {
    top: 0;
}

.wml-scroll-progress-indicator[data-style="bar"][data-position="bottom"] {
    bottom: 0;
}

.wml-scroll-progress-bar {
    width: 100%;
    height: var(--wml-spi-bar-height);
    background-color: var(--wml-spi-bg-color);
    overflow: hidden;
}

.wml-scroll-progress-fill {
    width: 0%;
    height: 100%;
    background-color: var(--wml-spi-progress-color);
    transition: width 0.1s ease-out;
    will-change: width;
}

/* ========================================
   Circular Style
   ======================================== */

.wml-scroll-progress-indicator[data-style="circular"] {
    position: fixed;
    z-index: var(--wml-spi-z-index);
    pointer-events: none;
}

/* Circle Position Variants */
.wml-scroll-progress-indicator[data-style="circular"][data-position="top-right"] {
    top: 20px;
    right: 20px;
}

.wml-scroll-progress-indicator[data-style="circular"][data-position="top-left"] {
    top: 20px;
    left: 20px;
}

.wml-scroll-progress-indicator[data-style="circular"][data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

.wml-scroll-progress-indicator[data-style="circular"][data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.wml-scroll-progress-circle {
    position: relative;
    width: var(--wml-spi-circle-size);
    height: var(--wml-spi-circle-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wml-scroll-progress-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.wml-scroll-progress-track {
    fill: none;
    stroke: var(--wml-spi-bg-color);
    stroke-width: var(--wml-spi-stroke-width);
}

.wml-scroll-progress-indicator-circle {
    fill: none;
    stroke: var(--wml-spi-progress-color);
    stroke-width: var(--wml-spi-stroke-width);
    stroke-linecap: round;
    stroke-dasharray: var(--wml-spi-circumference);
    stroke-dashoffset: var(--wml-spi-circumference);
    transition: stroke-dashoffset 0.1s ease-out;
    will-change: stroke-dashoffset;
}

.wml-scroll-progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--wml-spi-progress-color);
    white-space: nowrap;
}

/* ========================================
   Bricks Builder Editor Adjustments
   ======================================== */

/* In editor, show a preview version that's not fixed */
.bricks-builder-iframe .wml-scroll-progress-indicator[data-style="bar"],
.bricks-builder-iframe .wml-scroll-progress-indicator[data-style="circular"] {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
}

.bricks-builder-iframe .wml-scroll-progress-indicator[data-style="bar"] .wml-scroll-progress-fill {
    width: 50%;
}

.bricks-builder-iframe .wml-scroll-progress-indicator[data-style="circular"] .wml-scroll-progress-indicator-circle {
    stroke-dashoffset: calc(var(--wml-spi-circumference) * 0.5);
}

.bricks-builder-iframe .wml-scroll-progress-indicator[data-style="circular"] .wml-scroll-progress-percentage {
    content: "50%";
}