/* ============================================
   FLOATING CART BUTTON
   Bottom-right fixed cart with item count
   ============================================ */

.floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
    display: none;
    /* Hidden by default, shown when items added */
}

.floating-cart-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color, #2563eb) 0%, #1e40af 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1);
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    position: relative;
    cursor: pointer;
}

.floating-cart-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-cart-button:active {
    transform: translateY(-2px) scale(1.02);
}

/* Cart Icon */
.cart-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 2px;
    stroke-width: 2.5;
}

/* Cart Count Badge */
.cart-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-color, #ef4444);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: countPulse 0.3s ease;
}

/* Cart Label */
.cart-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: -2px;
}

/* Animation when items are added */
@keyframes countPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse animation when cart has items */
.floating-cart-button.has-items {
    animation: cartBounce 0.5s ease;
}

@keyframes cartBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-8px);
    }

    50% {
        transform: translateY(-4px);
    }

    75% {
        transform: translateY(-6px);
    }
}

/* Tooltip on hover (optional) */
.floating-cart-button::before {
    content: attr(aria-label);
    position: absolute;
    right: 80px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.floating-cart-button:hover::before {
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .floating-cart {
        bottom: 16px;
        /* Below search button on mobile */
        right: 16px;
    }

    .floating-cart-button {
        width: 60px;
        height: 60px;
    }

    .cart-icon {
        width: 24px;
        height: 24px;
    }

    .cart-count {
        min-width: 20px;
        height: 20px;
        font-size: 0.7rem;
        top: 2px;
        right: 2px;
    }

    .cart-label {
        font-size: 0.65rem;
    }

    /* Hide tooltip on mobile */
    .floating-cart-button::before {
        display: none;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .floating-cart {
        bottom: 70px;
        right: 12px;
    }

    .floating-cart-button {
        width: 56px;
        height: 56px;
    }

    .cart-icon {
        width: 22px;
        height: 22px;
    }
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .floating-cart-button,
    .cart-count {
        animation: none;
        transition: none;
    }

    .floating-cart-button:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .floating-cart-button {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4),
            0 2px 6px rgba(0, 0, 0, 0.3);
    }

    .floating-cart-button:hover {
        box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5),
            0 4px 12px rgba(0, 0, 0, 0.4);
    }
}