/**
 * Back to Top Component Styles
 * 
 * Floating back-to-top button with responsive positioning
 * and smooth fade animations.
 */

.back-to-top-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* 
     * Smooth transitions for both properties.
     * Opacity: Fades over 0.3s (increased from 0.15s for better visibility).
     * Visibility: Changes instantly (0s), but is DELAYED when hiding.
     */
    transition: opacity 0.3s ease-out, visibility 0s linear 0.3s;
}

.back-to-top-container.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* 
     * On fade-in, use a slower transition for better visual balance.
     * This makes the fade-in more noticeable and matches the perceived fade-out speed.
     */
    transition: opacity 0.5s ease-out;
    transition-delay: 0s;
}

.back-to-top-btn {
    display: flex;
    align-items: center;
    padding: 12px 15px 12px 12px;
    gap: 10px;
    background-color: #ffffff;
    border: 1px solid var(--e-global-color-5e8f42f);
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.3s ease-out, background-color 0.3s ease-out, color 0.3s ease-out;
    text-decoration: none;
    outline: none;
    color: var(--e-global-color-06ed7f5);
}

.back-to-top-btn:hover {
    border-color: var(--e-global-color-a186541);
    background-color: #ffffff;
    color: var(--e-global-color-06ed7f5);
}

.back-to-top-btn:focus {
    border-color: var(--e-global-color-a186541);
    background-color: #ffffff;
    color: var(--e-global-color-06ed7f5);
    outline: 2px solid var(--e-global-color-a186541);
    outline-offset: 2px;
}

.back-to-top-icon-container {
    position: relative;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.back-to-top-icon {
    width: 15px;
    height: 15px;
    display: block;
}

.back-to-top-icon.original {
    position: relative;
    z-index: 1;
}

.back-to-top-icon.animated {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.back-to-top-btn:hover .back-to-top-icon.animated {
    animation: arrow-preview 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes arrow-preview {
    0% { 
        transform: translateY(0); 
        opacity: 1; 
    }
    20% { 
        transform: translateY(-8px); 
        opacity: 0; 
    }
    21% { 
        transform: translateY(0); 
        opacity: 0; 
    }
    40% { 
        transform: translateY(0); 
        opacity: 1; 
    }
    60% { 
        transform: translateY(-8px); 
        opacity: 0; 
    }
    100% { 
        transform: translateY(-8px); 
        opacity: 0; 
    }
}

.back-to-top-text {
    white-space: nowrap;
    margin: 0;
    color: var(--e-global-color-d4bf8da);
}

/* Media Query Breakpoints */

/* Mobile: max-width: 767px */
@media (max-width: 767px) {
    .back-to-top-container {
        bottom: 20px;
        right: 16px;
    }
    
}

/* Tablet: min-width: 768px and max-width: 1141px */
@media (min-width: 768px) and (max-width: 1141px) {
    .back-to-top-container {
        bottom: 25px;
        right: 25px;
    }
    
}

/* Desktop Small: min-width: 1142px and max-width: 1600px */
@media (min-width: 1142px) and (max-width: 1600px) {
    .back-to-top-container {
        bottom: 30px;
        right: 30px;
    }
}

/* Desktop Large: min-width: 1601px */
@media (min-width: 1601px) {
    .back-to-top-container {
        bottom: 40px;
        right: 40px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .back-to-top-container {
        transition: none;
    }
    
    .back-to-top-btn {
        transition: none;
    }
}