.back-to-top-demo {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 15px;
padding: 30px;
color: white;
text-align: center;
}
.demo-content h3 {
margin: 0 0 20px 0;
font-size: 1.8rem;
font-weight: 600;
}
.demo-content p {
margin: 20px 0;
font-size: 1.1rem;
opacity: 0.9;
}
.spacer {
height: 200px;
}
.back-to-top {
position: fixed;
bottom: 30px;
right: 30px;
width: 50px;
height: 50px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
opacity: 0;
visibility: hidden;
transform: translateY(20px);
z-index: 1000;
}
.back-to-top.visible {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.back-to-top:hover {
transform: translateY(-3px) scale(1.1);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.back-to-top:active {
transform: translateY(-1px) scale(1.05);
}
.back-to-top svg {
width: 24px;
height: 24px;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* Pulse animation */
.back-to-top.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
50% {
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
100% {
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
}
/* Scroll progress indicator */
.back-to-top::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
border-radius: 50%;
background: conic-gradient(transparent, #667eea, transparent 30%);
opacity: 0;
transition: opacity 0.3s ease;
z-index: -1;
}
.back-to-top.progress::before {
opacity: 1;
animation: rotate 1.5s linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
.back-to-top,
.back-to-top.visible,
.back-to-top:hover,
.back-to-top:active,
.back-to-top.pulse,
.back-to-top.progress::before {
transition: none !important;
animation: none !important;
transform: none !important;
}
}
/* Responsive */
@media (max-width: 768px) {
.back-to-top {
bottom: 20px;
right: 20px;
width: 45px;
height: 45px;
}
.back-to-top svg {
width: 20px;
height: 20px;
}
}
@media (max-width: 480px) {
.back-to-top {
bottom: 15px;
right: 15px;
width: 40px;
height: 40px;
}
}