/* Floating Navigation Buttons Group */
.floating-nav-group {
    position: fixed;
    bottom: 100px; /* Desktop position */
    right: 20px; /* Desktop position */
    z-index: 1050; /* Above most content */
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.floating-nav-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #ff6b93);
    border: 2px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    font-size: 1.3rem;
    animation: floatIn 0.3s ease forwards;
}

.floating-nav-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: var(--secondary-color, #ff4a7a);
}

/* Tooltip - positioned on LEFT side for LTR, RIGHT side for RTL */
.btn-tooltip {
    position: absolute;
    right: 65px; /* Default for LTR */
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1051;
}

/* Tooltip arrow for LTR (points right) */
.btn-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.85);
}

.floating-nav-btn:hover .btn-tooltip {
    opacity: 1;
    visibility: visible;
    right: 70px;
}

/* Individual button styles */
.floating-back-btn {
    background: #6c757d;
}

.floating-back-btn:hover {
    background: #5a6268;
}

.floating-home-btn {
    background: var(--primary-color, #ff6b93);
}

/* Animation */
@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Cart Floating Button - New Mobile-Aware Positioning */
.cart-floating-btn {
    position: fixed;
    bottom: 80px; /* Positioned below floating nav group on desktop */
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color, #ff6b93);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1049; /* Below floating nav */
}

.cart-floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* For RTL layout - tooltip on the right side */
html[dir="rtl"] .floating-nav-group {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .btn-tooltip {
    right: auto;
    left: 65px;
}

html[dir="rtl"] .btn-tooltip::after {
    right: auto;
    left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent rgba(0, 0, 0, 0.85) transparent transparent;
}

html[dir="rtl"] .floating-nav-btn:hover .btn-tooltip {
    right: auto;
    left: 70px;
}

html[dir="rtl"] .cart-floating-btn {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .cart-count {
    right: auto;
    left: -5px;
}

/* Mobile Layout - Stack buttons properly */
@media (max-width: 768px) {
    .floating-nav-group {
        bottom: 140px !important; /* Higher to accommodate cart button */
        right: 15px !important;
        gap: 12px !important;
    }

    .floating-nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .btn-tooltip {
        font-size: 0.85rem;
        padding: 6px 10px;
        right: 60px;
    }

    .cart-floating-btn {
        bottom: 90px !important; /* Fixed position above footer */
        right: 15px !important;
        width: 56px;
        height: 56px;
        font-size: 1.4rem;
        z-index: 1048 !important; /* Lower than floating nav */
    }

    .cart-count {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
    }

    html[dir="rtl"] .floating-nav-group {
        left: 15px !important;
        right: auto !important;
    }

    html[dir="rtl"] .btn-tooltip {
        left: 60px;
    }

    html[dir="rtl"] .cart-floating-btn {
        left: 15px !important;
        right: auto !important;
    }

    /* Different layout for landscape mode */
    @media (max-height: 500px) {
        .floating-nav-group {
            bottom: 120px !important;
            gap: 8px !important;
        }

        .cart-floating-btn {
            bottom: 80px !important;
        }
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .floating-nav-group {
        bottom: 130px !important;
        right: 10px !important;
        gap: 10px !important;
    }

    .floating-nav-btn {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }

    .cart-floating-btn {
        bottom: 85px !important;
        right: 10px !important;
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }

    html[dir="rtl"] .floating-nav-group {
        left: 10px !important;
    }
}