/**
 * Estilos Personalizados y Componentes Interactivos
 * Baterías a Domicilio 24 Horas
 */

/* Desplazamiento suave general */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 120px;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 110px;
    }
}

/* Ocultar barra de desplazamiento sin perder funcionalidad */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==========================================================================
   DESLIZADOR ANTES Y DESPUÉS (BEFORE / AFTER COMPARISON SLIDER)
   ========================================================================== */
.before-after-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(11, 37, 69, 0.1), 0 8px 10px -6px rgba(11, 37, 69, 0.05);
    background-color: #141b2b;
}

.before-after-container.is-dragging {
    cursor: ew-resize;
}

.before-image-wrapper {
    position: relative;
    width: 100%;
    display: block;
    line-height: 0;
}

.before-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    pointer-events: none;
    max-height: 520px;
}

.after-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
    line-height: 0;
    z-index: 2;
    pointer-events: none;
    border-right: 2px solid #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.4);
}

.after-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    pointer-events: none;
}

/* Manija divisora interactiva */
.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: #ffffff;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
}

.slider-handle-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    background-color: #d31120;
    color: #ffffff;
    border: 3px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(211, 17, 32, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.before-after-container:hover .slider-handle-circle,
.before-after-container.is-dragging .slider-handle-circle {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: #a80014;
}

/* Etiquetas flotantes Antes y Después */
.slider-badge {
    position: absolute;
    top: 1.25rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

.badge-before {
    right: 1.25rem;
    background-color: rgba(20, 27, 43, 0.85);
    color: #ffe5e3;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-after {
    left: 1.25rem;
    background-color: rgba(211, 17, 32, 0.9);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(211, 17, 32, 0.4);
}

/* Rango oculto accesible para controles de teclado */
.slider-range {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 20;
}

.slider-range:focus {
    opacity: 0.8;
}

/* ==========================================================================
   ANIMACIONES Y EFECTOS
   ========================================================================== */
@keyframes emergency-pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(229, 35, 40, 0.6);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(229, 35, 40, 0);
    }
}

.pulse-glow {
    animation: emergency-pulse-glow 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

/* Efecto hover suave en tarjetas de baterías */
.product-card {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(11, 37, 69, 0.12);
}

/* Floating Emergency Bottom Pill on Mobile */
.mobile-sticky-pill {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 49;
    filter: drop-shadow(0 10px 15px rgba(11, 37, 69, 0.2));
}

@media (min-width: 1024px) {
    .mobile-sticky-pill {
        display: none !important;
    }
}
