/* Scroll Buttons Pro - Styles */

.sbp-scroll-button {
    position: fixed;
    width: var(--sbp-button-size);
    height: var(--sbp-button-size);
    cursor: pointer;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: scale(0.8);
}

.sbp-scroll-button.sbp-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Position Classes */
.sbp-position-bottom-right {
    bottom: var(--sbp-offset-vertical);
    right: var(--sbp-offset-horizontal);
}

.sbp-position-bottom-left {
    bottom: var(--sbp-offset-vertical);
    left: var(--sbp-offset-horizontal);
}

.sbp-position-top-right {
    top: var(--sbp-offset-vertical);
    right: var(--sbp-offset-horizontal);
}

.sbp-position-top-left {
    top: var(--sbp-offset-vertical);
    left: var(--sbp-offset-horizontal);
}

/* Adjust spacing when multiple buttons are in the same corner */
/* The button rendered second gets the spacing offset */
.sbp-scroll-button.sbp-order-second.sbp-position-bottom-right {
    bottom: calc(var(--sbp-offset-vertical) + var(--sbp-button-size) + var(--sbp-button-spacing));
}

.sbp-scroll-button.sbp-order-second.sbp-position-bottom-left {
    bottom: calc(var(--sbp-offset-vertical) + var(--sbp-button-size) + var(--sbp-button-spacing));
}

.sbp-scroll-button.sbp-order-second.sbp-position-top-right {
    top: calc(var(--sbp-offset-vertical) + var(--sbp-button-size) + var(--sbp-button-spacing));
}

.sbp-scroll-button.sbp-order-second.sbp-position-top-left {
    top: calc(var(--sbp-offset-vertical) + var(--sbp-button-size) + var(--sbp-button-spacing));
}

/* Button Content Container */
.sbp-button-content {
    width: 100%;
    height: 100%;
    background-color: var(--sbp-button-bg);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

.sbp-scroll-button:hover .sbp-button-content {
    background-color: var(--sbp-button-hover-bg);
}

/* Icon */
.sbp-icon {
    color: var(--sbp-button-icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.sbp-icon svg {
    width: 24px;
    height: 24px;
}

/* Text */
.sbp-text {
    color: var(--sbp-button-text-color);
    font-size: 9px;
    font-weight: 600;
    margin-top: 2px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* When icon is hidden, center text */
.sbp-button-content .sbp-text:only-child {
    margin-top: 0;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Progress Ring */
.sbp-progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.sbp-progress-ring-bg {
    fill: none;
    stroke: var(--sbp-progress-bg);
    stroke-width: var(--sbp-progress-width);
}

.sbp-progress-ring-circle {
    fill: none;
    stroke: var(--sbp-progress-color);
    stroke-width: var(--sbp-progress-width);
    stroke-dasharray: 289;
    stroke-dashoffset: 289;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Ensure both buttons are exactly the same size */
    .sbp-scroll-button,
    .sbp-scroll-top,
    .sbp-scroll-bottom {
        width: calc(var(--sbp-button-size) * 0.85);
        height: calc(var(--sbp-button-size) * 0.85);
    }
    
    /* Ensure button content is exactly the same */
    .sbp-scroll-top .sbp-button-content,
    .sbp-scroll-bottom .sbp-button-content {
        width: 100%;
        height: 100%;
    }
    
    .sbp-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .sbp-text {
        font-size: 8px;
        letter-spacing: 0.2px;
    }
    
    .sbp-button-content .sbp-text:only-child {
        font-size: 9px;
    }
    
    /* Mobile positioning - apply offsets directly without calc multiplier */
    .sbp-position-bottom-right {
        right: var(--sbp-offset-horizontal);
        bottom: var(--sbp-offset-vertical);
    }
    
    .sbp-position-bottom-left {
        left: var(--sbp-offset-horizontal);
        bottom: var(--sbp-offset-vertical);
    }
    
    .sbp-position-top-right {
        right: var(--sbp-offset-horizontal);
        top: var(--sbp-offset-vertical);
    }
    
    .sbp-position-top-left {
        left: var(--sbp-offset-horizontal);
        top: var(--sbp-offset-vertical);
    }
    
    /* Adjust second button spacing on mobile */
    .sbp-scroll-button.sbp-order-second.sbp-position-bottom-right,
    .sbp-scroll-button.sbp-order-second.sbp-position-bottom-left {
        bottom: calc(var(--sbp-offset-vertical) + (var(--sbp-button-size) * 0.85) + var(--sbp-button-spacing));
    }
    
    .sbp-scroll-button.sbp-order-second.sbp-position-top-right,
    .sbp-scroll-button.sbp-order-second.sbp-position-top-left {
        top: calc(var(--sbp-offset-vertical) + (var(--sbp-button-size) * 0.85) + var(--sbp-button-spacing));
    }
}
