/* 
 * Ottmegastore.in - Floating Cart Icon Styles
 * Author: Ravi Shandilya
 * Version: 1.1
 * Updated: June 2, 2025
 * Compatible with Chrome 136+, Android 13+
 */

:root {
    --floating-cart-size: 60px;
    --floating-cart-color-primary: #3b82f6;
    --floating-cart-color-secondary: #60a5fa;
    --floating-cart-badge-color: #ef4444;
}

.floating-cart {
    position: fixed;
    bottom: 80px; /* Positioned higher than scroll-to-top button (which is at bottom: 20px) */
    right: 20px;
    width: var(--floating-cart-size, 60px);
    height: var(--floating-cart-size, 60px);
    background: -webkit-linear-gradient(left, #3b82f6, #60a5fa);
    background: linear-gradient(to right, #3b82f6, #60a5fa);
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    color: white;
    -webkit-box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
            box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 998; /* Set z-index slightly lower than scroll-to-top to ensure proper stacking */
    -webkit-transform: scale(0);
            transform: scale(0);
    opacity: 0;
    -webkit-transition: -webkit-transform 0.3s ease, opacity 0.3s ease, -webkit-box-shadow 0.3s ease, bottom 0.3s ease;
    transition: -webkit-transform 0.3s ease, opacity 0.3s ease, -webkit-box-shadow 0.3s ease, bottom 0.3s ease;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, bottom 0.3s ease;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, bottom 0.3s ease, -webkit-transform 0.3s ease, -webkit-box-shadow 0.3s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, opacity, bottom;
    -webkit-transform: translateZ(0);
            transform: translateZ(0);
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.floating-cart.active {
    -webkit-transform: scale(1);
            transform: scale(1);
    opacity: 1;
    -webkit-animation: floatingCartAppear 0.5s ease forwards;
            animation: floatingCartAppear 0.5s ease forwards;
}

.floating-cart:hover {
    -webkit-box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    -webkit-transform: scale(1.05) translateY(-3px);
            transform: scale(1.05) translateY(-3px);
}

.floating-cart:active {
    -webkit-transform: scale(0.95);
            transform: scale(0.95);
}

.floating-cart i {
    font-size: 24px;
}

.floating-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--floating-cart-badge-color, #ef4444);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    font-size: 12px;
    font-weight: bold;
    -webkit-box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
            box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
    -webkit-transform: scale(0);
            transform: scale(0);
    -webkit-transition: -webkit-transform 0.3s ease 0.2s;
    transition: -webkit-transform 0.3s ease 0.2s;
    transition: transform 0.3s ease 0.2s;
    transition: transform 0.3s ease 0.2s, -webkit-transform 0.3s ease 0.2s;
    will-change: transform;
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
}

.floating-cart.active .floating-cart-badge {
    -webkit-transform: scale(1);
            transform: scale(1);
    -webkit-animation: badgePulse 2s infinite;
            animation: badgePulse 2s infinite;
}

@-webkit-keyframes floatingCartAppear {
    0% {
        -webkit-transform: scale(0) translateY(20px);
                transform: scale(0) translateY(20px);
        opacity: 0;
    }
    70% {
        -webkit-transform: scale(1.1);
                transform: scale(1.1);
        opacity: 1;
    }
    100% {
        -webkit-transform: scale(1);
                transform: scale(1);
        opacity: 1;
    }
}

@keyframes floatingCartAppear {
    0% {
        -webkit-transform: scale(0) translateY(20px);
                transform: scale(0) translateY(20px);
        opacity: 0;
    }
    70% {
        -webkit-transform: scale(1.1);
                transform: scale(1.1);
        opacity: 1;
    }
    100% {
        -webkit-transform: scale(1);
                transform: scale(1);
        opacity: 1;
    }
}

@-webkit-keyframes badgePulse {
    0% {
        -webkit-transform: scale(1);
                transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.1);
                transform: scale(1.1);
    }
    100% {
        -webkit-transform: scale(1);
                transform: scale(1);
    }
}

@keyframes badgePulse {
    0% {
        -webkit-transform: scale(1);
                transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.1);
                transform: scale(1.1);
    }
    100% {
        -webkit-transform: scale(1);
                transform: scale(1);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .floating-cart {
        bottom: 75px; /* Keep distance from scroll-to-top button on mobile */
        right: 15px;
        width: 55px;
        height: 55px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .floating-cart {
        bottom: 70px; /* Adjust for smaller screens */
        right: 10px;
        width: 50px; /* Slightly smaller on very small screens */
        height: 50px;
    }
    
    .floating-cart i {
        font-size: 20px; /* Smaller icon for better fit */
    }
    
    .floating-cart-badge {
        width: 22px;
        height: 22px;
        font-size: 11px;
        top: -4px;
        right: -4px;
    }
}
