/* css/floating-scroll.css - BOTONES FLOTANTES OPTIMIZADOS PARA NAVEGACIÓN COMPACTA */

/* ===== CONTENEDOR PRINCIPAL ===== */
.floating-scroll-container {
    position: fixed;
    right: 16px;
    bottom: 90px;
    /* Posición por defecto, se ajusta dinámicamente */
    z-index: 85;
    /* Menor que modals (100) y navegación del carrusel (10) */
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

.floating-scroll-container.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* ===== BOTONES DE SCROLL - COMPACTOS PARA NO INTERFERIR ===== */
.floating-scroll-btn {
    position: relative;
    width: 44px;
    /* Ligeramente más pequeño para no interferir */
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 123, 140, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
}

.floating-scroll-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 123, 140, 0.4);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.floating-scroll-btn:active {
    transform: translateY(0) scale(0.95);
    transition: all 0.1s ease;
}

.floating-scroll-btn.animate {
    animation: buttonPress 0.3s ease;
}

@keyframes buttonPress {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== ESTADOS DE LOS BOTONES ===== */
.floating-scroll-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    transform: scale(0.9);
}

.floating-scroll-btn.hover {
    transform: translateY(-2px) scale(1.05);
}

/* ===== ICONOS ===== */
.floating-scroll-btn i {
    transition: transform 0.2s ease;
}

.floating-scroll-btn:hover i {
    transform: translateY(-1px);
}

.floating-scroll-btn.scroll-up i {
    animation: bounceUp 2s ease-in-out infinite;
}

.floating-scroll-btn.scroll-down i {
    animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceUp {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-3px);
    }

    60% {
        transform: translateY(-1px);
    }
}

@keyframes bounceDown {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(3px);
    }

    60% {
        transform: translateY(1px);
    }
}

/* ===== INDICADORES DE POSICIÓN ===== */
.scroll-position-indicator {
    position: absolute;
    left: -75px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.scroll-position-indicator::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid rgba(0, 0, 0, 0.8);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.floating-scroll-btn:hover .scroll-position-indicator {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(-3px);
}

/* ===== BARRA DE PROGRESO DE SCROLL ===== */
.scroll-progress-bar {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scroll-progress-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, var(--accent-color), var(--primary-color));
    border-radius: inherit;
    transition: height 0.1s ease-out;
    position: relative;
}

.scroll-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: inherit;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 769px) {

    /* Ocultar en desktop */
    .floating-scroll-container {
        display: none !important;
    }
}

/* ===== AJUSTES ESPECÍFICOS PARA DIFERENTES TAMAÑOS DE PANTALLA ===== */
@media (max-width: 480px) {
    .floating-scroll-container {
        right: 12px;
        gap: 6px;
    }

    .floating-scroll-btn {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    .scroll-position-indicator {
        left: -70px;
        font-size: 0.65rem;
        padding: 4px 6px;
    }

    .scroll-progress-bar {
        right: 6px;
        height: 90px;
        width: 2px;
    }
}

@media (max-width: 360px) {
    .floating-scroll-container {
        right: 10px;
        gap: 5px;
    }

    .floating-scroll-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .scroll-position-indicator {
        left: -65px;
        font-size: 0.6rem;
        padding: 3px 5px;
    }

    .scroll-progress-bar {
        height: 80px;
    }
}

/* ===== LANDSCAPE MÓVIL ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .floating-scroll-container {
        right: 10px;
        bottom: 60px;
        /* Menos espacio en landscape */
        gap: 4px;
    }

    .floating-scroll-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .scroll-position-indicator {
        left: -60px;
        font-size: 0.55rem;
        padding: 2px 4px;
    }

    .scroll-progress-bar {
        height: 60px;
        right: 4px;
    }
}

/* ===== CLASE PARA CUANDO HAY CARRUSEL ACTIVO ===== */
body.has-carousel .floating-scroll-container {
    /* El JavaScript ajustará dinámicamente la posición */
}

/* ===== MODO ACCESIBLE ===== */
@media (prefers-reduced-motion: reduce) {

    .floating-scroll-btn,
    .scroll-position-indicator,
    .scroll-progress-fill {
        transition: none !important;
        animation: none !important;
    }

    .floating-scroll-btn:hover {
        transform: none !important;
    }

    .floating-scroll-btn.animate {
        animation: none !important;
    }

    .floating-scroll-btn i {
        animation: none !important;
    }
}

/* ===== ALTO CONTRASTE ===== */
@media (prefers-contrast: high) {
    .floating-scroll-btn {
        border: 2px solid white;
        background: var(--primary-color);
    }

    .scroll-position-indicator {
        background: black;
        border: 1px solid white;
    }

    .scroll-progress-bar {
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid white;
    }

    .scroll-progress-fill {
        background: var(--accent-color);
    }
}

/* ===== TEMA OSCURO ===== */
@media (prefers-color-scheme: dark) {
    .floating-scroll-btn {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    }

    .floating-scroll-btn:hover {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
    }

    .scroll-position-indicator {
        background: rgba(20, 20, 20, 0.9);
        backdrop-filter: blur(10px);
    }

    .scroll-progress-bar {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

/* ===== INTERACCIÓN TÁCTIL MEJORADA ===== */
@media (hover: none) and (pointer: coarse) {
    .floating-scroll-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .floating-scroll-btn:active {
        background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
    }

    .scroll-position-indicator {
        display: none;
        /* Ocultar tooltips en dispositivos táctiles */
    }
}

/* ===== ESTADOS ESPECIALES ===== */
.floating-scroll-container.compact {
    gap: 5px;
}

.floating-scroll-container.compact .floating-scroll-btn {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
}

/* ===== ANIMACIONES DE ENTRADA ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.floating-scroll-container.visible {
    animation: fadeInUp 0.4s ease-out;
}

/* ===== FALLBACKS PARA NAVEGADORES ANTIGUOS ===== */
@supports not (backdrop-filter: blur(5px)) {
    .scroll-position-indicator {
        background: rgba(0, 0, 0, 0.9);
    }

    .scroll-progress-bar {
        background: rgba(255, 255, 255, 0.3);
    }
}